Skip to content

Commit 4920b80

Browse files
committed
[GR-15575] Add a test for requiring a gem from the Context API.
PullRequest: truffleruby/873
2 parents 6bf1747 + eb6d7cd commit 4920b80

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ public void testNativeNoThreads() throws Throwable {
3838
}
3939
}
4040

41+
@Test
42+
public void testRequireGem() {
43+
// TODO (eregon, 4 Feb 2019): This should run on GraalVM, not development jars
44+
String home = System.getProperty("user.dir") + "/mxbuild/truffleruby-jvm/jre/languages/ruby";
45+
try (Context context = Context.newBuilder("ruby")
46+
.allowIO(true)
47+
.allowNativeAccess(true)
48+
.allowExperimentalOptions(true)
49+
.option("ruby.home", home)
50+
.build()) {
51+
// NOTE: rake is a bundled gem, so it needs RubyGems to be required
52+
Assert.assertEquals("Rake", context.eval("ruby", "require 'rake'; Rake.to_s").asString());
53+
}
54+
}
55+
4156
@Test
4257
public void testThreadsNoNative() throws Throwable {
4358
// The ruby.single_threaded option needs to be set because --single-threaded defaults to --embedded.

0 commit comments

Comments
 (0)