diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/unicode_restricted_octal_escape.js')
-rw-r--r-- | js/src/tests/test262/built-ins/RegExp/unicode_restricted_octal_escape.js | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/unicode_restricted_octal_escape.js b/js/src/tests/test262/built-ins/RegExp/unicode_restricted_octal_escape.js new file mode 100644 index 0000000000..2940fd9011 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/unicode_restricted_octal_escape.js @@ -0,0 +1,150 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: B.1.4 is not applied for Unicode RegExp - Octal escape sequences +info: | + The compatibility extensions defined in B.1.4 Regular Expressions Patterns + are not applied for Unicode RegExp. + Tested extension: "CharacterEscape[U] :: [~U] LegacyOctalEscapeSequence" +es6id: 21.1.2 +---*/ + +// DecimalEscape without leading 0 in AtomEscape. +// +// AtomEscape[U] :: DecimalEscape +// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit] +assert.throws(SyntaxError, function() { + RegExp("\\1", "u"); +}, 'RegExp("\\1", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\2", "u"); +}, 'RegExp("\\2", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\3", "u"); +}, 'RegExp("\\3", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\4", "u"); +}, 'RegExp("\\4", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\5", "u"); +}, 'RegExp("\\5", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\6", "u"); +}, 'RegExp("\\6", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\7", "u"); +}, 'RegExp("\\7", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\8", "u"); +}, 'RegExp("\\8", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\9", "u"); +}, 'RegExp("\\9", "u"): '); + + +// DecimalEscape without leading 0 in ClassEscape. +// +// ClassEscape[U] :: DecimalEscape +// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit] +assert.throws(SyntaxError, function() { + RegExp("[\\1]", "u"); +}, 'RegExp("[\\1]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\2]", "u"); +}, 'RegExp("[\\2]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\3]", "u"); +}, 'RegExp("[\\3]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\4]", "u"); +}, 'RegExp("[\\4]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\5]", "u"); +}, 'RegExp("[\\5]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\6]", "u"); +}, 'RegExp("[\\6]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\7]", "u"); +}, 'RegExp("[\\7]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\8]", "u"); +}, 'RegExp("[\\8]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\9]", "u"); +}, 'RegExp("[\\9]", "u"): '); + + +// DecimalEscape with leading 0 in AtomEscape. +// +// Atom[U] :: DecimalEscape +// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit] +assert.throws(SyntaxError, function() { + RegExp("\\00", "u"); +}, 'RegExp("\\00", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\01", "u"); +}, 'RegExp("\\01", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\02", "u"); +}, 'RegExp("\\02", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\03", "u"); +}, 'RegExp("\\03", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\04", "u"); +}, 'RegExp("\\04", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\05", "u"); +}, 'RegExp("\\05", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\06", "u"); +}, 'RegExp("\\06", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\07", "u"); +}, 'RegExp("\\07", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\08", "u"); +}, 'RegExp("\\08", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("\\09", "u"); +}, 'RegExp("\\09", "u"): '); + + +// DecimalEscape with leading 0 in ClassEscape. +// +// ClassEscape[U] :: DecimalEscape +// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit] +assert.throws(SyntaxError, function() { + RegExp("[\\00]", "u"); +}, 'RegExp("[\\00]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\01]", "u"); +}, 'RegExp("[\\01]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\02]", "u"); +}, 'RegExp("[\\02]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\03]", "u"); +}, 'RegExp("[\\03]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\04]", "u"); +}, 'RegExp("[\\04]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\05]", "u"); +}, 'RegExp("[\\05]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\06]", "u"); +}, 'RegExp("[\\06]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\07]", "u"); +}, 'RegExp("[\\07]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\08]", "u"); +}, 'RegExp("[\\08]", "u"): '); +assert.throws(SyntaxError, function() { + RegExp("[\\09]", "u"); +}, 'RegExp("[\\09]", "u"): '); + +reportCompare(0, 0); |