Chromium Code Reviews| Index: tests/compiler/dart2js/unparser_test.dart |
| diff --git a/tests/compiler/dart2js/unparser_test.dart b/tests/compiler/dart2js/unparser_test.dart |
| index 441269e2013caf29c2d03157170ead52e35fe99f..f6b1adfa0ca6189d6b3528ccee94609041abcde5 100644 |
| --- a/tests/compiler/dart2js/unparser_test.dart |
| +++ b/tests/compiler/dart2js/unparser_test.dart |
| @@ -287,6 +287,40 @@ testClassDeclarations() { |
| testUnparseTopLevelWithMetadata('class Fisk{operator-(x){}}'); |
| } |
| +testUnparseParameters(List<String> variableDeclarations) { |
| + var sb = new StringBuffer(); |
| + sb.add('Constructor('); |
| + int index = 0; |
| + for (String variableDeclaration in variableDeclarations) { |
| + if (index != 0) { |
| + sb.add(', '); |
| + } |
| + sb.add(variableDeclaration); |
| + index++; |
| + } |
| + sb.add(');'); |
| + |
| + FunctionExpression node = parseMember(sb.toString()); |
| + index = 0; |
| + for (VariableDefinitions parameter in node.parameters.nodes) { |
| + Expect.equals(variableDeclarations[index], unparse(parameter)); |
| + index++; |
| + } |
| + |
| +} |
| + |
| +testParameters() { |
| + testUnparseParameters( |
| + ["foo", "bar=0", "int baz", "int boz=0"]); |
| + testUnparseParameters( |
| + ["this.foo", "this.bar=0", "int this.baz", "int this.boz=0"]); |
| + testUnparseParameters( |
| + ["foo()", "void bar()", "int baz(a)", "int boz(int a,int b)=null"]); |
| + testUnparseParameters( |
| + ["this.foo()", "void this.bar()", |
|
ahe
2013/01/21 11:14:08
If this doesn't work, comment it out.
|
| + "int this.baz(a)", "int this.boz(int a,int b)=null"]); |
| +} |
| + |
| main() { |
| testSignedConstants(); |
| testGenericTypes(); |
| @@ -306,4 +340,5 @@ main() { |
| testCombinators(); |
| testRedirectingFactoryConstructors(); |
| testClassDeclarations(); |
| + testParameters(); |
| } |