Skip to content

Commit 7abe559

Browse files
committed
Fix unit tests to allowExperimentalOptions() where needed
1 parent 3d9646c commit 7abe559

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/services/java/org/truffleruby/services/scriptengine/TruffleRubyScriptEngineFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public ScriptEngine getScriptEngine() {
108108

109109
private String query(String expression) {
110110
try (Context context = Context.newBuilder("ruby")
111+
.allowExperimentalOptions(true)
111112
.option("ruby.platform.native", "false")
112113
.option("ruby.rubygems", "false")
113114
.build()) {

src/test/java/org/truffleruby/ContextPermissionsTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public void testNoPermissions() throws Throwable {
2929

3030
@Test
3131
public void testNativeNoThreads() throws Throwable {
32-
// TODO (eregon, 4 Feb 2019): This should run on GraalVM, not developement jars
32+
// TODO (eregon, 4 Feb 2019): This should run on GraalVM, not development jars
3333
String home = System.getProperty("user.dir") + "/mxbuild/graalvm/jre/languages/ruby";
34-
try (Context context = Context.newBuilder("ruby").allowNativeAccess(true).option("ruby.home", home).build()) {
34+
try (Context context = Context.newBuilder("ruby").allowNativeAccess(true).allowExperimentalOptions(true).option("ruby.home", home).build()) {
3535
Assert.assertEquals(3, context.eval("ruby", "1 + 2").asInt());
3636

3737
Assert.assertEquals(true, context.eval("ruby", "File.directory?('.')").asBoolean());
@@ -41,7 +41,7 @@ public void testNativeNoThreads() throws Throwable {
4141
@Test
4242
public void testThreadsNoNative() throws Throwable {
4343
// The ruby.single_threaded option needs to be set because --single_threaded defaults to --embedded.
44-
try (Context context = Context.newBuilder("ruby").allowCreateThread(true).option("ruby.single_threaded", "false").build()) {
44+
try (Context context = Context.newBuilder("ruby").allowCreateThread(true).allowExperimentalOptions(true).option("ruby.single_threaded", "false").build()) {
4545
Assert.assertEquals(3, context.eval("ruby", "1 + 2").asInt());
4646

4747
Assert.assertEquals(7, context.eval("ruby", "Thread.new { 3 + 4 }.value").asInt());
@@ -53,7 +53,7 @@ public void testThreadsNoNative() throws Throwable {
5353

5454
@Test
5555
public void testNoThreadsEnforcesSingleThreadedOption() throws Throwable {
56-
try (Context context = Context.newBuilder("ruby").option("ruby.single_threaded", "false").build()) {
56+
try (Context context = Context.newBuilder("ruby").allowExperimentalOptions(true).option("ruby.single_threaded", "false").build()) {
5757
String option = "Truffle::Boot.get_option('single_threaded')";
5858
Assert.assertEquals(true, context.eval("ruby", option).asBoolean());
5959

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void testCreateContext() {
3737
@Test
3838
public void testCreateContextNoAccess() {
3939
try (Context polyglot = Context.newBuilder()
40+
.allowExperimentalOptions(true)
4041
.option(OptionsCatalog.HOME.getName(), System.getProperty("user.dir"))
4142
.option(OptionsCatalog.NATIVE_PLATFORM.getName(), Boolean.FALSE.toString())
4243
.build()) {

0 commit comments

Comments
 (0)