From cc09757478b474858bc9f9c28ef8e13cf9d6d88d Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sat, 9 Feb 2019 18:24:22 -0500 Subject: [PATCH] Test forward slash in RegularExpressionClassChar --- test/built-ins/RegExp/regexp-class-chars.js | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/built-ins/RegExp/regexp-class-chars.js diff --git a/test/built-ins/RegExp/regexp-class-chars.js b/test/built-ins/RegExp/regexp-class-chars.js new file mode 100644 index 0000000000..fec9924a6d --- /dev/null +++ b/test/built-ins/RegExp/regexp-class-chars.js @@ -0,0 +1,29 @@ +// Copyright (C) 2019 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: RegularExpressionClassChars may include the forward slash character +info: | + 11.8.5Regular Expression Literals + + RegularExpressionClass :: + [ RegularExpressionClassChars ] + + RegularExpressionClassChars :: + [empty] + RegularExpressionClassChars RegularExpressionClassChar + + RegularExpressionClassChar :: + RegularExpressionNonTerminator but not one of ] or \ + RegularExpressionBackslashSequence + + RegularExpressionNonTerminator :: + SourceCharacterbut not LineTerminator +esid: sec-literals-regular-expression-literals +---*/ + +assert(/[/]/.test("/"), "Forward slash"); +assert.sameValue(/[/]/.test("x"), false, "Forward slash"); + +assert(/[//]/.test("/"), "Forward slash - repeated"); +assert.sameValue(/[//]/.test("x"), false, "Forward slash - repeated");