File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
src/main/java/org/truffleruby/interop Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ fails(GR-24618):Truffle::Interop.other_languages? returns true with --polyglot
2
+ slow:Truffle::Interop.languages returns only ruby from the RubyLauncher
3
+ slow:Truffle::Interop.other_languages? returns false without --polyglot
Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. This
2
+ # code is released under a tri EPL/GPL/LGPL license. You can use it,
3
+ # redistribute it and/or modify it under the terms of the:
4
+ #
5
+ # Eclipse Public License version 2.0, or
6
+ # GNU General Public License version 2, or
7
+ # GNU Lesser General Public License version 2.1.
8
+
9
+ require_relative '../../ruby/spec_helper'
10
+
11
+ describe "Truffle::Interop.languages" do
12
+ it "returns the public languages" do
13
+ Truffle ::Interop . languages . should . include? ( 'ruby' )
14
+ end
15
+
16
+ guard_not -> { TruffleRuby . native? and Truffle ::Boot . was_preinitialized? } do # GR-24618
17
+ it "returns only ruby from the RubyLauncher" do
18
+ # Use RbConfig.ruby to remove a potential --polyglot option
19
+ `#{ RbConfig . ruby } -e 'p Truffle::Interop.languages'` . should == "[\" ruby\" ]\n "
20
+ end
21
+ end
22
+ end
23
+
24
+ describe "Truffle::Interop.other_languages?" do
25
+ guard_not -> { TruffleRuby . native? } do
26
+ it "returns true with --polyglot" do
27
+ ruby_exe ( 'p Truffle::Interop.other_languages?' , options : '--polyglot' ) . should == "true\n "
28
+ end
29
+ end
30
+
31
+ it "returns false without --polyglot" do
32
+ # Use RbConfig.ruby to remove a potential --polyglot option
33
+ `#{ RbConfig . ruby } -e 'p Truffle::Interop.other_languages?'` . should == "false\n "
34
+ end
35
+ end
Original file line number Diff line number Diff line change @@ -1056,6 +1056,16 @@ protected DynamicObject languages() {
1056
1056
1057
1057
}
1058
1058
1059
+ @ CoreMethod (names = "other_languages?" , onSingleton = true , required = 0 )
1060
+ public abstract static class HasOtherLanguagesNode extends CoreMethodArrayArgumentsNode {
1061
+
1062
+ @ Specialization
1063
+ protected boolean hasOtherlanguages () {
1064
+ return getContext ().hasOtherPublicLanguages ();
1065
+ }
1066
+
1067
+ }
1068
+
1059
1069
@ CoreMethod (names = "eval" , onSingleton = true , required = 2 )
1060
1070
@ ImportStatic ({ StringCachingGuards .class , StringOperations .class })
1061
1071
@ ReportPolymorphism
You can’t perform that action at this time.
0 commit comments