add a test for zero-length string in is_identifier_string, which is used in property compression. Also added a test exercising the change.

This commit is contained in:
Trey Griffith 2013-05-08 15:29:46 -04:00
parent 0f509f8336
commit d3655cd07f
2 changed files with 5 additions and 1 deletions

View File

@ -172,7 +172,7 @@ function is_identifier_string(str){
if (!is_identifier_char(str.charAt(i))) if (!is_identifier_char(str.charAt(i)))
return false; return false;
} }
return true; return str.length > 0;
}; };
function parse_js_number(num) { function parse_js_number(num) {

View File

@ -19,12 +19,14 @@ dot_properties: {
a["if"] = "if"; a["if"] = "if";
a["*"] = "asterisk"; a["*"] = "asterisk";
a["\u0EB3"] = "unicode"; a["\u0EB3"] = "unicode";
a[""] = "whitespace";
} }
expect: { expect: {
a.foo = "bar"; a.foo = "bar";
a["if"] = "if"; a["if"] = "if";
a["*"] = "asterisk"; a["*"] = "asterisk";
a.\u0EB3 = "unicode"; a.\u0EB3 = "unicode";
a[""] = "whitespace";
} }
} }
@ -38,11 +40,13 @@ dot_properties_es5: {
a["if"] = "if"; a["if"] = "if";
a["*"] = "asterisk"; a["*"] = "asterisk";
a["\u0EB3"] = "unicode"; a["\u0EB3"] = "unicode";
a[""] = "whitespace";
} }
expect: { expect: {
a.foo = "bar"; a.foo = "bar";
a.if = "if"; a.if = "if";
a["*"] = "asterisk"; a["*"] = "asterisk";
a.\u0EB3 = "unicode"; a.\u0EB3 = "unicode";
a[""] = "whitespace";
} }
} }