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

Unified Diff: pkg/analyzer/test/src/dart/analysis/referenced_names_test.dart

Issue 2961773002: Compute subtyped names. (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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/referenced_names.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/dart/analysis/referenced_names_test.dart
diff --git a/pkg/analyzer/test/src/dart/analysis/referenced_names_test.dart b/pkg/analyzer/test/src/dart/analysis/referenced_names_test.dart
index 2a0ea6c919a541b09b4797234dbb56b2bf080ee2..994485d0b8a25fc722d2cf92a2f4f91747b21abc 100644
--- a/pkg/analyzer/test/src/dart/analysis/referenced_names_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/referenced_names_test.dart
@@ -11,12 +11,13 @@ import '../../../generated/parser_test.dart';
main() {
defineReflectiveSuite(() {
- defineReflectiveTests(ReferencedNamesBuilderTest);
+ defineReflectiveTests(ComputeReferencedNamesTest);
+ defineReflectiveTests(ComputeSubtypedNamesTest);
});
}
@reflectiveTest
-class ReferencedNamesBuilderTest extends ParserTestCase {
+class ComputeReferencedNamesTest extends ParserTestCase {
test_class_constructor() {
Set<String> names = _computeReferencedNames('''
class U {
@@ -409,3 +410,37 @@ main() {
return computeReferencedNames(unit);
}
}
+
+@reflectiveTest
+class ComputeSubtypedNamesTest extends ParserTestCase {
+ void test_prefixed() {
+ Set<String> names = _computeSubtypedNames('''
+import 'lib.dart' as p;
+class X extends p.A with p.B implements p.C {}
+''');
+ expect(names, unorderedEquals(['A', 'B', 'C']));
+ }
+
+ void test_typeArguments() {
+ Set<String> names = _computeSubtypedNames('''
+import 'lib.dart';
+class X extends A<B> {}
+''');
+ expect(names, unorderedEquals(['A']));
+ }
+
+ void test_unprefixed() {
+ Set<String> names = _computeSubtypedNames('''
+import 'lib.dart';
+class X extends A {}
+class Y extends A with B {}
+class Z implements A, B, C {}
+''');
+ expect(names, unorderedEquals(['A', 'B', 'C']));
+ }
+
+ Set<String> _computeSubtypedNames(String code) {
+ CompilationUnit unit = parseCompilationUnit2(code);
+ return computeSubtypedNames(unit);
+ }
+}
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/referenced_names.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698