more test improvements

This commit is contained in:
kzc 2017-12-13 19:11:25 -05:00
parent c70fe074bf
commit 3fc1ef6dba

View File

@ -516,15 +516,17 @@ return_assignment: {
return counter; return counter;
}; };
[ f1, f2, f3, f4, f5, f6 ].forEach(function(f, i) { [ f1, f2, f3, f4, f5, f6 ].forEach(function(f, i) {
e = null;
try { try {
i += 1; i += 1;
console.log("result " + f(10 * i, 100 * i, 1000 * i)); console.log("result " + f(10 * i, 100 * i, 1000 * i));
} catch (x) { } catch (x) {
console.log("caught " + x); console.log("caught " + x);
} }
if (null !== e) console.log("e: " + e);
}); });
} }
var x; var x, e;
test(1); test(1);
test(-1); test(-1);
} }
@ -566,15 +568,17 @@ return_assignment: {
return counter; return counter;
}; };
[ f1, f2, f3, f4, f5, f6 ].forEach(function(f, i) { [ f1, f2, f3, f4, f5, f6 ].forEach(function(f, i) {
e = null;
try { try {
i += 1; i += 1;
console.log("result " + f(10 * i, 100 * i, 1000 * i)); console.log("result " + f(10 * i, 100 * i, 1000 * i));
} catch (x) { } catch (x) {
console.log("caught " + x); console.log("caught " + x);
} }
if (null !== e) console.log("e: " + e);
}); });
} }
var x; var x, e;
test(1); test(1);
test(-1); test(-1);
} }
@ -582,6 +586,7 @@ return_assignment: {
"y", "y",
"result 31", "result 31",
"result 2", "result 2",
"e: 2",
"result 3", "result 3",
"result 4", "result 4",
"result 5", "result 5",
@ -665,15 +670,17 @@ throw_assignment: {
if (inc < 0) throw counter; if (inc < 0) throw counter;
return counter; return counter;
}; };
[ f1, f2, f3, f4, f5, f6, f7, f8, f9 ].forEach(function(f) { [ f1, f2, f3, f4, f5, f6, f7, f8, f9 ].forEach(function(f, i) {
a = null;
try { try {
f(); f(10 * (1 + i));
} catch (x) { } catch (x) {
console.log("caught " + x); console.log("caught " + x);
} }
if (null !== a) console.log("a: " + a);
}); });
} }
var x; var x, a;
test(1); test(1);
test(-1); test(-1);
} }
@ -738,27 +745,32 @@ throw_assignment: {
if (inc < 0) throw counter; if (inc < 0) throw counter;
return counter; return counter;
}; };
[ f1, f2, f3, f4, f5, f6, f7, f8, f9 ].forEach(function(f) { [ f1, f2, f3, f4, f5, f6, f7, f8, f9 ].forEach(function(f, i) {
a = null;
try { try {
f(); f(10 * (1 + i));
} catch (x) { } catch (x) {
console.log("caught " + x); console.log("caught " + x);
} }
if (null !== a) console.log("a: " + a);
}); });
} }
var x; var x, a;
test(1); test(1);
test(-1); test(-1);
} }
expect_stdout: [ expect_stdout: [
"caught 1", "caught 1",
"a: 1",
"caught 2", "caught 2",
"caught 3", "caught 3",
"4", "4",
"a: 4",
"5", "5",
"6", "6",
"7", "7",
"caught 7", "caught 7",
"a: 7",
"8", "8",
"caught 8", "caught 8",
"9", "9",
@ -766,14 +778,14 @@ throw_assignment: {
"caught -1", "caught -1",
"caught -2", "caught -2",
"caught -3", "caught -3",
"7", "null",
"50",
"undefined", "undefined",
"undefined", "null",
"7",
"caught -7", "caught -7",
"undefined", "80",
"caught -8", "caught -8",
"undefined", "undefined",
"caught -9", "caught -9",
]; ]
} }