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

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

Issue 10779010: Parameters with function types supported + Added features in mirrors implementation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments + mdn bug fixed. Created 8 years, 5 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/mirrors_test.dart
diff --git a/tests/compiler/dart2js/mirrors_test.dart b/tests/compiler/dart2js/mirrors_test.dart
index 5ef944c1f59e7a438dde3a456841ef3a7226b13d..da88e3c87e202a2c454654a3a798cbc7ba06f0fe 100644
--- a/tests/compiler/dart2js/mirrors_test.dart
+++ b/tests/compiler/dart2js/mirrors_test.dart
@@ -441,12 +441,10 @@ void testBaz(MirrorSystem system, LibraryMirror helperLibrary,
Expect.stringEquals("mirrors_helper.Baz.method2#f",
method2Parameter2.qualifiedName(),
"Unexpected parameter qualifiedName");
- // TODO(johnniwinther): Should return true:
- Expect.isFalse(method2Parameter2.hasDefaultValue(),
+ Expect.isTrue(method2Parameter2.hasDefaultValue(),
"Parameter has default value");
- // TODO(johnniwinther): Should return a non-null value:
- Expect.isNull(method2Parameter2.defaultValue(),
- "Parameter default value is non-null");
+ Expect.stringEquals("null", method2Parameter2.defaultValue(),
+ "Parameter default value is non-null");
Expect.isTrue(method2Parameter2.isOptional(), "Parameter is not optional");
////////////////////////////////////////////////////////////////////////////
@@ -485,7 +483,24 @@ void testBaz(MirrorSystem system, LibraryMirror helperLibrary,
var method3Parameter1 = method3Parameters[0];
Expect.isNotNull(method3Parameter1, "Parameter is null");
// TODO(johnniwinther): Should return the function type E func(F f):
- Expect.equals(dynamicType, method3Parameter1.type());
+ var method3Parameter1type = method3Parameter1.type();
+ Expect.isNotNull(method3Parameter1type, "Parameter type of 'func1' is null");
+ Expect.isTrue(method3Parameter1type is FunctionTypeMirror,
+ "Parameter type of 'func1' is not a function");
+ Expect.equals(bazE, method3Parameter1type.returnType(),
+ "Return type of 'func1' is not a E");
+ Expect.isNotNull(method3Parameter1type.parameters(),
+ "Parameters of 'func1' is null");
+ Expect.equals(1, method3Parameter1type.parameters().length,
+ "Unexpected parameter count of 'func1'");
+ Expect.equals(bazE, method3Parameter1type.returnType(),
+ "Return type of 'func1' is not a E");
+ Expect.isNotNull(method3Parameter1type.parameters()[0],
+ "Parameter 1 of 'func1' is null");
+ Expect.stringEquals('f', method3Parameter1type.parameters()[0].simpleName(),
+ "Unexpected name parameter 1 of 'func1'");
+ Expect.equals(bazF, method3Parameter1type.parameters()[0].type(),
+ "Return type of 'func1' is not a F");
Expect.stringEquals("func1", method3Parameter1.simpleName(),
"Unexpected parameter simpleName");
Expect.stringEquals("mirrors_helper.Baz.method3#func1",
@@ -549,7 +564,8 @@ void testBaz(MirrorSystem system, LibraryMirror helperLibrary,
method3Parameter2.qualifiedName(),
"Unexpected parameter qualifiedName");
Expect.isFalse(method3Parameter2.hasDefaultValue(),
- "Parameter has default value");
+ "Parameter 'func2' has default value: "
+ "${method3Parameter2.defaultValue()}");
Expect.isNull(method3Parameter2.defaultValue(),
"Parameter default value is non-null");
Expect.isFalse(method3Parameter2.isOptional(), "Parameter is optional");

Powered by Google App Engine
This is Rietveld 408576698