| }
public void testFunctionDeclaration() throws CompilerException {
assertParserOutput(
new FunctionDeclaration(
new FunctionLiteral(
new Identifier("foo"),
new Identifier[] {
},
new Statement[] {
}
)
),
"function foo() {};"
);
assertParserOutput(
new FunctionDeclaration(
new FunctionLiteral(
new Identifier("foo"),
new Identifier[] {
new Identifier("a"),
},
new Statement[] {
}
)
),
"function foo(a) {}"
);
assertParserOutput(
new FunctionDeclaration(
new FunctionLiteral(
new Identifier("foo"),
new Identifier[] {
new Identifier("a"),
new Identifier("b"),
new Identifier("c"),
},
new Statement[] {
}
)
),
"function foo(a, b, c) {};"
);
assertParserOutput(
new FunctionDeclaration(
new FunctionLiteral(
new Identifier("a"),
new Identifier[] {
},
new Statement[] {
new FunctionDeclaration(
new FunctionLiteral(
new Identifier("b"),
new Identifier[] {
},
new Statement[] {
new IfStatement(
new NumberLiteral(0.0),
new ExpressionStatement(
new FunctionLiteral(
new Identifier("c"),
new Identifier[] {
},
new Statement[] {
}
)
),
new ExpressionStatement(
new FunctionLiteral(
null,
new Identifier[] {
},
new Statement[] {
}
|