blob: 5dd48a7b8b554e926714c7c8178303ef4d4d6c22 [file] [log] [blame]
This will test string.replace with function replacer.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS "ABC".replace("B","$$") is "A$C"
PASS "ABC".replace("B", function () { return "$$"; }) is "A$$C"
PASS "ABC".replace("B", function () { return "$$$"; }) is "A$$$C"
PASS "ABC".replace("B", function () { return "$$$$"; }) is "A$$$$C"
PASS "ABC".replace("B", function () { return "$1"; }) is "A$1C"
PASS "ABC".replace("B", function () { return "$2"; }) is "A$2C"
PASS "John Doe".replace(/(\w+)\s(\w+)/, "$2 $1") is "Doe John"
PASS "John Doe".replace(/(\w+)\s(\w+)/, function () { return "$2 $1"; }) is "$2 $1"
PASS successfullyParsed is true
TEST COMPLETE