From 3fc1ef6dba18de5146e38970a733ebcb74e647e2 Mon Sep 17 00:00:00 2001 From: kzc Date: Wed, 13 Dec 2017 19:11:25 -0500 Subject: [PATCH] more test improvements --- test/compress/dead-code.js | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js index 47dea154..2d2f9d92 100644 --- a/test/compress/dead-code.js +++ b/test/compress/dead-code.js @@ -516,15 +516,17 @@ return_assignment: { return counter; }; [ f1, f2, f3, f4, f5, f6 ].forEach(function(f, i) { + e = null; try { i += 1; console.log("result " + f(10 * i, 100 * i, 1000 * i)); } catch (x) { console.log("caught " + x); } + if (null !== e) console.log("e: " + e); }); } - var x; + var x, e; test(1); test(-1); } @@ -566,15 +568,17 @@ return_assignment: { return counter; }; [ f1, f2, f3, f4, f5, f6 ].forEach(function(f, i) { + e = null; try { i += 1; console.log("result " + f(10 * i, 100 * i, 1000 * i)); } catch (x) { console.log("caught " + x); } + if (null !== e) console.log("e: " + e); }); } - var x; + var x, e; test(1); test(-1); } @@ -582,6 +586,7 @@ return_assignment: { "y", "result 31", "result 2", + "e: 2", "result 3", "result 4", "result 5", @@ -665,15 +670,17 @@ throw_assignment: { if (inc < 0) throw 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 { - f(); + f(10 * (1 + i)); } catch (x) { console.log("caught " + x); } + if (null !== a) console.log("a: " + a); }); } - var x; + var x, a; test(1); test(-1); } @@ -738,27 +745,32 @@ throw_assignment: { if (inc < 0) throw 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 { - f(); + f(10 * (1 + i)); } catch (x) { console.log("caught " + x); } + if (null !== a) console.log("a: " + a); }); } - var x; + var x, a; test(1); test(-1); } expect_stdout: [ "caught 1", + "a: 1", "caught 2", "caught 3", "4", + "a: 4", "5", "6", "7", "caught 7", + "a: 7", "8", "caught 8", "9", @@ -766,14 +778,14 @@ throw_assignment: { "caught -1", "caught -2", "caught -3", - "7", + "null", + "50", "undefined", - "undefined", - "7", + "null", "caught -7", - "undefined", + "80", "caught -8", "undefined", "caught -9", - ]; + ] }