From 4f5a8674c264dcf904920b2e7947316d6a9be2e2 Mon Sep 17 00:00:00 2001 From: Mike Pennisi <mike@mikepennisi.com> Date: Wed, 9 Mar 2016 11:12:56 -0500 Subject: [PATCH] Add tests for `debugger` statement The runtime semantics of this statement are host-defined and therefore untestable, but the statement's affect on the formal grammar should be consistent across all implementations. --- test/language/statements/debugger/expression.js | 10 ++++++++++ test/language/statements/debugger/statement.js | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/language/statements/debugger/expression.js create mode 100644 test/language/statements/debugger/statement.js diff --git a/test/language/statements/debugger/expression.js b/test/language/statements/debugger/expression.js new file mode 100644 index 0000000000..c335e4e2b5 --- /dev/null +++ b/test/language/statements/debugger/expression.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The `debugger` token may not occupy an expression position +esid: sec-debugger-statement +es6id: 13.16 +negative: SyntaxError +---*/ + +(debugger); diff --git a/test/language/statements/debugger/statement.js b/test/language/statements/debugger/statement.js new file mode 100644 index 0000000000..2fbe43dd57 --- /dev/null +++ b/test/language/statements/debugger/statement.js @@ -0,0 +1,12 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The `debugger` token may occupy a statement position +esid: sec-debugger-statement +es6id: 13.16 +---*/ + +// Expressing within a `while` statement ensures that the `debugger keyword is +// not erroneously interpreted as a declaration. It also avoids statement +// evaluation, which is host-defined an may interrupt test execution. +while (false) debugger; -- GitLab