enhance test for #2242 (#2248)

This commit is contained in:
Alex Lam S.L
2017-07-24 00:32:33 +08:00
committed by GitHub
parent 1e0c7d2bc5
commit 69861824b5

View File

@@ -147,7 +147,7 @@ describe("Unicode", function() {
if (semver.satisfies(process.version, ">=4")) { if (semver.satisfies(process.version, ">=4")) {
it("Should not unescape unpaired surrogates", function() { it("Should not unescape unpaired surrogates", function() {
var code = []; var code = [];
for (var i = 0; i <= 0xFFFF; i++) { for (var i = 0; i <= 0x20001; i++) {
code.push("\\u{" + i.toString(16) + "}"); code.push("\\u{" + i.toString(16) + "}");
} }
code = '"' + code.join() + '"'; code = '"' + code.join() + '"';
@@ -162,7 +162,7 @@ describe("Unicode", function() {
ecma: ecma ecma: ecma
}); });
if (result.error) throw result.error; if (result.error) throw result.error;
assert.ok(code.length > result.code.length); if (ecma > 5) assert.ok(code.length > result.code.length);
assert.strictEqual(eval(code), eval(result.code)); assert.strictEqual(eval(code), eval(result.code));
}); });
}); });