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 5035b0b commit 9963583
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 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
7 changes: 3 additions & 4 deletions test/normalization/cram/spread-elements.t/run.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$ 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:
$ ast_gen input-code-1.js -o out 2>&1 | grep "Failure" && cat out/code/input-code-1.js && echo && rm -fr out
Failure("[ERROR] Cannot process spread array element")

cat: out/code/input-code-1.js: No such file or directory

[1]

11 changes: 7 additions & 4 deletions test/normalization/cram/template-expressions.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
const x;
x = `string`;


$ ast_gen input-code-2.js -o out; cat out/code/input-code-2.js; echo; rm -fr out;
const x;
x = `string` + `concat`;


$ ast_gen input-code-3.js -o out; cat out/code/input-code-3.js; echo; rm -fr out;
const x;
x = `template ${expr}`;


$ ast_gen input-code-4.js -o out; cat out/code/input-code-4.js; echo; rm -fr out;
const x;
x = `string`;
Expand All @@ -18,10 +21,10 @@
v1 = x + 2;
temp = `head template ${v1} end tail`;

$ 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:

$ ast_gen input-code-5.js -o out 2>&1 | grep "Failure" && cat out/code/input-code-5.js && echo && rm -fr out
Failure("[ERROR] Unknown expression type to normalize (object on (9, 15) to (9, 60))")

cat: out/code/input-code-5.js: No such file or directory

[1]

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 9963583

Please sign in to comment.