Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: tests/compiler/dart2js/unparser_test.dart

Issue 11783089: Fix VariableDefinitions.endToken for formal parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test added to unparser_test. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}
« tests/compiler/dart2js/dart2js.status ('K') | « tests/compiler/dart2js/dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698