| Index: test/mjsunit/harmony/completion.js
|
| diff --git a/test/mjsunit/harmony/completion.js b/test/mjsunit/harmony/completion.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c7d179148f404ae27d7d1daa4c4fb845f60a50eb
|
| --- /dev/null
|
| +++ b/test/mjsunit/harmony/completion.js
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2015 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Flags: --harmony-completion
|
| +
|
| +
|
| +function assertUndef(x) {
|
| + assertEquals(undefined, x);
|
| +}
|
| +
|
| +
|
| +// IfStatement [13.6.7]
|
| +assertUndef(eval('42; if (true) ; else 0;')); // ES5: 42
|
| +assertUndef(eval('42; if (true) ;')); // ES5: 42
|
| +assertUndef(eval('42; if (false) 0;')); // ES5: 42
|
| +
|
| +
|
| +// IterationStatement [13.7] (a few of them)
|
| +assertUndef(eval('42; do ; while (false);')); // ES5: 42
|
| +assertUndef(eval('42; var x = 1; do ; while (x--);')); // ES5: 42
|
| +assertUndef(eval('42; while (false) 0;')); // ES5: 42
|
| +assertUndef(eval('42; while (true) break;')); // ES5: 42
|
| +assertUndef(eval('42; var x = 1; while (x--) ;')); // ES5: 42
|
| +assertUndef(eval('42; for (; false; ) 0;')); // ES5: 42
|
| +assertUndef(eval('42; for (var x = 1; x; x--) ;')); // ES5: 42
|
| +
|
| +
|
| +// WithStatement [13.11.7]
|
| +assertUndef(eval('42; with ({}) ;')); // ES5: 42
|
| +
|
| +
|
| +// SwitchStatement [13.12.11]
|
| +assertUndef(eval('42; switch (0) {};')); // ES5: 42
|
| +assertUndef(eval('42; switch (0) { case 1: 1; };')); // ES5: 42
|
| +assertUndef(eval('42; switch (0) { case 0: ; };')); // ES5: 42
|
| +assertUndef(eval('42; switch (0) { default: ; };')); // ES5: 42
|
| +assertUndef(eval('42; switch (0) { case 0: break; }')); // ES5: 42
|
| +assertEquals(0, eval('42; switch (0) { case 0: 0; }'));
|
| +assertEquals(0, eval('42; switch (0) { case 0: 0; break; }'));
|
| +
|
| +
|
| +// TryStatement [13.15.8]
|
| +assertUndef(eval('42; try { } catch(e) { };')); // ES5: 42
|
| +assertUndef(eval('42; try { } catch(e) { 0; };')); // ES5: 42
|
| +assertUndef(eval('42; try { throw Error } catch(e) { };')); // ES5: 42
|
| +assertUndef(eval('42; try { throw Error } catch(e) { } finally { };')); // ES5: 42
|
| +
|
| +
|
| +// Some combinations
|
| +assertUndef(eval('42; switch (0) { case 0: if (true) break; }')); // ES5: 42
|
| +assertUndef(eval('42; switch (0) { case 0: 0; if (true) ; }')); // ES5: 0
|
| +assertUndef(eval('42; switch (0) { case 0: 0; try { break } catch(e) { }; }')); // ES5: 0
|
| +
|
| +// The following is not what ES6 says, but see ES bug 4540.
|
| +assertUndef(eval('42; switch (0) { case 0: 0; if (true) break; }')); // ES5: 0
|
|
|