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

Unified Diff: pkg/kernel/test/class_hierarchy_test.dart

Issue 2924333002: Use ClassHierarchy.applyChanges() in MixinFullResolution. (Closed)
Patch Set: Changes for review comments. Created 3 years, 6 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 | « pkg/kernel/lib/transformations/mixin_full_resolution.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/test/class_hierarchy_test.dart
diff --git a/pkg/kernel/test/class_hierarchy_test.dart b/pkg/kernel/test/class_hierarchy_test.dart
index d55a8524d7d73f382ebf3130f1992792dae0ef26..a05464f29ffa61529b30cb5894526927b29202b5 100644
--- a/pkg/kernel/test/class_hierarchy_test.dart
+++ b/pkg/kernel/test/class_hierarchy_test.dart
@@ -24,6 +24,24 @@ class ClosedWorldClassHierarchyTest extends _ClassHierarchyTest {
ClassHierarchy createClassHierarchy(Program program) {
return new ClosedWorldClassHierarchy(program);
}
+
+ void test_applyChanges() {
+ var a = addClass(new Class(name: 'A', supertype: objectSuper));
+ addClass(new Class(name: 'B', supertype: a.asThisSupertype));
+
+ _assertTestLibraryText('''
+class A {}
+class B extends self::A {}
+''');
+
+ // No updated classes, the same hierarchy.
+ expect(hierarchy.applyChanges([]), same(hierarchy));
+
+ // Has updated classes, a new hierarchy.
+ var newHierarchy = hierarchy.applyChanges([a]);
+ expect(newHierarchy, isNot(same(hierarchy)));
+ expect(newHierarchy, new isInstanceOf<ClosedWorldClassHierarchy>());
+ }
}
@reflectiveTest
@@ -31,6 +49,24 @@ class IncrementalClassHierarchyTest extends _ClassHierarchyTest {
ClassHierarchy createClassHierarchy(Program program) {
return new IncrementalClassHierarchy();
}
+
+ void test_applyChanges() {
+ var a = addClass(new Class(name: 'A', supertype: objectSuper));
+ addClass(new Class(name: 'B', supertype: a.asThisSupertype));
+
+ _assertTestLibraryText('''
+class A {}
+class B extends self::A {}
+''');
+
+ // No updated classes, the same hierarchy.
+ expect(hierarchy.applyChanges([]), same(hierarchy));
+
+ // Has updated classes, a new hierarchy.
+ var newHierarchy = hierarchy.applyChanges([a]);
+ expect(newHierarchy, isNot(same(hierarchy)));
+ expect(newHierarchy, new isInstanceOf<IncrementalClassHierarchy>());
+ }
}
abstract class _ClassHierarchyTest {
« no previous file with comments | « pkg/kernel/lib/transformations/mixin_full_resolution.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698