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

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: Updated cf. comments. 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 cecb766a777981f167c8695d837f4eacb6736112..ee7b7109e9576e38ba8228230d782817943b76f8 100644
--- a/tests/compiler/dart2js/unparser_test.dart
+++ b/tests/compiler/dart2js/unparser_test.dart
@@ -304,6 +304,43 @@ testMixinApplications() {
testUnparseTopLevelWithMetadata('typedef C = S with M1,M2<A,B>;');
}
+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()", // Commented out due to Issue 7852
+ //"int this.baz(a)", // Commented out due to Issue 7852
+ //"int this.boz(int a,int b)=null" // Commented out due to Issue 7852
+ ]);
+}
+
main() {
testSignedConstants();
testGenericTypes();
@@ -324,4 +361,5 @@ main() {
testRedirectingFactoryConstructors();
testClassDeclarations();
testMixinApplications();
+ testParameters();
}

Powered by Google App Engine
This is Rietveld 408576698