52
52
import java .util .Arrays ;
53
53
import java .util .List ;
54
54
55
- import com .oracle .graal .python .runtime .interop .InteropArray ;
56
- import com .oracle .graal .python .test .PythonTests ;
57
- import com .oracle .truffle .api .interop .ArityException ;
58
- import com .oracle .truffle .api .interop .InteropLibrary ;
59
- import com .oracle .truffle .api .interop .TruffleObject ;
60
- import com .oracle .truffle .api .interop .UnknownIdentifierException ;
61
- import com .oracle .truffle .api .library .ExportLibrary ;
62
- import com .oracle .truffle .api .library .ExportMessage ;
63
-
64
55
import org .graalvm .polyglot .Context ;
65
56
import org .graalvm .polyglot .Context .Builder ;
66
57
import org .graalvm .polyglot .Engine ;
76
67
import org .junit .runners .Parameterized .Parameter ;
77
68
import org .junit .runners .Parameterized .Parameters ;
78
69
70
+ import com .oracle .graal .python .runtime .interop .InteropArray ;
71
+ import com .oracle .graal .python .test .PythonTests ;
72
+ import com .oracle .truffle .api .interop .ArityException ;
73
+ import com .oracle .truffle .api .interop .InteropLibrary ;
74
+ import com .oracle .truffle .api .interop .TruffleObject ;
75
+ import com .oracle .truffle .api .interop .UnknownIdentifierException ;
76
+ import com .oracle .truffle .api .library .ExportLibrary ;
77
+ import com .oracle .truffle .api .library .ExportMessage ;
78
+
79
79
@ RunWith (Enclosed .class )
80
80
public class JavaInteropTest {
81
81
public static class GeneralInterop extends PythonTests {
@@ -89,6 +89,7 @@ public void setUpTest() {
89
89
out = new ByteArrayOutputStream ();
90
90
err = new ByteArrayOutputStream ();
91
91
Builder builder = Context .newBuilder ();
92
+ builder .allowExperimentalOptions (true );
92
93
builder .allowAllAccess (true );
93
94
builder .out (out );
94
95
builder .err (err );
@@ -113,7 +114,7 @@ public void evalFailsOnError() {
113
114
114
115
@ Test
115
116
public void evalNonInteractiveThrowsSyntaxError () throws IOException {
116
- try (Context c = Context .newBuilder ().allowAllAccess (true ).option ("python.TerminalIsInteractive" , "false" ).build ()) {
117
+ try (Context c = Context .newBuilder ().allowExperimentalOptions ( true ). allowAllAccess (true ).option ("python.TerminalIsInteractive" , "false" ).build ()) {
117
118
c .eval (Source .newBuilder ("python" , INCOMPLETE_SOURCE , "eval" ).interactive (false ).build ());
118
119
} catch (PolyglotException t ) {
119
120
assertTrue (t .isSyntaxError ());
@@ -125,7 +126,7 @@ public void evalNonInteractiveThrowsSyntaxError() throws IOException {
125
126
126
127
@ Test
127
128
public void evalNonInteractiveInInteractiveTerminalThrowsSyntaxError () throws IOException {
128
- try (Context c = Context .newBuilder ().allowAllAccess (true ).option ("python.TerminalIsInteractive" , "true" ).build ()) {
129
+ try (Context c = Context .newBuilder ().allowExperimentalOptions ( true ). allowAllAccess (true ).option ("python.TerminalIsInteractive" , "true" ).build ()) {
129
130
c .eval (Source .newBuilder ("python" , INCOMPLETE_SOURCE , "eval" ).interactive (false ).build ());
130
131
} catch (PolyglotException t ) {
131
132
assertTrue (t .isSyntaxError ());
@@ -137,7 +138,7 @@ public void evalNonInteractiveInInteractiveTerminalThrowsSyntaxError() throws IO
137
138
138
139
@ Test
139
140
public void evalInteractiveInNonInteractiveTerminalThrowsSyntaxError () throws IOException {
140
- try (Context c = Context .newBuilder ().allowAllAccess (true ).option ("python.TerminalIsInteractive" , "false" ).build ()) {
141
+ try (Context c = Context .newBuilder ().allowExperimentalOptions ( true ). allowAllAccess (true ).option ("python.TerminalIsInteractive" , "false" ).build ()) {
141
142
c .eval (Source .newBuilder ("python" , INCOMPLETE_SOURCE , "eval" ).interactive (true ).build ());
142
143
} catch (PolyglotException t ) {
143
144
assertTrue (t .isSyntaxError ());
@@ -149,7 +150,7 @@ public void evalInteractiveInNonInteractiveTerminalThrowsSyntaxError() throws IO
149
150
150
151
@ Test
151
152
public void evalInteractiveInInteractiveTerminalThrowsSyntaxError () throws IOException {
152
- try (Context c = Context .newBuilder ().allowAllAccess (true ).option ("python.TerminalIsInteractive" , "true" ).build ()) {
153
+ try (Context c = Context .newBuilder ().allowExperimentalOptions ( true ). allowAllAccess (true ).option ("python.TerminalIsInteractive" , "true" ).build ()) {
153
154
c .eval (Source .newBuilder ("python" , INCOMPLETE_SOURCE , "eval" ).interactive (true ).build ());
154
155
} catch (PolyglotException t ) {
155
156
assertTrue (t .isSyntaxError ());
@@ -513,7 +514,7 @@ static class OptionsChecker {
513
514
private Builder builder ;
514
515
515
516
OptionsChecker (String option , String code , String ... values ) {
516
- this .builder = Context .newBuilder ("python" ).engine (engine ).allowAllAccess (true );
517
+ this .builder = Context .newBuilder ("python" ).engine (engine ).allowExperimentalOptions ( true ). allowAllAccess (true );
517
518
this .option = "python." + option ;
518
519
this .source = Source .create ("python" , code );
519
520
this .values = values ;
0 commit comments