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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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/compiler/dart2js/find_my_name_test.dart ('k') | tests/compiler/dart2js/for_in_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/flatten_test.dart
diff --git a/tests/compiler/dart2js/flatten_test.dart b/tests/compiler/dart2js/flatten_test.dart
index 0275ee7a9c7be958016407b427a2685b1f81d782..4b60d02b5cece32304121e6724f7e20a574e2ed5 100644
--- a/tests/compiler/dart2js/flatten_test.dart
+++ b/tests/compiler/dart2js/flatten_test.dart
@@ -8,8 +8,7 @@ import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'type_test_helper.dart';
import 'package:compiler/src/dart_types.dart';
-import "package:compiler/src/elements/elements.dart"
- show Element, ClassElement;
+import "package:compiler/src/elements/elements.dart" show Element, ClassElement;
void main() {
asyncTest(() => TypeEnvironment.create(r"""
@@ -17,66 +16,67 @@ void main() {
abstract class G<T> implements Future<G<T>> {}
abstract class H<T> implements Future<H<H<T>>> {}
""").then((env) {
+ void check(DartType T, DartType expectedFlattenedType) {
+ DartType flattenedType = env.flatten(T);
+ Expect.equals(
+ expectedFlattenedType,
+ flattenedType,
+ "Unexpected flattening of '$T' = '$flattenedType',"
+ "expected '$expectedFlattenedType'.");
+ }
- void check(DartType T, DartType expectedFlattenedType) {
- DartType flattenedType = env.flatten(T);
- Expect.equals(expectedFlattenedType, flattenedType,
- "Unexpected flattening of '$T' = '$flattenedType',"
- "expected '$expectedFlattenedType'.");
- }
+ ClassElement Future_ = env.getElement('Future');
+ ClassElement F = env.getElement('F');
+ ClassElement G = env.getElement('G');
+ ClassElement H = env.getElement('H');
+ DartType int_ = env['int'];
+ DartType dynamic_ = env['dynamic'];
+ DartType Future_int = instantiate(Future_, [int_]);
+ DartType F_int = instantiate(F, [int_]);
+ DartType G_int = instantiate(G, [int_]);
+ DartType H_int = instantiate(H, [int_]);
+ DartType H_H_int = instantiate(H, [H_int]);
- ClassElement Future_ = env.getElement('Future');
- ClassElement F = env.getElement('F');
- ClassElement G = env.getElement('G');
- ClassElement H = env.getElement('H');
- DartType int_ = env['int'];
- DartType dynamic_ = env['dynamic'];
- DartType Future_int = instantiate(Future_, [int_]);
- DartType F_int = instantiate(F, [int_]);
- DartType G_int = instantiate(G, [int_]);
- DartType H_int = instantiate(H, [int_]);
- DartType H_H_int = instantiate(H, [H_int]);
+ // flatten(int) = int
+ check(int_, int_);
- // flatten(int) = int
- check(int_, int_);
+ // flatten(Future) = dynamic
+ check(Future_.rawType, dynamic_);
- // flatten(Future) = dynamic
- check(Future_.rawType, dynamic_);
+ // flatten(Future<int>) = int
+ check(Future_int, int_);
- // flatten(Future<int>) = int
- check(Future_int, int_);
+ // flatten(Future<Future<int>>) = int
+ check(instantiate(Future_, [Future_int]), int_);
- // flatten(Future<Future<int>>) = int
- check(instantiate(Future_, [Future_int]), int_);
+ // flatten(F) = dynamic
+ check(F.rawType, dynamic_);
- // flatten(F) = dynamic
- check(F.rawType, dynamic_);
+ // flatten(F<int>) = int
+ check(F_int, int_);
- // flatten(F<int>) = int
- check(F_int, int_);
+ // flatten(F<Future<int>>) = Future<int>
+ check(instantiate(F, [Future_int]), Future_int);
- // flatten(F<Future<int>>) = Future<int>
- check(instantiate(F, [Future_int]), Future_int);
+ // flatten(G) = G
+ check(G.rawType, G.rawType);
- // flatten(G) = G
- check(G.rawType, G.rawType);
+ // flatten(G<int>) = G<int>
+ check(G_int, G_int);
- // flatten(G<int>) = G<int>
- check(G_int, G_int);
+ // flatten(H) = H<H>
+ check(H.rawType, instantiate(H, [H.rawType]));
- // flatten(H) = H<H>
- check(H.rawType, instantiate(H, [H.rawType]));
+ // flatten(H<int>) = H<H<int>>
+ check(H_int, H_H_int);
- // flatten(H<int>) = H<H<int>>
- check(H_int, H_H_int);
+ // flatten(Future<F<int>>) = int
+ check(instantiate(Future_, [F_int]), int_);
- // flatten(Future<F<int>>) = int
- check(instantiate(Future_, [F_int]), int_);
+ // flatten(Future<G<int>>) = int
+ check(instantiate(Future_, [G_int]), G_int);
- // flatten(Future<G<int>>) = int
- check(instantiate(Future_, [G_int]), G_int);
-
- // flatten(Future<H<int>>) = int
- check(instantiate(Future_, [H_int]), H_H_int);
- }));
+ // flatten(Future<H<int>>) = int
+ check(instantiate(Future_, [H_int]), H_H_int);
+ }));
}
« no previous file with comments | « tests/compiler/dart2js/find_my_name_test.dart ('k') | tests/compiler/dart2js/for_in_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698