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

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 1118963003: Fix for computing IS_CLIENT. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/context/context_test.dart
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index 8b449e31e5e2db5cc10c3fae919f41173e33d2e6..2395f81215dc7eed814b1738bdbeb2ecbd8e1e53 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -1943,17 +1943,59 @@ main() {}''');
expect(_context.getKindOf(source), same(SourceKind.UNKNOWN));
}
- void test_getLaunchableClientLibrarySources() {
+ void test_getLaunchableClientLibrarySources_doesNotImportHtml() {
_context = contextWithCore();
_sourceFactory = _context.sourceFactory;
+ Source source = _addSource("/test.dart", r'''
+main() {}''');
+ _context.computeLibraryElement(source);
List<Source> sources = _context.launchableClientLibrarySources;
- expect(sources, hasLength(0));
+ expect(sources, isEmpty);
+ }
+
+ void test_getLaunchableClientLibrarySources_importsHtml_explicitly() {
+ _context = contextWithCore();
+ _sourceFactory = _context.sourceFactory;
+ List<Source> sources = _context.launchableClientLibrarySources;
+ expect(sources, isEmpty);
Source source = _addSource("/test.dart", r'''
import 'dart:html';
main() {}''');
_context.computeLibraryElement(source);
sources = _context.launchableClientLibrarySources;
- expect(sources, hasLength(1));
+ expect(sources, unorderedEquals([source]));
+ }
+
+ void test_getLaunchableClientLibrarySources_importsHtml_implicitly() {
+ _context = contextWithCore();
+ _sourceFactory = _context.sourceFactory;
+ List<Source> sources = _context.launchableClientLibrarySources;
+ expect(sources, isEmpty);
+ _addSource("/a.dart", r'''
+import 'dart:html';
+''');
+ Source source = _addSource("/test.dart", r'''
+import 'a.dart';
+main() {}''');
+ _context.computeLibraryElement(source);
+ sources = _context.launchableClientLibrarySources;
+ expect(sources, unorderedEquals([source]));
+ }
+
+ void test_getLaunchableClientLibrarySources_importsHtml_implicitly2() {
+ _context = contextWithCore();
+ _sourceFactory = _context.sourceFactory;
+ List<Source> sources = _context.launchableClientLibrarySources;
+ expect(sources, isEmpty);
+ _addSource("/a.dart", r'''
+export 'dart:html';
+''');
+ Source source = _addSource("/test.dart", r'''
+import 'a.dart';
+main() {}''');
+ _context.computeLibraryElement(source);
+ sources = _context.launchableClientLibrarySources;
+ expect(sources, unorderedEquals([source]));
}
void test_getLaunchableServerLibrarySources() {
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698