Skip to content

Commit 4139437

Browse files
committed
Add failing test that interactive parsing uses the current binding
1 parent 8a3ad67 commit 4139437

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/test/java/org/truffleruby/PolyglotInteropTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.graalvm.polyglot.Context;
1313
import org.graalvm.polyglot.Source;
1414
import org.graalvm.polyglot.Value;
15+
import org.junit.Ignore;
1516
import org.junit.Test;
1617
import org.truffleruby.fixtures.FluidForce;
1718
import org.truffleruby.shared.TruffleRuby;
@@ -174,4 +175,18 @@ public void testLocalVariablesSharedBetweenInteractiveEval() {
174175
}
175176
}
176177

178+
@Ignore
179+
@Test
180+
public void testLocalVariablesSharedBetweenInteractiveEvalChangesParsing() {
181+
try (Context polyglot = Context.newBuilder()
182+
.option(OptionsCatalog.HOME.getName(), System.getProperty("user.dir"))
183+
.allowAllAccess(true)
184+
.build()) {
185+
polyglot.eval(Source.newBuilder("ruby", "def foo; 12; end", "test").interactive(true).buildLiteral());
186+
assertEquals(12, polyglot.eval(Source.newBuilder("ruby", "foo", "test").interactive(true).buildLiteral()).asInt());
187+
polyglot.eval(Source.newBuilder("ruby", "foo = 42", "test").interactive(true).buildLiteral());
188+
assertEquals(42, polyglot.eval(Source.newBuilder("ruby", "foo", "test").interactive(true).buildLiteral()).asInt());
189+
}
190+
}
191+
177192
}

0 commit comments

Comments
 (0)