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

Unified Diff: pkg/front_end/test/src/incremental/file_state_test.dart

Issue 2928393004: Add FileState.hasMixin/hasMixinLibrary properties. (Closed)
Patch Set: 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
Index: pkg/front_end/test/src/incremental/file_state_test.dart
diff --git a/pkg/front_end/test/src/incremental/file_state_test.dart b/pkg/front_end/test/src/incremental/file_state_test.dart
index 9e9f391cdbb9f3246d7f021711017fc15b8ad3d5..9feda3eaf39afe36647f43edf2dbe8ab469963d9 100644
--- a/pkg/front_end/test/src/incremental/file_state_test.dart
+++ b/pkg/front_end/test/src/incremental/file_state_test.dart
@@ -284,6 +284,105 @@ export "c.dart" show A, B, C, D hide C show A, D;
}
}
+ test_hasMixin_false() async {
+ writeFile(
+ '/a.dart',
+ r'''
+class A {}
+class B extends Object with A {}
+''');
+ var uri = writeFile(
+ '/test.dart',
+ r'''
+import 'a.dart';
+class T1 extends A {}
+class T2 extends B {}
+''');
+ FileState file = await fsState.getFile(uri);
+ expect(file.hasMixin, isFalse);
+ }
+
+ test_hasMixin_true() async {
+ var uri = writeFile(
+ '/test.dart',
+ r'''
+class A {}
+class B extends Object with A {}
+''');
+ FileState file = await fsState.getFile(uri);
+ expect(file.hasMixin, isTrue);
+ }
+
+ test_hasMixinLibrary_false() async {
+ var partUri = writeFile(
+ '/part.dart',
+ r'''
+part of test;
+class A {}
+''');
+ var libUri = writeFile(
+ '/test.dart',
+ r'''
+library test;
+part 'part.dart';
+class B extends A {}
+''');
+
+ FileState part = await fsState.getFile(partUri);
+ FileState lib = await fsState.getFile(libUri);
+
+ expect(part.hasMixin, isFalse);
+ expect(lib.hasMixin, isFalse);
+ expect(lib.hasMixinLibrary, isFalse);
+ }
+
+ test_hasMixinLibrary_true_inDefiningUnit() async {
+ var partUri = writeFile(
+ '/part.dart',
+ r'''
+part of test;
+class A {}
+''');
+ var libUri = writeFile(
+ '/test.dart',
+ r'''
+library test;
+part 'part.dart';
+class B extends Object with A {}
+''');
+
+ FileState part = await fsState.getFile(partUri);
+ FileState lib = await fsState.getFile(libUri);
+
+ expect(part.hasMixin, isFalse);
+ expect(lib.hasMixin, isTrue);
+ expect(lib.hasMixinLibrary, isTrue);
+ }
+
+ test_hasMixinLibrary_true_inPart() async {
+ var partUri = writeFile(
+ '/part.dart',
+ r'''
+part of test;
+class A {}
+class B extends Object with A {}
ahe 2017/06/12 19:22:03 Consider adding a test for a named mixin applicati
scheglov 2017/06/12 19:43:19 Done.
+''');
+ var libUri = writeFile(
+ '/test.dart',
+ r'''
+library test;
+part 'part.dart';
+class C {}
+''');
+
+ FileState part = await fsState.getFile(partUri);
+ FileState lib = await fsState.getFile(libUri);
+
+ expect(part.hasMixin, isTrue);
+ expect(lib.hasMixin, isFalse);
+ expect(lib.hasMixinLibrary, isTrue);
+ }
+
test_newFileListener() async {
var a = writeFile('/a.dart', '');
var b = writeFile('/b.dart', '');

Powered by Google App Engine
This is Rietveld 408576698