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

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

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

Powered by Google App Engine
This is Rietveld 408576698