blob: 01be292466c9187f3b7f33b34a0710874065280e [file] [log] [blame]
This page tests toString conversion of RegExp objects, particularly wrt to '/' characters and RegExp.prototype.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS RegExp('/').source is "\\/"
PASS RegExp('').source is "(?:)"
PASS RegExp.prototype.source is "(?:)"
PASS RegExp('/').toString() is "/\\//"
PASS RegExp('').toString() is "/(?:)/"
PASS RegExp.prototype.toString() is "/(?:)/"
PASS testForwardSlash("^/$", "/"); is true
PASS testForwardSlash("^/$", "/"); is true
PASS testForwardSlash("^\/$", "/"); is true
PASS testForwardSlash("^\\/$", "\/"); is true
PASS testForwardSlash("^\\\/$", "\/"); is true
PASS testForwardSlash("^\\\\/$", "\\/"); is true
PASS testForwardSlash("^\\\\\/$", "\\/"); is true
PASS testForwardSlash("x/x/x", "x\/x\/x"); is true
PASS testForwardSlash("x\/x/x", "x\/x\/x"); is true
PASS testForwardSlash("x/x\/x", "x\/x\/x"); is true
PASS testForwardSlash("x\/x\/x", "x\/x\/x"); is true
PASS testLineTerminator("\n"); is false
PASS testLineTerminator("\\n"); is false
PASS testLineTerminator("\r"); is false
PASS testLineTerminator("\\r"); is false
PASS testLineTerminator("\u2028"); is false
PASS testLineTerminator("\\u2028"); is false
PASS testLineTerminator("\u2029"); is false
PASS testLineTerminator("\\u2029"); is false
PASS RegExp('[/]').source is '[/]'
PASS RegExp('\\[/]').source is '\\[\\/]'
PASS var o = new RegExp(); o.toString() === '/'+o.source+'/' && eval(o.toString()+'.exec(String())') is [""]
PASS successfullyParsed is true
TEST COMPLETE