From d36a1777b4a713627c9fb9bc571c28b7fd2a72c5 Mon Sep 17 00:00:00 2001 From: Zirak Date: Mon, 16 Oct 2017 20:04:51 +0300 Subject: [PATCH] Test for proper handling of incomplete hex escapes (#1274) See relevant firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1408452 --- .../RegExp/incomplete_hex_unicode_escape.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/built-ins/RegExp/incomplete_hex_unicode_escape.js diff --git a/test/built-ins/RegExp/incomplete_hex_unicode_escape.js b/test/built-ins/RegExp/incomplete_hex_unicode_escape.js new file mode 100644 index 00000000000..966619486ef --- /dev/null +++ b/test/built-ins/RegExp/incomplete_hex_unicode_escape.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 Zirak. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: An incomplete HexEscape or UnicodeEscape should be treated as an Identity Escape +info: > + An incomplete HexEscape (e.g. /\x/) or UnicodeEscape (/\u/) should fall + through to IdentityEscape +esid: prod-AtomEscape +---*/ + +// Hex escape +assert(/\x/.test("x"), "/\\x/"); +assert(/\xa/.test("xa"), "/\\xa/"); + +// Unicode escape +assert(/\u/.test("u"), "/\\u/"); +assert(/\ua/.test("ua"), "/\\ua/");