From c230b7f307ecc33974b79998638496cd27039bb3 Mon Sep 17 00:00:00 2001 From: jugglinmike Date: Mon, 18 Apr 2016 13:36:43 -0400 Subject: [PATCH] Add tests for RegExp literal early errors (#566) --- .../literals/regexp/early-err-bad-flag.js | 15 +++++++++++++++ .../literals/regexp/early-err-dup-flag.js | 15 +++++++++++++++ .../language/literals/regexp/early-err-pattern.js | 15 +++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 test/language/literals/regexp/early-err-bad-flag.js create mode 100644 test/language/literals/regexp/early-err-dup-flag.js create mode 100644 test/language/literals/regexp/early-err-pattern.js diff --git a/test/language/literals/regexp/early-err-bad-flag.js b/test/language/literals/regexp/early-err-bad-flag.js new file mode 100644 index 0000000000..72842c41a2 --- /dev/null +++ b/test/language/literals/regexp/early-err-bad-flag.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Literal may not contain an unrecognized flag (early error) +esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors +info: > + It is a Syntax Error if FlagText of RegularExpressionLiteral contains any + code points other than "g", "i", "m", "u", or "y", or if it contains the + same code point more than once. +negative: SyntaxError +---*/ + +throw new Test262Error(); + +/./G; diff --git a/test/language/literals/regexp/early-err-dup-flag.js b/test/language/literals/regexp/early-err-dup-flag.js new file mode 100644 index 0000000000..266fff009d --- /dev/null +++ b/test/language/literals/regexp/early-err-dup-flag.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Literal may not contain duplicate flags (early error) +esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors +info: > + It is a Syntax Error if FlagText of RegularExpressionLiteral contains any + code points other than "g", "i", "m", "u", or "y", or if it contains the + same code point more than once. +negative: SyntaxError +---*/ + +throw new Test262Error(); + +/./gig; diff --git a/test/language/literals/regexp/early-err-pattern.js b/test/language/literals/regexp/early-err-pattern.js new file mode 100644 index 0000000000..bdea79346a --- /dev/null +++ b/test/language/literals/regexp/early-err-pattern.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Literal may not describe an invalid pattern (early error) +esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors +info: > + It is a Syntax Error if BodyText of RegularExpressionLiteral cannot be + recognized using the goal symbol Pattern of the ECMAScript RegExp grammar + specified in 21.2.1. +negative: SyntaxError +---*/ + +throw new Test262Error(); + +/?/;