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

Unified Diff: pkg/analyzer/test/src/summary/summary_test.dart

Issue 1455693002: Add summary tests for cascaded show/hide combinators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/summary_test.dart
diff --git a/pkg/analyzer/test/src/summary/summary_test.dart b/pkg/analyzer/test/src/summary/summary_test.dart
index b8163ae0cbdc44534e449eba96bc06a3b1e3710f..f7d7a94c21495a81389f1accc229b4398eb1e288 100644
--- a/pkg/analyzer/test/src/summary/summary_test.dart
+++ b/pkg/analyzer/test/src/summary/summary_test.dart
@@ -437,6 +437,134 @@ abstract class SummaryTest {
return findVariable(variableName, failIfAbsent: true);
}
+ test_cascaded_export_hide_hide() {
+ addNamedSource('/lib1.dart', 'export "lib2.dart" hide C hide B, C;');
+ addNamedSource('/lib2.dart', 'class A {} class B {} class C {}');
+ serializeLibraryText(
+ '''
+import 'lib1.dart';
+A a;
+B b;
+C c;
+ ''',
+ allowErrors: true);
+ checkTypeRef(
+ findVariable('a').type, absUri('/lib2.dart'), 'lib2.dart', 'A');
+ checkUnresolvedTypeRef(findVariable('b').type, null, 'B');
+ checkUnresolvedTypeRef(findVariable('c').type, null, 'C');
+ }
+
+ test_cascaded_export_hide_show() {
+ addNamedSource('/lib1.dart', 'export "lib2.dart" hide C show A, C;');
+ addNamedSource('/lib2.dart', 'class A {} class B {} class C {}');
+ serializeLibraryText(
+ '''
+import 'lib1.dart';
+A a;
+B b;
+C c;
+ ''',
+ allowErrors: true);
+ checkTypeRef(
+ findVariable('a').type, absUri('/lib2.dart'), 'lib2.dart', 'A');
+ checkUnresolvedTypeRef(findVariable('b').type, null, 'B');
+ checkUnresolvedTypeRef(findVariable('c').type, null, 'C');
+ }
+
+ test_cascaded_export_show_hide() {
+ addNamedSource('/lib1.dart', 'export "lib2.dart" show A, B hide B, C;');
+ addNamedSource('/lib2.dart', 'class A {} class B {} class C {}');
+ serializeLibraryText(
+ '''
+import 'lib1.dart';
+A a;
+B b;
+C c;
+ ''',
+ allowErrors: true);
+ checkTypeRef(
+ findVariable('a').type, absUri('/lib2.dart'), 'lib2.dart', 'A');
+ checkUnresolvedTypeRef(findVariable('b').type, null, 'B');
+ checkUnresolvedTypeRef(findVariable('c').type, null, 'C');
+ }
+
+ test_cascaded_export_show_show() {
+ addNamedSource('/lib1.dart', 'export "lib2.dart" show A, B show A, C;');
+ addNamedSource('/lib2.dart', 'class A {} class B {} class C {}');
+ serializeLibraryText(
+ '''
+import 'lib1.dart';
+A a;
+B b;
+C c;
+ ''',
+ allowErrors: true);
+ checkTypeRef(
+ findVariable('a').type, absUri('/lib2.dart'), 'lib2.dart', 'A');
+ checkUnresolvedTypeRef(findVariable('b').type, null, 'B');
+ checkUnresolvedTypeRef(findVariable('c').type, null, 'C');
+ }
+
+ test_cascaded_import_hide_hide() {
+ addNamedSource('/lib.dart', 'class A {} class B {} class C {}');
+ serializeLibraryText(
+ '''
+import 'lib.dart' hide C hide B, C;
+A a;
+B b;
+C c;
+ ''',
+ allowErrors: true);
+ checkTypeRef(findVariable('a').type, absUri('/lib.dart'), 'lib.dart', 'A');
+ checkUnresolvedTypeRef(findVariable('b').type, null, 'B');
+ checkUnresolvedTypeRef(findVariable('c').type, null, 'C');
+ }
+
+ test_cascaded_import_hide_show() {
+ addNamedSource('/lib.dart', 'class A {} class B {} class C {}');
+ serializeLibraryText(
+ '''
+import 'lib.dart' hide C show A, C;
+A a;
+B b;
+C c;
+ ''',
+ allowErrors: true);
+ checkTypeRef(findVariable('a').type, absUri('/lib.dart'), 'lib.dart', 'A');
+ checkUnresolvedTypeRef(findVariable('b').type, null, 'B');
+ checkUnresolvedTypeRef(findVariable('c').type, null, 'C');
+ }
+
+ test_cascaded_import_show_hide() {
+ addNamedSource('/lib.dart', 'class A {} class B {} class C {}');
+ serializeLibraryText(
+ '''
+import 'lib.dart' show A, B hide B, C;
+A a;
+B b;
+C c;
+ ''',
+ allowErrors: true);
+ checkTypeRef(findVariable('a').type, absUri('/lib.dart'), 'lib.dart', 'A');
+ checkUnresolvedTypeRef(findVariable('b').type, null, 'B');
+ checkUnresolvedTypeRef(findVariable('c').type, null, 'C');
+ }
+
+ test_cascaded_import_show_show() {
+ addNamedSource('/lib.dart', 'class A {} class B {} class C {}');
+ serializeLibraryText(
+ '''
+import 'lib.dart' show A, B show A, C;
+A a;
+B b;
+C c;
+ ''',
+ allowErrors: true);
+ checkTypeRef(findVariable('a').type, absUri('/lib.dart'), 'lib.dart', 'A');
+ checkUnresolvedTypeRef(findVariable('b').type, null, 'B');
+ checkUnresolvedTypeRef(findVariable('c').type, null, 'C');
+ }
+
test_class_abstract() {
UnlinkedClass cls = serializeClassText('abstract class C {}');
expect(cls.isAbstract, true);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698