public void testObjectLiteral() throws CompilerException {
assertParserOutput(
new ExpressionStatement(
new AssignmentExpression(
new Identifier("foo"),
new ObjectLiteral(
new ObjectLiteralProperty[] {}
)
)
),
"foo = {};"
);
assertParserOutput(
new ExpressionStatement(
new AssignmentExpression(
new Identifier("foo"),
new ObjectLiteral(
new ObjectLiteralProperty[] {
new ObjectLiteralProperty(
new StringLiteral("name"),
new StringLiteral("wibble")
)
}
)
)
),
"foo = {name: \"wibble\"};"
);
assertParserOutput(
new ExpressionStatement(
new AssignmentExpression(
new Identifier("foo"),
new ObjectLiteral(
new ObjectLiteralProperty[] {
new ObjectLiteralProperty(
new StringLiteral("name"),
new StringLiteral("wibble")