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

Side by Side Diff: pkg/analyzer/test/generated/engine_test.dart

Issue 742273005: Annotate remaining analyzer/analysis server tests with "@ReflectiveTestCase()" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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) 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.engine_test; 8 library engine.engine_test;
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 runReflectiveTests(ResolveDartUnitTaskTest); 61 runReflectiveTests(ResolveDartUnitTaskTest);
62 runReflectiveTests(ResolveHtmlTaskTest); 62 runReflectiveTests(ResolveHtmlTaskTest);
63 runReflectiveTests(ScanDartTaskTest); 63 runReflectiveTests(ScanDartTaskTest);
64 runReflectiveTests(SdkCachePartitionTest); 64 runReflectiveTests(SdkCachePartitionTest);
65 runReflectiveTests(SourcesChangedEventTest); 65 runReflectiveTests(SourcesChangedEventTest);
66 runReflectiveTests(UniversalCachePartitionTest); 66 runReflectiveTests(UniversalCachePartitionTest);
67 runReflectiveTests(WorkManagerTest); 67 runReflectiveTests(WorkManagerTest);
68 } 68 }
69 69
70 70
71 @ReflectiveTestCase()
71 class AnalysisCacheTest extends EngineTestCase { 72 class AnalysisCacheTest extends EngineTestCase {
72 void test_creation() { 73 void test_creation() {
73 expect(new AnalysisCache(new List<CachePartition>(0)), isNotNull); 74 expect(new AnalysisCache(new List<CachePartition>(0)), isNotNull);
74 } 75 }
75 76
76 void test_get() { 77 void test_get() {
77 AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); 78 AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0));
78 TestSource source = new TestSource(); 79 TestSource source = new TestSource();
79 expect(cache.get(source), isNull); 80 expect(cache.get(source), isNull);
80 } 81 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 if (iterator.value.getState(DartEntry.PARSED_UNIT) != 144 if (iterator.value.getState(DartEntry.PARSED_UNIT) !=
144 CacheState.FLUSHED) { 145 CacheState.FLUSHED) {
145 nonFlushedCount++; 146 nonFlushedCount++;
146 } 147 }
147 } 148 }
148 expect(nonFlushedCount, expectedCount); 149 expect(nonFlushedCount, expectedCount);
149 } 150 }
150 } 151 }
151 152
152 153
154 @ReflectiveTestCase()
153 class AnalysisContextImplTest extends EngineTestCase { 155 class AnalysisContextImplTest extends EngineTestCase {
154 /** 156 /**
155 * An analysis context whose source factory is [sourceFactory]. 157 * An analysis context whose source factory is [sourceFactory].
156 */ 158 */
157 AnalysisContextImpl _context; 159 AnalysisContextImpl _context;
158 160
159 /** 161 /**
160 * The source factory associated with the analysis [context]. 162 * The source factory associated with the analysis [context].
161 */ 163 */
162 SourceFactory _sourceFactory; 164 SourceFactory _sourceFactory;
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 2096
2095 class AnalysisContextImplTest_Source_getModificationStamp_overridden extends 2097 class AnalysisContextImplTest_Source_getModificationStamp_overridden extends
2096 TestSource { 2098 TestSource {
2097 int stamp; 2099 int stamp;
2098 AnalysisContextImplTest_Source_getModificationStamp_overridden(this.stamp); 2100 AnalysisContextImplTest_Source_getModificationStamp_overridden(this.stamp);
2099 @override 2101 @override
2100 int get modificationStamp => stamp; 2102 int get modificationStamp => stamp;
2101 } 2103 }
2102 2104
2103 2105
2106 @ReflectiveTestCase()
2104 class AnalysisOptionsImplTest extends EngineTestCase { 2107 class AnalysisOptionsImplTest extends EngineTestCase {
2105 void test_AnalysisOptionsImpl_copy() { 2108 void test_AnalysisOptionsImpl_copy() {
2106 bool booleanValue = true; 2109 bool booleanValue = true;
2107 for (int i = 0; i < 2; i++, booleanValue = !booleanValue) { 2110 for (int i = 0; i < 2; i++, booleanValue = !booleanValue) {
2108 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); 2111 AnalysisOptionsImpl options = new AnalysisOptionsImpl();
2109 options.analyzeAngular = booleanValue; 2112 options.analyzeAngular = booleanValue;
2110 options.analyzeFunctionBodies = booleanValue; 2113 options.analyzeFunctionBodies = booleanValue;
2111 options.analyzePolymer = booleanValue; 2114 options.analyzePolymer = booleanValue;
2112 options.cacheSize = i; 2115 options.cacheSize = i;
2113 options.dart2jsHint = booleanValue; 2116 options.dart2jsHint = booleanValue;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 expect(exception, isNotNull); 2237 expect(exception, isNotNull);
2235 return null; 2238 return null;
2236 } 2239 }
2237 @override 2240 @override
2238 void internalPerform() { 2241 void internalPerform() {
2239 throw new AnalysisException("Forced exception"); 2242 throw new AnalysisException("Forced exception");
2240 } 2243 }
2241 } 2244 }
2242 2245
2243 2246
2247 @ReflectiveTestCase()
2244 class AnalysisTaskTest extends EngineTestCase { 2248 class AnalysisTaskTest extends EngineTestCase {
2245 void test_perform_exception() { 2249 void test_perform_exception() {
2246 InternalAnalysisContext context = new AnalysisContextImpl(); 2250 InternalAnalysisContext context = new AnalysisContextImpl();
2247 context.sourceFactory = new SourceFactory([new FileUriResolver()]); 2251 context.sourceFactory = new SourceFactory([new FileUriResolver()]);
2248 AnalysisTask task = new AnalysisTask_test_perform_exception(context); 2252 AnalysisTask task = new AnalysisTask_test_perform_exception(context);
2249 task.perform(new TestTaskVisitor<Object>()); 2253 task.perform(new TestTaskVisitor<Object>());
2250 } 2254 }
2251 } 2255 }
2252 2256
2253 2257
2254 class CompilationUnitMock extends TypedMock implements CompilationUnit { 2258 class CompilationUnitMock extends TypedMock implements CompilationUnit {
2255 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 2259 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
2256 } 2260 }
2257 2261
2258 2262
2263 @ReflectiveTestCase()
2259 class DartEntryTest extends EngineTestCase { 2264 class DartEntryTest extends EngineTestCase {
2260 void test_allErrors() { 2265 void test_allErrors() {
2261 Source source = new TestSource(); 2266 Source source = new TestSource();
2262 DartEntry entry = new DartEntry(); 2267 DartEntry entry = new DartEntry();
2263 expect(entry.allErrors, hasLength(0)); 2268 expect(entry.allErrors, hasLength(0));
2264 entry.setValue( 2269 entry.setValue(
2265 DartEntry.SCAN_ERRORS, 2270 DartEntry.SCAN_ERRORS,
2266 <AnalysisError>[ 2271 <AnalysisError>[
2267 new AnalysisError.con1(source, ScannerErrorCode.UNTERMINATED_STRING_ LITERAL)]); 2272 new AnalysisError.con1(source, ScannerErrorCode.UNTERMINATED_STRING_ LITERAL)]);
2268 entry.setValue( 2273 entry.setValue(
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 DartEntry entry = new DartEntry(); 3758 DartEntry entry = new DartEntry();
3754 Object value = entry.getValueInLibrary(descriptor, source); 3759 Object value = entry.getValueInLibrary(descriptor, source);
3755 expect(newValue, isNot(same(value))); 3760 expect(newValue, isNot(same(value)));
3756 entry.setValueInLibrary(descriptor, source, newValue); 3761 entry.setValueInLibrary(descriptor, source, newValue);
3757 expect(entry.getStateInLibrary(descriptor, source), same(CacheState.VALID)); 3762 expect(entry.getStateInLibrary(descriptor, source), same(CacheState.VALID));
3758 expect(entry.getValueInLibrary(descriptor, source), same(newValue)); 3763 expect(entry.getValueInLibrary(descriptor, source), same(newValue));
3759 } 3764 }
3760 } 3765 }
3761 3766
3762 3767
3768 @ReflectiveTestCase()
3763 class GenerateDartErrorsTaskTest extends EngineTestCase { 3769 class GenerateDartErrorsTaskTest extends EngineTestCase {
3764 void test_accept() { 3770 void test_accept() {
3765 GenerateDartErrorsTask task = 3771 GenerateDartErrorsTask task =
3766 new GenerateDartErrorsTask(null, null, null, null); 3772 new GenerateDartErrorsTask(null, null, null, null);
3767 expect(task.accept(new GenerateDartErrorsTaskTestTV_accept()), isTrue); 3773 expect(task.accept(new GenerateDartErrorsTaskTestTV_accept()), isTrue);
3768 } 3774 }
3769 3775
3770 void test_getException() { 3776 void test_getException() {
3771 GenerateDartErrorsTask task = 3777 GenerateDartErrorsTask task =
3772 new GenerateDartErrorsTask(null, null, null, null); 3778 new GenerateDartErrorsTask(null, null, null, null);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3880 } 3886 }
3881 expect(task.libraryElement, same(libraryElement)); 3887 expect(task.libraryElement, same(libraryElement));
3882 expect(task.source, same(source)); 3888 expect(task.source, same(source));
3883 List<AnalysisError> errors = task.errors; 3889 List<AnalysisError> errors = task.errors;
3884 expect(errors, hasLength(1)); 3890 expect(errors, hasLength(1));
3885 expect(errors[0].errorCode, same(CompileTimeErrorCode.URI_DOES_NOT_EXIST)); 3891 expect(errors[0].errorCode, same(CompileTimeErrorCode.URI_DOES_NOT_EXIST));
3886 return true; 3892 return true;
3887 } 3893 }
3888 } 3894 }
3889 3895
3896 @ReflectiveTestCase()
3890 class GenerateDartHintsTaskTest extends EngineTestCase { 3897 class GenerateDartHintsTaskTest extends EngineTestCase {
3891 void test_accept() { 3898 void test_accept() {
3892 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); 3899 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null);
3893 expect(task.accept(new GenerateDartHintsTaskTestTV_accept()), isTrue); 3900 expect(task.accept(new GenerateDartHintsTaskTestTV_accept()), isTrue);
3894 } 3901 }
3895 void test_getException() { 3902 void test_getException() {
3896 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); 3903 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null);
3897 expect(task.exception, isNull); 3904 expect(task.exception, isNull);
3898 } 3905 }
3899 void test_getHintMap() { 3906 void test_getHintMap() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
3962 expect(task.libraryElement, isNotNull); 3969 expect(task.libraryElement, isNotNull);
3963 HashMap<Source, List<AnalysisError>> hintMap = task.hintMap; 3970 HashMap<Source, List<AnalysisError>> hintMap = task.hintMap;
3964 expect(hintMap, hasLength(2)); 3971 expect(hintMap, hasLength(2));
3965 expect(hintMap[librarySource], hasLength(1)); 3972 expect(hintMap[librarySource], hasLength(1));
3966 expect(hintMap[partSource], hasLength(0)); 3973 expect(hintMap[partSource], hasLength(0));
3967 return true; 3974 return true;
3968 } 3975 }
3969 } 3976 }
3970 3977
3971 3978
3979 @ReflectiveTestCase()
3972 class GetContentTaskTest extends EngineTestCase { 3980 class GetContentTaskTest extends EngineTestCase {
3973 void test_accept() { 3981 void test_accept() {
3974 Source source = new TestSource('/test.dart', ''); 3982 Source source = new TestSource('/test.dart', '');
3975 GetContentTask task = new GetContentTask(null, source); 3983 GetContentTask task = new GetContentTask(null, source);
3976 expect(task.accept(new GetContentTaskTestTV_accept()), isTrue); 3984 expect(task.accept(new GetContentTaskTestTV_accept()), isTrue);
3977 } 3985 }
3978 3986
3979 void test_getException() { 3987 void test_getException() {
3980 Source source = new TestSource('/test.dart', ''); 3988 Source source = new TestSource('/test.dart', '');
3981 GetContentTask task = new GetContentTask(null, source); 3989 GetContentTask task = new GetContentTask(null, source);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
4038 if (exception != null) { 4046 if (exception != null) {
4039 throw exception; 4047 throw exception;
4040 } 4048 }
4041 expect(task.modificationTime, context.getModificationStamp(source)); 4049 expect(task.modificationTime, context.getModificationStamp(source));
4042 expect(task.source, same(source)); 4050 expect(task.source, same(source));
4043 return true; 4051 return true;
4044 } 4052 }
4045 } 4053 }
4046 4054
4047 4055
4056 @ReflectiveTestCase()
4048 class HtmlEntryTest extends EngineTestCase { 4057 class HtmlEntryTest extends EngineTestCase {
4049 void set state(DataDescriptor descriptor) { 4058 void set state(DataDescriptor descriptor) {
4050 HtmlEntry entry = new HtmlEntry(); 4059 HtmlEntry entry = new HtmlEntry();
4051 expect(entry.getState(descriptor), isNot(same(CacheState.FLUSHED))); 4060 expect(entry.getState(descriptor), isNot(same(CacheState.FLUSHED)));
4052 entry.setState(descriptor, CacheState.FLUSHED); 4061 entry.setState(descriptor, CacheState.FLUSHED);
4053 expect(entry.getState(descriptor), same(CacheState.FLUSHED)); 4062 expect(entry.getState(descriptor), same(CacheState.FLUSHED));
4054 } 4063 }
4055 4064
4056 void test_creation() { 4065 void test_creation() {
4057 HtmlEntry entry = new HtmlEntry(); 4066 HtmlEntry entry = new HtmlEntry();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4287 HtmlEntry entry = new HtmlEntry(); 4296 HtmlEntry entry = new HtmlEntry();
4288 Object value = entry.getValue(descriptor); 4297 Object value = entry.getValue(descriptor);
4289 expect(newValue, isNot(same(value))); 4298 expect(newValue, isNot(same(value)));
4290 entry.setValue(descriptor, newValue); 4299 entry.setValue(descriptor, newValue);
4291 expect(entry.getState(descriptor), same(CacheState.VALID)); 4300 expect(entry.getState(descriptor), same(CacheState.VALID));
4292 expect(entry.getValue(descriptor), same(newValue)); 4301 expect(entry.getValue(descriptor), same(newValue));
4293 } 4302 }
4294 } 4303 }
4295 4304
4296 4305
4306 @ReflectiveTestCase()
4297 class IncrementalAnalysisCacheTest { 4307 class IncrementalAnalysisCacheTest {
4298 Source _source = new TestSource(); 4308 Source _source = new TestSource();
4299 DartEntry _entry = new DartEntry(); 4309 DartEntry _entry = new DartEntry();
4300 CompilationUnit _unit = new CompilationUnitMock(); 4310 CompilationUnit _unit = new CompilationUnitMock();
4301 IncrementalAnalysisCache _result; 4311 IncrementalAnalysisCache _result;
4302 void setUp() { 4312 void setUp() {
4303 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, _unit); 4313 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, _unit);
4304 } 4314 }
4305 void test_cacheResult() { 4315 void test_cacheResult() {
4306 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( 4316 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
4812 _source, 4822 _source,
4813 new CharSequenceReader(code), 4823 new CharSequenceReader(code),
4814 AnalysisErrorListener.NULL_LISTENER); 4824 AnalysisErrorListener.NULL_LISTENER);
4815 Parser parser = new Parser(_source, AnalysisErrorListener.NULL_LISTENER); 4825 Parser parser = new Parser(_source, AnalysisErrorListener.NULL_LISTENER);
4816 return parser.parseCompilationUnit(scanner.tokenize()); 4826 return parser.parseCompilationUnit(scanner.tokenize());
4817 } 4827 }
4818 } 4828 }
4819 4829
4820 4830
4821 4831
4832 @ReflectiveTestCase()
4822 class IncrementalAnalysisTaskTest extends EngineTestCase { 4833 class IncrementalAnalysisTaskTest extends EngineTestCase {
4823 void test_accept() { 4834 void test_accept() {
4824 IncrementalAnalysisTask task = new IncrementalAnalysisTask(null, null); 4835 IncrementalAnalysisTask task = new IncrementalAnalysisTask(null, null);
4825 expect(task.accept(new IncrementalAnalysisTaskTestTV_accept()), isTrue); 4836 expect(task.accept(new IncrementalAnalysisTaskTestTV_accept()), isTrue);
4826 } 4837 }
4827 4838
4828 void test_perform() { 4839 void test_perform() {
4829 // main() {} String foo; 4840 // main() {} String foo;
4830 // main() {String} String foo; 4841 // main() {String} String foo;
4831 CompilationUnit newUnit = 4842 CompilationUnit newUnit =
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4887 TestTaskVisitor<CompilationUnit> { 4898 TestTaskVisitor<CompilationUnit> {
4888 IncrementalAnalysisTask task; 4899 IncrementalAnalysisTask task;
4889 IncrementalAnalysisTaskTestTV_assertTask(this.task); 4900 IncrementalAnalysisTaskTestTV_assertTask(this.task);
4890 @override 4901 @override
4891 CompilationUnit 4902 CompilationUnit
4892 visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTa sk) => 4903 visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTa sk) =>
4893 task.compilationUnit; 4904 task.compilationUnit;
4894 } 4905 }
4895 4906
4896 4907
4908 @ReflectiveTestCase()
4897 class InstrumentedAnalysisContextImplTest extends EngineTestCase { 4909 class InstrumentedAnalysisContextImplTest extends EngineTestCase {
4898 void test_addSourceInfo() { 4910 void test_addSourceInfo() {
4899 TestAnalysisContext_test_addSourceInfo innerContext = 4911 TestAnalysisContext_test_addSourceInfo innerContext =
4900 new TestAnalysisContext_test_addSourceInfo(); 4912 new TestAnalysisContext_test_addSourceInfo();
4901 InstrumentedAnalysisContextImpl context = 4913 InstrumentedAnalysisContextImpl context =
4902 new InstrumentedAnalysisContextImpl.con1(innerContext); 4914 new InstrumentedAnalysisContextImpl.con1(innerContext);
4903 context.addSourceInfo(null, null); 4915 context.addSourceInfo(null, null);
4904 expect(innerContext.invoked, isTrue); 4916 expect(innerContext.invoked, isTrue);
4905 } 4917 }
4906 4918
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
5397 TestAnalysisContext_test_setSourceFactory innerContext = 5409 TestAnalysisContext_test_setSourceFactory innerContext =
5398 new TestAnalysisContext_test_setSourceFactory(); 5410 new TestAnalysisContext_test_setSourceFactory();
5399 InstrumentedAnalysisContextImpl context = 5411 InstrumentedAnalysisContextImpl context =
5400 new InstrumentedAnalysisContextImpl.con1(innerContext); 5412 new InstrumentedAnalysisContextImpl.con1(innerContext);
5401 context.sourceFactory = null; 5413 context.sourceFactory = null;
5402 expect(innerContext.invoked, isTrue); 5414 expect(innerContext.invoked, isTrue);
5403 } 5415 }
5404 } 5416 }
5405 5417
5406 5418
5419 @ReflectiveTestCase()
5407 class ParseDartTaskTest extends EngineTestCase { 5420 class ParseDartTaskTest extends EngineTestCase {
5408 void test_accept() { 5421 void test_accept() {
5409 ParseDartTask task = new ParseDartTask(null, null, null, null); 5422 ParseDartTask task = new ParseDartTask(null, null, null, null);
5410 expect(task.accept(new ParseDartTaskTestTV_accept()), isTrue); 5423 expect(task.accept(new ParseDartTaskTestTV_accept()), isTrue);
5411 } 5424 }
5412 5425
5413 void test_getCompilationUnit() { 5426 void test_getCompilationUnit() {
5414 ParseDartTask task = new ParseDartTask(null, null, null, null); 5427 ParseDartTask task = new ParseDartTask(null, null, null, null);
5415 expect(task.compilationUnit, isNull); 5428 expect(task.compilationUnit, isNull);
5416 } 5429 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
5594 CompileTimeErrorCode.URI_WITH_INTERPOLATION, 5607 CompileTimeErrorCode.URI_WITH_INTERPOLATION,
5595 CompileTimeErrorCode.INVALID_URI]); 5608 CompileTimeErrorCode.INVALID_URI]);
5596 expect(task.source, same(source)); 5609 expect(task.source, same(source));
5597 expect(task.hasNonPartOfDirective, isTrue); 5610 expect(task.hasNonPartOfDirective, isTrue);
5598 expect(task.hasPartOfDirective, isFalse); 5611 expect(task.hasPartOfDirective, isFalse);
5599 return null; 5612 return null;
5600 } 5613 }
5601 } 5614 }
5602 5615
5603 5616
5617 @ReflectiveTestCase()
5604 class ParseHtmlTaskTest extends EngineTestCase { 5618 class ParseHtmlTaskTest extends EngineTestCase {
5605 ParseHtmlTask parseContents(String contents, TestLogger testLogger) { 5619 ParseHtmlTask parseContents(String contents, TestLogger testLogger) {
5606 return parseSource( 5620 return parseSource(
5607 new TestSource('/test.dart', contents), 5621 new TestSource('/test.dart', contents),
5608 contents, 5622 contents,
5609 testLogger); 5623 testLogger);
5610 } 5624 }
5611 5625
5612 ParseHtmlTask parseSource(Source source, String contents, 5626 ParseHtmlTask parseSource(Source source, String contents,
5613 TestLogger testLogger) { 5627 TestLogger testLogger) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
5777 throw exception; 5791 throw exception;
5778 } 5792 }
5779 expect(task.htmlUnit, isNotNull); 5793 expect(task.htmlUnit, isNotNull);
5780 expect(task.lineInfo, isNotNull); 5794 expect(task.lineInfo, isNotNull);
5781 expect(task.source, same(source)); 5795 expect(task.source, same(source));
5782 return true; 5796 return true;
5783 } 5797 }
5784 } 5798 }
5785 5799
5786 5800
5801 @ReflectiveTestCase()
5787 class PartitionManagerTest extends EngineTestCase { 5802 class PartitionManagerTest extends EngineTestCase {
5788 void test_clearCache() { 5803 void test_clearCache() {
5789 PartitionManager manager = new PartitionManager(); 5804 PartitionManager manager = new PartitionManager();
5790 DartSdk sdk = new MockDartSdk(); 5805 DartSdk sdk = new MockDartSdk();
5791 SdkCachePartition oldPartition = manager.forSdk(sdk); 5806 SdkCachePartition oldPartition = manager.forSdk(sdk);
5792 manager.clearCache(); 5807 manager.clearCache();
5793 SdkCachePartition newPartition = manager.forSdk(sdk); 5808 SdkCachePartition newPartition = manager.forSdk(sdk);
5794 expect(newPartition, isNot(same(oldPartition))); 5809 expect(newPartition, isNot(same(oldPartition)));
5795 } 5810 }
5796 5811
5797 void test_creation() { 5812 void test_creation() {
5798 expect(new PartitionManager(), isNotNull); 5813 expect(new PartitionManager(), isNotNull);
5799 } 5814 }
5800 5815
5801 void test_forSdk() { 5816 void test_forSdk() {
5802 PartitionManager manager = new PartitionManager(); 5817 PartitionManager manager = new PartitionManager();
5803 DartSdk sdk1 = new MockDartSdk(); 5818 DartSdk sdk1 = new MockDartSdk();
5804 SdkCachePartition partition1 = manager.forSdk(sdk1); 5819 SdkCachePartition partition1 = manager.forSdk(sdk1);
5805 expect(partition1, isNotNull); 5820 expect(partition1, isNotNull);
5806 expect(manager.forSdk(sdk1), same(partition1)); 5821 expect(manager.forSdk(sdk1), same(partition1));
5807 DartSdk sdk2 = new MockDartSdk(); 5822 DartSdk sdk2 = new MockDartSdk();
5808 SdkCachePartition partition2 = manager.forSdk(sdk2); 5823 SdkCachePartition partition2 = manager.forSdk(sdk2);
5809 expect(partition2, isNotNull); 5824 expect(partition2, isNotNull);
5810 expect(manager.forSdk(sdk2), same(partition2)); 5825 expect(manager.forSdk(sdk2), same(partition2));
5811 expect(partition2, isNot(same(partition1))); 5826 expect(partition2, isNot(same(partition1)));
5812 } 5827 }
5813 } 5828 }
5814 5829
5815 5830
5831 @ReflectiveTestCase()
5816 class ResolveDartLibraryTaskTest extends EngineTestCase { 5832 class ResolveDartLibraryTaskTest extends EngineTestCase {
5817 void test_accept() { 5833 void test_accept() {
5818 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); 5834 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null);
5819 expect(task.accept(new ResolveDartLibraryTaskTestTV_accept()), isTrue); 5835 expect(task.accept(new ResolveDartLibraryTaskTestTV_accept()), isTrue);
5820 } 5836 }
5821 void test_getException() { 5837 void test_getException() {
5822 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); 5838 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null);
5823 expect(task.exception, isNull); 5839 expect(task.exception, isNull);
5824 } 5840 }
5825 void test_getLibraryResolver() { 5841 void test_getLibraryResolver() {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5886 throw exception; 5902 throw exception;
5887 } 5903 }
5888 expect(task.libraryResolver, isNotNull); 5904 expect(task.libraryResolver, isNotNull);
5889 expect(task.librarySource, same(source)); 5905 expect(task.librarySource, same(source));
5890 expect(task.unitSource, same(source)); 5906 expect(task.unitSource, same(source));
5891 return true; 5907 return true;
5892 } 5908 }
5893 } 5909 }
5894 5910
5895 5911
5912 @ReflectiveTestCase()
5896 class ResolveDartUnitTaskTest extends EngineTestCase { 5913 class ResolveDartUnitTaskTest extends EngineTestCase {
5897 void test_accept() { 5914 void test_accept() {
5898 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); 5915 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null);
5899 expect(task.accept(new ResolveDartUnitTaskTestTV_accept()), isTrue); 5916 expect(task.accept(new ResolveDartUnitTaskTestTV_accept()), isTrue);
5900 } 5917 }
5901 5918
5902 void test_getException() { 5919 void test_getException() {
5903 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); 5920 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null);
5904 expect(task.exception, isNull); 5921 expect(task.exception, isNull);
5905 } 5922 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
5986 throw exception; 6003 throw exception;
5987 } 6004 }
5988 expect(task.librarySource, same(source)); 6005 expect(task.librarySource, same(source));
5989 expect(task.resolvedUnit, isNotNull); 6006 expect(task.resolvedUnit, isNotNull);
5990 expect(task.source, same(source)); 6007 expect(task.source, same(source));
5991 return true; 6008 return true;
5992 } 6009 }
5993 } 6010 }
5994 6011
5995 6012
6013 @ReflectiveTestCase()
5996 class ResolveHtmlTaskTest extends EngineTestCase { 6014 class ResolveHtmlTaskTest extends EngineTestCase {
5997 void test_accept() { 6015 void test_accept() {
5998 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); 6016 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null);
5999 expect(task.accept(new ResolveHtmlTaskTestTV_accept()), isTrue); 6017 expect(task.accept(new ResolveHtmlTaskTestTV_accept()), isTrue);
6000 } 6018 }
6001 6019
6002 void test_getElement() { 6020 void test_getElement() {
6003 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); 6021 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null);
6004 expect(task.element, isNull); 6022 expect(task.element, isNull);
6005 } 6023 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
6084 } 6102 }
6085 } 6103 }
6086 6104
6087 6105
6088 class ResolveHtmlTaskTestTV_perform_valid_2 extends TestTaskVisitor<Object> { 6106 class ResolveHtmlTaskTestTV_perform_valid_2 extends TestTaskVisitor<Object> {
6089 @override 6107 @override
6090 Object visitParseHtmlTask(ParseHtmlTask task) => null; 6108 Object visitParseHtmlTask(ParseHtmlTask task) => null;
6091 } 6109 }
6092 6110
6093 6111
6112 @ReflectiveTestCase()
6094 class ScanDartTaskTest extends EngineTestCase { 6113 class ScanDartTaskTest extends EngineTestCase {
6095 void test_accept() { 6114 void test_accept() {
6096 ScanDartTask task = new ScanDartTask(null, null, null); 6115 ScanDartTask task = new ScanDartTask(null, null, null);
6097 expect(task.accept(new ScanDartTaskTestTV_accept()), isTrue); 6116 expect(task.accept(new ScanDartTaskTestTV_accept()), isTrue);
6098 } 6117 }
6099 6118
6100 void test_getErrors() { 6119 void test_getErrors() {
6101 ScanDartTask task = new ScanDartTask(null, null, null); 6120 ScanDartTask task = new ScanDartTask(null, null, null);
6102 expect(task.errors, hasLength(0)); 6121 expect(task.errors, hasLength(0));
6103 } 6122 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
6147 } 6166 }
6148 expect(task.tokenStream, isNotNull); 6167 expect(task.tokenStream, isNotNull);
6149 expect(task.errors, hasLength(0)); 6168 expect(task.errors, hasLength(0));
6150 expect(task.lineInfo, isNotNull); 6169 expect(task.lineInfo, isNotNull);
6151 expect(task.source, same(source)); 6170 expect(task.source, same(source));
6152 return true; 6171 return true;
6153 } 6172 }
6154 } 6173 }
6155 6174
6156 6175
6176 @ReflectiveTestCase()
6157 class SdkCachePartitionTest extends EngineTestCase { 6177 class SdkCachePartitionTest extends EngineTestCase {
6158 void test_contains_false() { 6178 void test_contains_false() {
6159 SdkCachePartition partition = new SdkCachePartition(null, 8); 6179 SdkCachePartition partition = new SdkCachePartition(null, 8);
6160 Source source = new TestSource(); 6180 Source source = new TestSource();
6161 expect(partition.contains(source), isFalse); 6181 expect(partition.contains(source), isFalse);
6162 } 6182 }
6163 6183
6164 void test_contains_true() { 6184 void test_contains_true() {
6165 SdkCachePartition partition = new SdkCachePartition(null, 8); 6185 SdkCachePartition partition = new SdkCachePartition(null, 8);
6166 SourceFactory factory = 6186 SourceFactory factory =
6167 new SourceFactory([new DartUriResolver(DirectoryBasedDartSdk.defaultSdk) ]); 6187 new SourceFactory([new DartUriResolver(DirectoryBasedDartSdk.defaultSdk) ]);
6168 Source source = factory.forUri("dart:core"); 6188 Source source = factory.forUri("dart:core");
6169 expect(partition.contains(source), isTrue); 6189 expect(partition.contains(source), isTrue);
6170 } 6190 }
6171 6191
6172 void test_creation() { 6192 void test_creation() {
6173 expect(new SdkCachePartition(null, 8), isNotNull); 6193 expect(new SdkCachePartition(null, 8), isNotNull);
6174 } 6194 }
6175 } 6195 }
6176 6196
6177 6197
6198 @ReflectiveTestCase()
6178 class SourcesChangedEventTest { 6199 class SourcesChangedEventTest {
6179 6200
6180 void test_added() { 6201 void test_added() {
6181 var source = new StringSource('', '/test.dart'); 6202 var source = new StringSource('', '/test.dart');
6182 var changeSet = new ChangeSet(); 6203 var changeSet = new ChangeSet();
6183 changeSet.addedSource(source); 6204 changeSet.addedSource(source);
6184 var event = new SourcesChangedEvent(changeSet); 6205 var event = new SourcesChangedEvent(changeSet);
6185 assertEvent(event, wereSourcesAdded: true); 6206 assertEvent(event, wereSourcesAdded: true);
6186 } 6207 }
6187 6208
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
7306 return null; 7327 return null;
7307 } 7328 }
7308 @override 7329 @override
7309 E visitScanDartTask(ScanDartTask task) { 7330 E visitScanDartTask(ScanDartTask task) {
7310 fail("Unexpectedly invoked visitScanDartTask"); 7331 fail("Unexpectedly invoked visitScanDartTask");
7311 return null; 7332 return null;
7312 } 7333 }
7313 } 7334 }
7314 7335
7315 7336
7337 @ReflectiveTestCase()
7316 class UniversalCachePartitionTest extends EngineTestCase { 7338 class UniversalCachePartitionTest extends EngineTestCase {
7317 void test_contains() { 7339 void test_contains() {
7318 UniversalCachePartition partition = 7340 UniversalCachePartition partition =
7319 new UniversalCachePartition(null, 8, null); 7341 new UniversalCachePartition(null, 8, null);
7320 TestSource source = new TestSource(); 7342 TestSource source = new TestSource();
7321 expect(partition.contains(source), isTrue); 7343 expect(partition.contains(source), isTrue);
7322 } 7344 }
7323 void test_creation() { 7345 void test_creation() {
7324 expect(new UniversalCachePartition(null, 8, null), isNotNull); 7346 expect(new UniversalCachePartition(null, 8, null), isNotNull);
7325 } 7347 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
7395 entryMap.values.forEach((SourceEntry value) { 7417 entryMap.values.forEach((SourceEntry value) {
7396 if (value.getState(DartEntry.PARSED_UNIT) != CacheState.FLUSHED) { 7418 if (value.getState(DartEntry.PARSED_UNIT) != CacheState.FLUSHED) {
7397 nonFlushedCount++; 7419 nonFlushedCount++;
7398 } 7420 }
7399 }); 7421 });
7400 expect(nonFlushedCount, expectedCount); 7422 expect(nonFlushedCount, expectedCount);
7401 } 7423 }
7402 } 7424 }
7403 7425
7404 7426
7427 @ReflectiveTestCase()
7405 class WorkManagerTest extends EngineTestCase { 7428 class WorkManagerTest extends EngineTestCase {
7406 void test_addFirst() { 7429 void test_addFirst() {
7407 TestSource source1 = new TestSource("/f1.dart"); 7430 TestSource source1 = new TestSource("/f1.dart");
7408 TestSource source2 = new TestSource("/f2.dart"); 7431 TestSource source2 = new TestSource("/f2.dart");
7409 WorkManager manager = new WorkManager(); 7432 WorkManager manager = new WorkManager();
7410 manager.add(source1, SourcePriority.UNKNOWN); 7433 manager.add(source1, SourcePriority.UNKNOWN);
7411 manager.addFirst(source2, SourcePriority.UNKNOWN); 7434 manager.addFirst(source2, SourcePriority.UNKNOWN);
7412 WorkManager_WorkIterator iterator = manager.iterator(); 7435 WorkManager_WorkIterator iterator = manager.iterator();
7413 expect(iterator.next(), same(source2)); 7436 expect(iterator.next(), same(source2));
7414 expect(iterator.next(), same(source1)); 7437 expect(iterator.next(), same(source1));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
7490 bool contains(Source source) => source == libB; 7513 bool contains(Source source) => source == libB;
7491 } 7514 }
7492 7515
7493 7516
7494 class _UniversalCachePartitionTest_test_setMaxCacheSize implements 7517 class _UniversalCachePartitionTest_test_setMaxCacheSize implements
7495 CacheRetentionPolicy { 7518 CacheRetentionPolicy {
7496 @override 7519 @override
7497 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 7520 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
7498 RetentionPriority.LOW; 7521 RetentionPriority.LOW;
7499 } 7522 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/element_test.dart ('k') | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698