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

Unified Diff: tests/language/function_type/test_generator.dart

Issue 2986313002: Revert "Update the function_type tests for Dart 2.0." (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « tests/language/function_type/function_type9_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/function_type/test_generator.dart
diff --git a/tests/language_2/function_type/test_generator.dart b/tests/language/function_type/test_generator.dart
similarity index 94%
rename from tests/language_2/function_type/test_generator.dart
rename to tests/language/function_type/test_generator.dart
index c2c95cbd7d24903e11e2348d0c30e4cc79c43824..1a9360c1a1727e99caaeafb945485bd59cdfd853 100644
--- a/tests/language_2/function_type/test_generator.dart
+++ b/tests/language/function_type/test_generator.dart
@@ -596,21 +596,21 @@ final TEST_METHOD_HEADER = """
// Tests that apply for every type.
final COMMON_TESTS_TEMPLATE = """
- Expect.isTrue(#staticFunName is #typeName<int>);
- Expect.isTrue(confuse(#staticFunName) is #typeName<int>);
+ Expect.isTrue(#staticFunName is #typeName);
+ Expect.isTrue(confuse(#staticFunName) is #typeName);
// In checked mode, verifies the type.
#typeCode #localName;
// The static function #staticFunName sets `T` to `int`.
- if (tIsInt) {
+ if (!tIsBool) {
#fieldName = #staticFunName as dynamic;
#localName = #staticFunName as dynamic;
#fieldName = confuse(#staticFunName);
#localName = confuse(#staticFunName);
}
- Expect.isTrue(#methodFunName is #typeName<T>);
+ Expect.isTrue(#methodFunName is #typeName);
Expect.isTrue(#methodFunName is #typeCode);
- Expect.isTrue(confuse(#methodFunName) is #typeName<T>);
+ Expect.isTrue(confuse(#methodFunName) is #typeName);
// In checked mode, verifies the type.
#fieldName = #methodFunName;
#localName = #methodFunName;
@@ -631,22 +631,25 @@ final COMMON_TESTS_TEMPLATE = """
// f(List<T> x) {}
// }
final TYPEDEF_T_TESTS_TEMPLATE = """
- // The static function has its T always set to int.
- Expect.isTrue(#staticFunName is #typeName<int>);
- Expect.isFalse(#staticFunName is #typeName<bool>);
- Expect.isTrue(confuse(#staticFunName) is #typeName<int>);
- Expect.isFalse(confuse(#staticFunName) is #typeName<bool>);
- if (tIsBool) {
- Expect.throws(() { #fieldName = (#staticFunName as dynamic); });
- Expect.throws(() { #fieldName = confuse(#staticFunName); });
- Expect.throws(() { #localName = (#staticFunName as dynamic); });
- Expect.throws(() { #localName = confuse(#staticFunName); });
- }
- if (tIsInt || tIsBool) {
- Expect.equals(tIsInt, #methodFunName is #typeName<int>);
- Expect.equals(tIsBool, #methodFunName is #typeName<bool>);
- Expect.equals(tIsInt, confuse(#methodFunName) is #typeName<int>);
- Expect.equals(tIsBool, confuse(#methodFunName) is #typeName<bool>);
+ if (!tIsBool) {
+ Expect.isTrue(#staticFunName is #typeName<int>);
+ Expect.isFalse(#staticFunName is #typeName<bool>);
+ Expect.isTrue(confuse(#staticFunName) is #typeName<int>);
+ Expect.isFalse(confuse(#staticFunName) is #typeName<bool>);
+ Expect.equals(tIsDynamic, #methodFunName is #typeName<bool>);
+ Expect.equals(tIsDynamic, confuse(#methodFunName) is #typeName<bool>);
+ } else {
+ if (typeAssertionsEnabled) {
+ Expect.throws(() { #fieldName = (#staticFunName as dynamic); });
+ Expect.throws(() { #fieldName = confuse(#staticFunName); });
+ #typeCode #localName;
+ Expect.throws(() { #localName = (#staticFunName as dynamic); });
+ Expect.throws(() { #localName = confuse(#staticFunName); });
+ }
+ #typeCode #localName = #methodFunName;
+ // In checked mode, verifies the type.
+ #fieldName = #methodFunName;
+ #fieldName = confuse(#methodFunName);
}""";
final TEST_METHOD_FOOTER = " }";
« no previous file with comments | « tests/language/function_type/function_type9_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698