| 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 {
|
|
|