blob: 6a995dde6053c262b5fe6c98a063dedf24f2e150 [file] [log] [blame]
Tests that regular expressions do not have extensions that diverge from the JavaScript specification. Because WebKit originally used a copy of PCRE, various non-JavaScript regular expression features were historically present. Also tests various related edge cases.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS /\x{41}/.exec("yA1") is null
PASS /[\x{41}]/.exec("yA1").toString() is "1"
PASS /\x1g/.exec("x1g").toString() is "x1g"
PASS /[\x1g]/.exec("x").toString() is "x"
PASS /[\x1g]/.exec("1").toString() is "1"
PASS /\2147483648/.exec(String.fromCharCode(140) + "7483648").toString() is String.fromCharCode(140) + "7483648"
PASS /\4294967296/.exec("\"94967296").toString() is "\"94967296"
PASS /\8589934592/.exec("\\8589934592").toString() is "\\8589934592"
PASS "\nAbc\n".replace(/(\n)[^\n]+$/, "$1") is "\nAbc\n"
PASS /x$/.exec("x\n") is null
PASS /x++/ threw exception SyntaxError: Invalid regular expression: nothing to repeat.
PASS /[]]/.exec("]") is null
Octal escape sequences are in Annex B of the standard.
PASS /\060/.exec("y01").toString() is "0"
PASS /[\060]/.exec("y01").toString() is "0"
PASS /\606/.exec("y06").toString() is "06"
PASS /[\606]/.exec("y06").toString() is "0"
PASS /[\606]/.exec("y6").toString() is "6"
PASS /\101/.exec("yA1").toString() is "A"
PASS /[\101]/.exec("yA1").toString() is "A"
PASS /\1011/.exec("yA1").toString() is "A1"
PASS /[\1011]/.exec("yA1").toString() is "A"
PASS /[\1011]/.exec("y1").toString() is "1"
PASS /\10q/.exec("y" + String.fromCharCode(8) + "q").toString() is String.fromCharCode(8) + "q"
PASS /[\10q]/.exec("y" + String.fromCharCode(8) + "q").toString() is String.fromCharCode(8)
PASS /\1q/.exec("y" + String.fromCharCode(1) + "q").toString() is String.fromCharCode(1) + "q"
PASS /[\1q]/.exec("y" + String.fromCharCode(1) + "q").toString() is String.fromCharCode(1)
PASS /[\1q]/.exec("yq").toString() is "q"
PASS /\8q/.exec("\\8q").toString() is "\\8q"
PASS /[\8q]/.exec("y8q").toString() is "8"
PASS /[\8q]/.exec("yq").toString() is "q"
PASS /(x)\1q/.exec("xxq").toString() is "xxq,x"
PASS /(x)[\1q]/.exec("xxq").toString() is "xq,x"
PASS /(x)[\1q]/.exec("xx" + String.fromCharCode(1)).toString() is "x" + String.fromCharCode(1) + ",x"
PASS successfullyParsed is true
TEST COMPLETE