Last active
December 20, 2015 01:39
-
-
Save mernen/6050329 to your computer and use it in GitHub Desktop.
Sample testcase for PhantomJS issue #11494
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var re1 = /test/; | |
var re2 = new RegExp(re1); | |
assert(re1 !== re2, "new RegExp() should always return a new object"); | |
var scanner = /foo/g; | |
scanner.lastIndex = 3; | |
var copy = new RegExp(scanner); | |
assert(copy.lastIndex === 0, "new RegExp(...) should never copy lastIndex"); | |
if (phantom) phantom.exit(); | |
function assert(value, message) { | |
console.log(message, value ? "[OK]" : "[FAIL]"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment