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

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

Issue 1120973003: Finish AnalysisContext.getLaunchableServerLibrarySources implementation. (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/context/context.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/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 2395f81215dc7eed814b1738bdbeb2ecbd8e1e53..4d442e7c4eeb88e0e1e00a42cb751c36af1d225e 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -2001,12 +2001,42 @@ main() {}''');
void test_getLaunchableServerLibrarySources() {
_context = contextWithCore();
_sourceFactory = _context.sourceFactory;
- List<Source> sources = _context.launchableServerLibrarySources;
- expect(sources, hasLength(0));
+ expect(_context.launchableServerLibrarySources, isEmpty);
Source source = _addSource("/test.dart", "main() {}");
_context.computeLibraryElement(source);
- sources = _context.launchableServerLibrarySources;
- expect(sources, hasLength(1));
+ expect(_context.launchableServerLibrarySources, unorderedEquals([source]));
+ }
+
+ void test_getLaunchableServerLibrarySources_importsHtml_explicitly() {
+ _context = contextWithCore();
+ _sourceFactory = _context.sourceFactory;
+ Source source = _addSource("/test.dart", r'''
+import 'dart:html';
+main() {}
+''');
+ _context.computeLibraryElement(source);
+ expect(_context.launchableServerLibrarySources, isEmpty);
+ }
+
+ void test_getLaunchableServerLibrarySources_importsHtml_implicitly() {
+ _context = contextWithCore();
+ _sourceFactory = _context.sourceFactory;
+ _addSource("/imports_html.dart", r'''
+import 'dart:html';
+''');
+ Source source = _addSource("/test.dart", r'''
+import 'imports_html.dart';
+main() {}''');
+ _context.computeLibraryElement(source);
+ expect(_context.launchableServerLibrarySources, isEmpty);
+ }
+
+ void test_getLaunchableServerLibrarySources_noMain() {
+ _context = contextWithCore();
+ _sourceFactory = _context.sourceFactory;
+ Source source = _addSource("/test.dart", '');
+ _context.computeLibraryElement(source);
+ expect(_context.launchableServerLibrarySources, isEmpty);
}
void test_getLibrariesDependingOn() {
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698