Skip to content

Commit d3b6803

Browse files
committed
Add regression test for static field access which didn't work in 23.0
1 parent 42b7ef8 commit d3b6803

File tree

1 file changed

+15
-0
lines changed
  • graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/interop

1 file changed

+15
-0
lines changed

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/interop/HostInteropTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ public void tearDown() {
7575
context.close();
7676
}
7777

78+
public static int TEST_FIELD = 32;
79+
80+
@Test
81+
public void testStaticMembers() {
82+
int oldValue = TEST_FIELD;
83+
Value t = context.eval("python", String.format("""
84+
import java
85+
jt = java.type("%s")
86+
oldvalue = jt.TEST_FIELD
87+
jt.TEST_FIELD = oldvalue + 1
88+
jt.TEST_FIELD
89+
""", HostInteropTest.class.getName()));
90+
assertEquals(oldValue + 1, t.asInt());
91+
}
92+
7893
@Test
7994
public void testConstantInteropBehavior() {
8095
Value t = context.eval("python", """

0 commit comments

Comments
 (0)