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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1053673008: Initial re-write of analysis context for the new task model (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.task.dart_test; 5 library test.src.task.dart_test;
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 expect(task, new isInstanceOf<BuildClassConstructorsTask>()); 156 expect(task, new isInstanceOf<BuildClassConstructorsTask>());
157 _fillErrorListener(CONSTRUCTORS_ERRORS); 157 _fillErrorListener(CONSTRUCTORS_ERRORS);
158 errorListener.assertErrorsWithCodes( 158 errorListener.assertErrorsWithCodes(
159 <ErrorCode>[CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]); 159 <ErrorCode>[CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
160 } 160 }
161 } 161 }
162 162
163 @reflectiveTest 163 @reflectiveTest
164 class BuildCompilationUnitElementTaskTest extends _AbstractDartTaskTest { 164 class BuildCompilationUnitElementTaskTest extends _AbstractDartTaskTest {
165 test_buildInputs() { 165 test_buildInputs() {
166 LibrarySpecificUnit target = new LibrarySpecificUnit(emptySource, emptySourc e); 166 LibrarySpecificUnit target =
167 new LibrarySpecificUnit(emptySource, emptySource);
167 Map<String, TaskInput> inputs = 168 Map<String, TaskInput> inputs =
168 BuildCompilationUnitElementTask.buildInputs(target); 169 BuildCompilationUnitElementTask.buildInputs(target);
169 expect(inputs, isNotNull); 170 expect(inputs, isNotNull);
170 expect(inputs.keys, unorderedEquals( 171 expect(inputs.keys, unorderedEquals(
171 [BuildCompilationUnitElementTask.PARSED_UNIT_INPUT_NAME])); 172 [BuildCompilationUnitElementTask.PARSED_UNIT_INPUT_NAME]));
172 } 173 }
173 174
174 test_constructor() { 175 test_constructor() {
175 BuildCompilationUnitElementTask task = 176 BuildCompilationUnitElementTask task =
176 new BuildCompilationUnitElementTask(context, emptySource); 177 new BuildCompilationUnitElementTask(context, emptySource);
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 List<Source> sources = <Source>[]; 1904 List<Source> sources = <Source>[];
1904 sourceMap.forEach((String path, String content) { 1905 sourceMap.forEach((String path, String content) {
1905 File file = resourceProvider.newFile(path, content); 1906 File file = resourceProvider.newFile(path, content);
1906 Source source = file.createSource(); 1907 Source source = file.createSource();
1907 sources.add(source); 1908 sources.add(source);
1908 }); 1909 });
1909 return sources; 1910 return sources;
1910 } 1911 }
1911 } 1912 }
1912 1913
1913 class _MockContext extends TypedMock implements ExtendedAnalysisContext { 1914 class _MockContext extends TypedMock implements InternalAnalysisContext {
1914 AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl(); 1915 AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
1915 SourceFactory sourceFactory; 1916 SourceFactory sourceFactory;
1916 TypeProvider typeProvider; 1917 TypeProvider typeProvider;
1917 1918
1918 Map<AnalysisTarget, CacheEntry> entryMap = <AnalysisTarget, CacheEntry>{}; 1919 Map<AnalysisTarget, CacheEntry> entryMap = <AnalysisTarget, CacheEntry>{};
1919 1920
1920 String get name => '_MockContext'; 1921 String get name => '_MockContext';
1921 1922
1922 bool exists(Source source) => source.exists(); 1923 bool exists(Source source) => source.exists();
1923 1924
1924 @override 1925 @override
1925 CacheEntry getCacheEntry(AnalysisTarget target) { 1926 CacheEntry getCacheEntry(AnalysisTarget target) {
1926 return entryMap.putIfAbsent(target, () => new CacheEntry()); 1927 return entryMap.putIfAbsent(target, () => new CacheEntry());
1927 } 1928 }
1928 1929
1929 TimestampedData<String> getContents(Source source) => source.contents; 1930 TimestampedData<String> getContents(Source source) => source.contents;
1930 1931
1931 noSuchMethod(Invocation invocation) { 1932 noSuchMethod(Invocation invocation) {
1932 print('noSuchMethod: ${invocation.memberName}'); 1933 print('noSuchMethod: ${invocation.memberName}');
1933 return super.noSuchMethod(invocation); 1934 return super.noSuchMethod(invocation);
1934 } 1935 }
1935 } 1936 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698