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

Side by Side 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, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.src.context.context_test; 5 library test.src.context.context_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/src/cancelable_future.dart'; 10 import 'package:analyzer/src/cancelable_future.dart';
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 import 'a.dart'; 1994 import 'a.dart';
1995 main() {}'''); 1995 main() {}''');
1996 _context.computeLibraryElement(source); 1996 _context.computeLibraryElement(source);
1997 sources = _context.launchableClientLibrarySources; 1997 sources = _context.launchableClientLibrarySources;
1998 expect(sources, unorderedEquals([source])); 1998 expect(sources, unorderedEquals([source]));
1999 } 1999 }
2000 2000
2001 void test_getLaunchableServerLibrarySources() { 2001 void test_getLaunchableServerLibrarySources() {
2002 _context = contextWithCore(); 2002 _context = contextWithCore();
2003 _sourceFactory = _context.sourceFactory; 2003 _sourceFactory = _context.sourceFactory;
2004 List<Source> sources = _context.launchableServerLibrarySources; 2004 expect(_context.launchableServerLibrarySources, isEmpty);
2005 expect(sources, hasLength(0));
2006 Source source = _addSource("/test.dart", "main() {}"); 2005 Source source = _addSource("/test.dart", "main() {}");
2007 _context.computeLibraryElement(source); 2006 _context.computeLibraryElement(source);
2008 sources = _context.launchableServerLibrarySources; 2007 expect(_context.launchableServerLibrarySources, unorderedEquals([source]));
2009 expect(sources, hasLength(1)); 2008 }
2009
2010 void test_getLaunchableServerLibrarySources_importsHtml_explicitly() {
2011 _context = contextWithCore();
2012 _sourceFactory = _context.sourceFactory;
2013 Source source = _addSource("/test.dart", r'''
2014 import 'dart:html';
2015 main() {}
2016 ''');
2017 _context.computeLibraryElement(source);
2018 expect(_context.launchableServerLibrarySources, isEmpty);
2019 }
2020
2021 void test_getLaunchableServerLibrarySources_importsHtml_implicitly() {
2022 _context = contextWithCore();
2023 _sourceFactory = _context.sourceFactory;
2024 _addSource("/imports_html.dart", r'''
2025 import 'dart:html';
2026 ''');
2027 Source source = _addSource("/test.dart", r'''
2028 import 'imports_html.dart';
2029 main() {}''');
2030 _context.computeLibraryElement(source);
2031 expect(_context.launchableServerLibrarySources, isEmpty);
2032 }
2033
2034 void test_getLaunchableServerLibrarySources_noMain() {
2035 _context = contextWithCore();
2036 _sourceFactory = _context.sourceFactory;
2037 Source source = _addSource("/test.dart", '');
2038 _context.computeLibraryElement(source);
2039 expect(_context.launchableServerLibrarySources, isEmpty);
2010 } 2040 }
2011 2041
2012 void test_getLibrariesDependingOn() { 2042 void test_getLibrariesDependingOn() {
2013 _context = contextWithCore(); 2043 _context = contextWithCore();
2014 _sourceFactory = _context.sourceFactory; 2044 _sourceFactory = _context.sourceFactory;
2015 Source libASource = _addSource("/libA.dart", "library libA;"); 2045 Source libASource = _addSource("/libA.dart", "library libA;");
2016 _addSource("/libB.dart", "library libB;"); 2046 _addSource("/libB.dart", "library libB;");
2017 Source lib1Source = _addSource("/lib1.dart", r''' 2047 Source lib1Source = _addSource("/lib1.dart", r'''
2018 library lib1; 2048 library lib1;
2019 import 'libA.dart'; 2049 import 'libA.dart';
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 : super(name, UriKind.FILE_URI); 2533 : super(name, UriKind.FILE_URI);
2504 2534
2505 @override 2535 @override
2506 TimestampedData<String> get contents { 2536 TimestampedData<String> get contents {
2507 throw 'Read error'; 2537 throw 'Read error';
2508 } 2538 }
2509 2539
2510 @override 2540 @override
2511 bool exists() => true; 2541 bool exists() => true;
2512 } 2542 }
OLDNEW
« 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