Fix quoting of properties

- Make AST_ConciseMethod child of AST_ObjectProperty.
- Fix some typos.
This commit is contained in:
Anthony Van de Gejuchte
2016-07-29 03:18:21 +02:00
committed by Richard van Velzen
parent 67461666dc
commit 1c15d0db45
7 changed files with 257 additions and 58 deletions

View File

@@ -23,4 +23,35 @@ describe("Class", function() {
assert.throws(test(tests[i]), error);
}
});
it("Should return the correct token for class methods", function() {
var tests = [
{
code: "class foo{static test(){}}",
token_value_start: "static",
token_value_end: "}"
},
{
code: "class bar{*procedural(){}}",
token_value_start: "*",
token_value_end: "}"
},
{
code: "class foobar{aMethod(){}}",
token_value_start: "aMethod",
token_value_end: "}"
},
{
code: "class foobaz{get something(){}}",
token_value_start: "get",
token_value_end: "}"
}
];
for (var i = 0; i < tests.length; i++) {
var ast = uglify.parse(tests[i].code);
assert.strictEqual(ast.body[0].properties[0].start.value, tests[i].token_value_start);
assert.strictEqual(ast.body[0].properties[0].end.value, tests[i].token_value_end);
}
});
});