15
15
import org .junit .Test ;
16
16
import org .truffleruby .fixtures .FluidForce ;
17
17
import org .truffleruby .shared .TruffleRuby ;
18
- import org .truffleruby .shared .options .OptionsCatalog ;
19
18
20
19
import java .util .List ;
21
20
import java .util .function .BiFunction ;
@@ -30,7 +29,6 @@ public class PolyglotInteropTest {
30
29
@ Test
31
30
public void testCreateContext () {
32
31
try (Context polyglot = Context .newBuilder ()
33
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
34
32
.allowAllAccess (true )
35
33
.build ()) {
36
34
assertEquals (14 , polyglot .eval (TruffleRuby .LANGUAGE_ID , "14" ).asInt ());
@@ -41,7 +39,6 @@ public void testCreateContext() {
41
39
public void testCreateContextNoAccess () {
42
40
try (Context polyglot = Context .newBuilder ()
43
41
.allowExperimentalOptions (true )
44
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
45
42
.option (OptionsCatalog .NATIVE_PLATFORM .getName (), Boolean .FALSE .toString ())
46
43
.build ()) {
47
44
assertEquals (14 , polyglot .eval (TruffleRuby .LANGUAGE_ID , "14" ).asInt ());
@@ -51,7 +48,6 @@ public void testCreateContextNoAccess() {
51
48
@ Test
52
49
public void testParameters () {
53
50
try (Context polyglot = Context .newBuilder ()
54
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
55
51
.allowAllAccess (true )
56
52
.build ()) {
57
53
assertEquals (16 , polyglot .eval ("ruby" , "lambda { |a, b| a + b }" ).execute (14 , 2 ).asInt ());
@@ -61,7 +57,6 @@ public void testParameters() {
61
57
@ Test
62
58
public void testCallingMethods () {
63
59
try (Context polyglot = Context .newBuilder ()
64
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
65
60
.allowAllAccess (true )
66
61
.build ()) {
67
62
assertEquals (0.909 , polyglot .eval ("ruby" , "Math" ).getMember ("sin" ).execute (2 ).asDouble (), 0.01 );
@@ -71,7 +66,6 @@ public void testCallingMethods() {
71
66
@ Test
72
67
public void testPassingBlocks () {
73
68
try (Context polyglot = Context .newBuilder ()
74
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
75
69
.allowAllAccess (true )
76
70
.build ()) {
77
71
final int [] counter = new int []{0 };
@@ -86,7 +80,6 @@ public void testPassingBlocks() {
86
80
@ Test
87
81
public void testCreatingObjects () {
88
82
try (Context polyglot = Context .newBuilder ()
89
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
90
83
.allowAllAccess (true )
91
84
.build ()) {
92
85
assertEquals (2021 , polyglot .eval ("ruby" , "Time" ).newInstance (2021 , 3 , 18 ).getMember ("year" ).execute ().asInt ());
@@ -96,7 +89,6 @@ public void testCreatingObjects() {
96
89
@ Test
97
90
public void testAccessingArrays () {
98
91
try (Context polyglot = Context .newBuilder ()
99
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
100
92
.allowAllAccess (true )
101
93
.build ()) {
102
94
assertEquals (4 , polyglot .eval ("ruby" , "[3, 4, 5]" ).getArrayElement (1 ).asInt ());
@@ -107,7 +99,6 @@ public void testAccessingArrays() {
107
99
@ Test
108
100
public void testAccessingHashes () {
109
101
try (Context polyglot = Context .newBuilder ()
110
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
111
102
.allowAllAccess (true )
112
103
.build ()) {
113
104
final Value access = polyglot .eval ("ruby" , "->(hash, key) { hash[key] }" );
@@ -119,7 +110,6 @@ public void testAccessingHashes() {
119
110
@ Test
120
111
public void testImplementInterface () {
121
112
try (Context polyglot = Context .newBuilder ()
122
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
123
113
.allowAllAccess (true )
124
114
.build ()) {
125
115
final FluidForce fluidForce = polyglot .eval ("ruby" , FluidForce .RUBY_SOURCE ).as (FluidForce .class );
@@ -131,7 +121,6 @@ public void testImplementInterface() {
131
121
@ Test
132
122
public void testImplementLambda () {
133
123
try (Context polyglot = Context .newBuilder ()
134
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
135
124
.allowAllAccess (true )
136
125
.build ()) {
137
126
final BiFunction adder = polyglot .eval ("ruby" , "lambda { |a, b| a + b }" ).as (BiFunction .class );
@@ -142,7 +131,6 @@ public void testImplementLambda() {
142
131
@ Test
143
132
public void testParseOnceRunMany () {
144
133
try (Context polyglot = Context .newBuilder ()
145
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
146
134
.allowAllAccess (true )
147
135
.build ()) {
148
136
final Value parsedOnce = polyglot .eval ("ruby" , "lambda { 14 }" );
@@ -153,7 +141,6 @@ public void testParseOnceRunMany() {
153
141
@ Test
154
142
public void testLocalVariablesNotSharedBetweenNonInteractiveEval () {
155
143
try (Context polyglot = Context .newBuilder ()
156
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
157
144
.allowAllAccess (true )
158
145
.build ()) {
159
146
polyglot .eval ("ruby" , "a = 14" );
@@ -164,7 +151,6 @@ public void testLocalVariablesNotSharedBetweenNonInteractiveEval() {
164
151
@ Test
165
152
public void testLocalVariablesSharedBetweenInteractiveEval () {
166
153
try (Context polyglot = Context .newBuilder ()
167
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
168
154
.allowAllAccess (true )
169
155
.build ()) {
170
156
polyglot .eval (Source .newBuilder ("ruby" , "a = 14" , "test" ).interactive (true ).buildLiteral ());
@@ -177,7 +163,6 @@ public void testLocalVariablesSharedBetweenInteractiveEval() {
177
163
@ Test
178
164
public void testLocalVariablesSharedBetweenInteractiveEvalChangesParsing () {
179
165
try (Context polyglot = Context .newBuilder ()
180
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
181
166
.allowAllAccess (true )
182
167
.build ()) {
183
168
polyglot .eval (Source .newBuilder ("ruby" , "def foo; 12; end" , "test" ).interactive (true ).buildLiteral ());
@@ -190,7 +175,6 @@ public void testLocalVariablesSharedBetweenInteractiveEvalChangesParsing() {
190
175
@ Test
191
176
public void testLocalVariablesAreNotSharedBetweenInteractiveAndNonInteractive () {
192
177
try (Context polyglot = Context .newBuilder ()
193
- .option (OptionsCatalog .HOME .getName (), System .getProperty ("user.dir" ))
194
178
.allowAllAccess (true )
195
179
.build ()) {
196
180
polyglot .eval (Source .newBuilder ("ruby" , "a = 14" , "test" ).interactive (false ).buildLiteral ());
0 commit comments