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

Side by Side 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, 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/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | 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 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 expect(_context.getKindOf(source), same(SourceKind.UNKNOWN)); 1936 expect(_context.getKindOf(source), same(SourceKind.UNKNOWN));
1937 _context.computeKindOf(source); 1937 _context.computeKindOf(source);
1938 expect(_context.getKindOf(source), same(SourceKind.PART)); 1938 expect(_context.getKindOf(source), same(SourceKind.PART));
1939 } 1939 }
1940 1940
1941 void test_getKindOf_unknown() { 1941 void test_getKindOf_unknown() {
1942 Source source = _addSource("/test.css", ""); 1942 Source source = _addSource("/test.css", "");
1943 expect(_context.getKindOf(source), same(SourceKind.UNKNOWN)); 1943 expect(_context.getKindOf(source), same(SourceKind.UNKNOWN));
1944 } 1944 }
1945 1945
1946 void test_getLaunchableClientLibrarySources() { 1946 void test_getLaunchableClientLibrarySources_doesNotImportHtml() {
1947 _context = contextWithCore();
1948 _sourceFactory = _context.sourceFactory;
1949 Source source = _addSource("/test.dart", r'''
1950 main() {}''');
1951 _context.computeLibraryElement(source);
1952 List<Source> sources = _context.launchableClientLibrarySources;
1953 expect(sources, isEmpty);
1954 }
1955
1956 void test_getLaunchableClientLibrarySources_importsHtml_explicitly() {
1947 _context = contextWithCore(); 1957 _context = contextWithCore();
1948 _sourceFactory = _context.sourceFactory; 1958 _sourceFactory = _context.sourceFactory;
1949 List<Source> sources = _context.launchableClientLibrarySources; 1959 List<Source> sources = _context.launchableClientLibrarySources;
1950 expect(sources, hasLength(0)); 1960 expect(sources, isEmpty);
1951 Source source = _addSource("/test.dart", r''' 1961 Source source = _addSource("/test.dart", r'''
1952 import 'dart:html'; 1962 import 'dart:html';
1953 main() {}'''); 1963 main() {}''');
1954 _context.computeLibraryElement(source); 1964 _context.computeLibraryElement(source);
1955 sources = _context.launchableClientLibrarySources; 1965 sources = _context.launchableClientLibrarySources;
1956 expect(sources, hasLength(1)); 1966 expect(sources, unorderedEquals([source]));
1967 }
1968
1969 void test_getLaunchableClientLibrarySources_importsHtml_implicitly() {
1970 _context = contextWithCore();
1971 _sourceFactory = _context.sourceFactory;
1972 List<Source> sources = _context.launchableClientLibrarySources;
1973 expect(sources, isEmpty);
1974 _addSource("/a.dart", r'''
1975 import 'dart:html';
1976 ''');
1977 Source source = _addSource("/test.dart", r'''
1978 import 'a.dart';
1979 main() {}''');
1980 _context.computeLibraryElement(source);
1981 sources = _context.launchableClientLibrarySources;
1982 expect(sources, unorderedEquals([source]));
1983 }
1984
1985 void test_getLaunchableClientLibrarySources_importsHtml_implicitly2() {
1986 _context = contextWithCore();
1987 _sourceFactory = _context.sourceFactory;
1988 List<Source> sources = _context.launchableClientLibrarySources;
1989 expect(sources, isEmpty);
1990 _addSource("/a.dart", r'''
1991 export 'dart:html';
1992 ''');
1993 Source source = _addSource("/test.dart", r'''
1994 import 'a.dart';
1995 main() {}''');
1996 _context.computeLibraryElement(source);
1997 sources = _context.launchableClientLibrarySources;
1998 expect(sources, unorderedEquals([source]));
1957 } 1999 }
1958 2000
1959 void test_getLaunchableServerLibrarySources() { 2001 void test_getLaunchableServerLibrarySources() {
1960 _context = contextWithCore(); 2002 _context = contextWithCore();
1961 _sourceFactory = _context.sourceFactory; 2003 _sourceFactory = _context.sourceFactory;
1962 List<Source> sources = _context.launchableServerLibrarySources; 2004 List<Source> sources = _context.launchableServerLibrarySources;
1963 expect(sources, hasLength(0)); 2005 expect(sources, hasLength(0));
1964 Source source = _addSource("/test.dart", "main() {}"); 2006 Source source = _addSource("/test.dart", "main() {}");
1965 _context.computeLibraryElement(source); 2007 _context.computeLibraryElement(source);
1966 sources = _context.launchableServerLibrarySources; 2008 sources = _context.launchableServerLibrarySources;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 : super(name, UriKind.FILE_URI); 2503 : super(name, UriKind.FILE_URI);
2462 2504
2463 @override 2505 @override
2464 TimestampedData<String> get contents { 2506 TimestampedData<String> get contents {
2465 throw 'Read error'; 2507 throw 'Read error';
2466 } 2508 }
2467 2509
2468 @override 2510 @override
2469 bool exists() => true; 2511 bool exists() => true;
2470 } 2512 }
OLDNEW
« 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