1616
1717public class DummyTest {
1818
19+ byte [] packedOptions = ParsingOptions .serialize (
20+ new byte [] {},
21+ 1 ,
22+ new byte [] {},
23+ false ,
24+ EnumSet .noneOf (ParsingOptions .CommandLine .class ),
25+ ParsingOptions .SyntaxVersion .LATEST ,
26+ false ,
27+ false ,
28+ false ,
29+ new byte [][][] {}
30+ );
31+
1932 @ Test
2033 public void test1 () {
2134 WasiOptions wasiOpts = WasiOptions .builder ().build ();
@@ -38,19 +51,6 @@ public void test1() {
3851 var sourcePointer = calloc .apply (1 , source .length ());
3952 memory .writeString ((int ) sourcePointer [0 ], source );
4053
41- var packedOptions = ParsingOptions .serialize (
42- new byte [] {},
43- 1 ,
44- new byte [] {},
45- false ,
46- EnumSet .noneOf (ParsingOptions .CommandLine .class ),
47- ParsingOptions .SyntaxVersion .LATEST ,
48- false ,
49- false ,
50- false ,
51- new byte [][][] {}
52- );
53-
5454 var optionsPointer = calloc .apply (1 , packedOptions .length );
5555 memory .write ((int ) optionsPointer [0 ], packedOptions );
5656
@@ -74,6 +74,22 @@ public void test1() {
7474 assertTrue (pr .value .childNodes ()[0 ].toString ().contains ("IntegerNode" ));
7575 }
7676
77+ @ Test
78+ public void test1Aot () {
79+ // The Ruby source code to be processed
80+ var source = "1 + 1" ;
81+
82+ ParseResult pr = null ;
83+ try (Prism prism = new Prism ()) {
84+ pr = prism .serializeParse (packedOptions , source );
85+ }
86+
87+ assertEquals (1 , pr .value .childNodes ().length );
88+ System .out .println ("Nodes:" );
89+ System .out .println (pr .value .childNodes ()[0 ]);
90+ assertTrue (pr .value .childNodes ()[0 ].toString ().contains ("IntegerNode" ));
91+ }
92+
7793 @ Test
7894 public void test2 () {
7995 WasiOptions wasiOpts = WasiOptions .builder ().build ();
@@ -96,19 +112,6 @@ public void test2() {
96112 var sourcePointer = calloc .apply (1 , source .length ());
97113 memory .writeString ((int ) sourcePointer [0 ], source );
98114
99- var packedOptions = ParsingOptions .serialize (
100- new byte [] {},
101- 1 ,
102- new byte [] {},
103- false ,
104- EnumSet .noneOf (ParsingOptions .CommandLine .class ),
105- ParsingOptions .SyntaxVersion .LATEST ,
106- false ,
107- false ,
108- false ,
109- new byte [][][] {}
110- );
111-
112115 var optionsPointer = calloc .apply (1 , packedOptions .length );
113116 memory .write ((int ) optionsPointer [0 ], packedOptions );
114117
@@ -133,4 +136,19 @@ public void test2() {
133136 assertTrue (pr .value .childNodes ()[0 ].toString ().contains ("CallNode" ));
134137 }
135138
139+ @ Test
140+ public void test2Aot () {
141+ // The Ruby source code to be processed
142+ var source = "puts \" h\n e\n l\n l\n o\n \" " ;
143+
144+ ParseResult pr = null ;
145+ try (Prism prism = new Prism ()) {
146+ pr = prism .serializeParse (packedOptions , source );
147+ }
148+
149+ assertEquals (1 , pr .value .childNodes ().length );
150+ System .out .println ("Nodes:" );
151+ System .out .println (pr .value .childNodes ()[0 ]);
152+ assertTrue (pr .value .childNodes ()[0 ].toString ().contains ("CallNode" ));
153+ }
136154}
0 commit comments