Skip to content

Commit

Permalink
Promote tests
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom committed Sep 14, 2024
1 parent 53286e2 commit c50c288
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 16 deletions.
25 changes: 15 additions & 10 deletions test/normalization/cram/for-statements.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
src["2"] = 3;
let dest;
dest = [];
for (var p in src) {
for (var v1 in src) {
p = v1;
x = src[p];
y = dest[p];
}
Expand All @@ -20,8 +21,9 @@

$ ast_gen input-code-3.js -o out; cat out/code/input-code-3.js; echo; rm -fr out;
let extend;
extend = function (dest, src) {
for (var p in src) {
extend = function (src, dest) {
for (var v1 in src) {
p = v1;
x = src[p];
y = dest[p];
}
Expand All @@ -33,14 +35,17 @@
iterable["0"] = 10;
iterable["1"] = 20;
iterable["2"] = 30;
for (let value of iterable) {
let v1;
v1 = console.log(value);
for (let v1 of iterable) {
value = v1;
let v2;
v2 = console.log(value);
}

$ ast_gen input-code-5.js -o out; cat out/code/input-code-5.js; echo; rm -fr out;
ast_gen: internal error, uncaught exception:
Failure("hd")

cat: out/code/input-code-5.js: No such file or directory
for (let v1 of iterable) {
key = v1[0];
value = v1[1];
let v2;
v2 = console.log(value);
}

2 changes: 1 addition & 1 deletion test/normalization/cram/function-declarations.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

$ ast_gen input-code-2.js -o out; cat out/code/input-code-2.js; echo; rm -fr out;
let f;
f = function (x, y, z) {
f = function (z, y, x) {
let v1;
v1 = x;
x = x + 1;
Expand Down
15 changes: 14 additions & 1 deletion test/normalization/cram/spread-elements.t/run.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
$ ast_gen input-code-1.js -o out; cat out/code/input-code-1.js; echo; rm -fr out;
ast_gen: internal error, uncaught exception:
Failure("[ERROR] Cannot process spread array element")

Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Stdlib__List.mapi in file "list.ml", line 93, characters 15-21
Called from Stdlib__List.mapi in file "list.ml" (inlined), line 100, characters 15-25
Called from Ast__Normalize.normalize_expression in file "lib/ast/normalize.ml", line 512, characters 22-66
Called from Ast__Normalize.normalize_assignment in file "lib/ast/normalize.ml", line 625, characters 30-50
Called from Ast__Normalize.normalize_expression in file "lib/ast/normalize.ml", line 497, characters 26-103
Called from Ast__Normalize.normalize_statement in file "lib/ast/normalize.ml", line 284, characters 21-47
Called from Stdlib__List.map in file "list.ml", line 87, characters 15-19
Called from Ast__Normalize.program in file "lib/ast/normalize.ml", line 49, characters 26-83
Called from Dune__exe__Main.main.(fun) in file "bin/main.ml", line 44, characters 25-60
Called from Stdlib__List.iter in file "list.ml", line 112, characters 12-15
Called from Dune__exe__Main.main in file "bin/main.ml", line 35, characters 2-1023
Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 24, characters 19-24
Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 35, characters 37-44
cat: out/code/input-code-1.js: No such file or directory

13 changes: 12 additions & 1 deletion test/normalization/cram/template-expressions.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,18 @@
$ ast_gen input-code-5.js -o out; cat out/code/input-code-5.js; echo; rm -fr out;
ast_gen: internal error, uncaught exception:
Failure("[ERROR] Unknown expression type to normalize (object on (9, 15) to (9, 60))")

Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Ast__Normalize.normalize_assignment in file "lib/ast/normalize.ml", line 625, characters 30-50
Called from Stdlib__List.map in file "list.ml", line 83, characters 15-19
Called from Ast__Normalize.normalize_statement in file "lib/ast/normalize.ml", line 202, characters 41-458
Called from Stdlib__List.map in file "list.ml", line 83, characters 15-19
Called from Stdlib__List.map in file "list.ml", line 88, characters 14-21
Called from Ast__Normalize.program in file "lib/ast/normalize.ml", line 49, characters 26-83
Called from Dune__exe__Main.main.(fun) in file "bin/main.ml", line 44, characters 25-60
Called from Stdlib__List.iter in file "list.ml", line 112, characters 12-15
Called from Dune__exe__Main.main in file "bin/main.ml", line 35, characters 2-1023
Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 24, characters 19-24
Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 35, characters 37-44
cat: out/code/input-code-5.js: No such file or directory

x
8 changes: 5 additions & 3 deletions test/normalization/cram/yield-expressions.t/run.t
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
$ ast_gen input-code-1.js -o out; cat out/code/input-code-1.js; echo; rm -fr out;
let foo;
foo = function (index) {
yield index;
let v1;
v1 = yield index;
}

$ ast_gen input-code-2.js -o out; cat out/code/input-code-2.js; echo; rm -fr out;
let foo;
foo = function (index) {
let v1;
v1 = index;
let v2;
v2 = index;
index = index + 1;
yield v1;
v1 = yield v2;
}

0 comments on commit c50c288

Please sign in to comment.