Skip to content

Commit d749a1f

Browse files
committed
Replace test_data/unit fixtures with txt-verified E2E tests
Constants and StaticFlag move to test_data with mains and expected output generated by a real JVM. ConstantsReader is compiled against a non-final Constants so javac emits getstatic instead of inlining, keeping ConstantValue preparation observable from bytecode. The Rust-side putstatic typed-read assertion is dropped with test_data/unit; the narrowing fix itself is still exercised by StaticFlag's clinit.
1 parent 99eff87 commit d749a1f

14 files changed

Lines changed: 55 additions & 52 deletions

test_data/Constants.class

834 Bytes
Binary file not shown.
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class Constants {
1+
public class Constants {
22
static final boolean FLAG = true;
33
static final byte B = 3;
44
static final char C = 'a';
@@ -8,4 +8,14 @@ class Constants {
88
static final float F = 1.5f;
99
static final double D = 2.5;
1010
static final String STR = "hello";
11+
12+
public static void main(String[] args) {
13+
System.out.println(FLAG);
14+
System.out.println(B);
15+
System.out.println(C);
16+
System.out.println(S);
17+
System.out.println(I);
18+
System.out.println(L);
19+
System.out.println(STR);
20+
}
1121
}

test_data/Constants.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
true
2+
3
3+
a
4+
7
5+
42
6+
1234567890123
7+
hello

test_data/ConstantsReader.class

712 Bytes
Binary file not shown.

test_data/ConstantsReader.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// compiled against a non-final Constants so javac emits getstatic instead of
2+
// inlining the constants; run against the final Constants.class with ConstantValue attributes
3+
public class ConstantsReader {
4+
public static void main(String[] args) {
5+
System.out.println(Constants.FLAG);
6+
System.out.println(Constants.B);
7+
System.out.println(Constants.C);
8+
System.out.println(Constants.S);
9+
System.out.println(Constants.I);
10+
System.out.println(Constants.L);
11+
System.out.println(Constants.STR);
12+
}
13+
}

test_data/ConstantsReader.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
true
2+
3
3+
a
4+
7
5+
42
6+
1234567890123
7+
hello

test_data/StaticFlag.class

665 Bytes
Binary file not shown.

test_data/StaticFlag.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class StaticFlag {
2+
static boolean FLAG = true;
3+
static byte SMALL = 3;
4+
static char LETTER = 'a';
5+
static short COUNT = 7;
6+
7+
public static void main(String[] args) {
8+
System.out.println(FLAG);
9+
System.out.println(SMALL);
10+
System.out.println(LETTER);
11+
System.out.println(COUNT);
12+
}
13+
}

test_data/StaticFlag.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
true
2+
3
3+
a
4+
7

test_data/unit/Constants.class

-481 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)