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

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

Issue 661603004: Generalize source entry (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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/generated/engine.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 // 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:collection'; 10 import 'dart:collection';
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 536 }
537 } 537 }
538 538
539 void test_computeResolvableCompilationUnit_valid() { 539 void test_computeResolvableCompilationUnit_valid() {
540 Source source = _addSource("/lib.dart", "library lib;"); 540 Source source = _addSource("/lib.dart", "library lib;");
541 CompilationUnit parsedUnit = _context.parseCompilationUnit(source); 541 CompilationUnit parsedUnit = _context.parseCompilationUnit(source);
542 JUnitTestCase.assertNotNull(parsedUnit); 542 JUnitTestCase.assertNotNull(parsedUnit);
543 CompilationUnit resolvedUnit = 543 CompilationUnit resolvedUnit =
544 _context.computeResolvableCompilationUnit(source); 544 _context.computeResolvableCompilationUnit(source);
545 JUnitTestCase.assertNotNull(resolvedUnit); 545 JUnitTestCase.assertNotNull(resolvedUnit);
546 JUnitTestCase.assertNotSame(parsedUnit, resolvedUnit); 546 JUnitTestCase.assertSame(parsedUnit, resolvedUnit);
547 } 547 }
548 548
549 void test_dispose() { 549 void test_dispose() {
550 JUnitTestCase.assertFalse(_context.isDisposed); 550 JUnitTestCase.assertFalse(_context.isDisposed);
551 _context.dispose(); 551 _context.dispose();
552 JUnitTestCase.assertTrue(_context.isDisposed); 552 JUnitTestCase.assertTrue(_context.isDisposed);
553 } 553 }
554 554
555 void test_exists_false() { 555 void test_exists_false() {
556 TestSource source = new TestSource(); 556 TestSource source = new TestSource();
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE, [])]) ; 2193 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE, [])]) ;
2194 EngineTestCase.assertLength(5, entry.allErrors); 2194 EngineTestCase.assertLength(5, entry.allErrors);
2195 } 2195 }
2196 2196
2197 void test_getResolvableCompilationUnit_none() { 2197 void test_getResolvableCompilationUnit_none() {
2198 DartEntry entry = new DartEntry(); 2198 DartEntry entry = new DartEntry();
2199 JUnitTestCase.assertNull(entry.resolvableCompilationUnit); 2199 JUnitTestCase.assertNull(entry.resolvableCompilationUnit);
2200 } 2200 }
2201 2201
2202 void test_getResolvableCompilationUnit_parsed_accessed() { 2202 void test_getResolvableCompilationUnit_parsed_accessed() {
2203 String importUri = "f1.dart"; 2203 Source librarySource = new TestSource("/lib.dart");
2204 String importUri = "/f1.dart";
2204 Source importSource = new TestSource(importUri); 2205 Source importSource = new TestSource(importUri);
2205 ImportDirective importDirective = 2206 ImportDirective importDirective =
2206 AstFactory.importDirective3(importUri, null, []); 2207 AstFactory.importDirective3(importUri, null, []);
2207 importDirective.source = importSource; 2208 importDirective.source = importSource;
2208 importDirective.uriContent = importUri; 2209 importDirective.uriContent = importUri;
2209 String exportUri = "f2.dart"; 2210 String exportUri = "/f2.dart";
2210 Source exportSource = new TestSource(exportUri); 2211 Source exportSource = new TestSource(exportUri);
2211 ExportDirective exportDirective = 2212 ExportDirective exportDirective =
2212 AstFactory.exportDirective2(exportUri, []); 2213 AstFactory.exportDirective2(exportUri, []);
2213 exportDirective.source = exportSource; 2214 exportDirective.source = exportSource;
2214 exportDirective.uriContent = exportUri; 2215 exportDirective.uriContent = exportUri;
2215 String partUri = "f3.dart"; 2216 String partUri = "/f3.dart";
2216 Source partSource = new TestSource(partUri); 2217 Source partSource = new TestSource(partUri);
2217 PartDirective partDirective = AstFactory.partDirective2(partUri); 2218 PartDirective partDirective = AstFactory.partDirective2(partUri);
2218 partDirective.source = partSource; 2219 partDirective.source = partSource;
2219 partDirective.uriContent = partUri; 2220 partDirective.uriContent = partUri;
2220 CompilationUnit unit = 2221 CompilationUnit unit =
2221 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]); 2222 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]);
2222 DartEntry entry = new DartEntry(); 2223 DartEntry entry = new DartEntry();
2223 entry.setValue(DartEntry.PARSED_UNIT, unit); 2224 entry.setValue(DartEntry.PARSED_UNIT, unit);
2224 entry.getValue(DartEntry.PARSED_UNIT); 2225 entry.getValue(DartEntry.PARSED_UNIT);
2225 CompilationUnit result = entry.resolvableCompilationUnit; 2226 CompilationUnit result = entry.resolvableCompilationUnit;
2227 JUnitTestCase.assertSame(unit, result);
2228 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource, unit);
2229 result = entry.resolvableCompilationUnit;
2226 JUnitTestCase.assertNotSame(unit, result); 2230 JUnitTestCase.assertNotSame(unit, result);
2227 NodeList<Directive> directives = result.directives; 2231 NodeList<Directive> directives = result.directives;
2228 ImportDirective resultImportDirective = directives[0] as ImportDirective; 2232 ImportDirective resultImportDirective = directives[0] as ImportDirective;
2229 JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); 2233 JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent);
2230 JUnitTestCase.assertSame(importSource, resultImportDirective.source); 2234 JUnitTestCase.assertSame(importSource, resultImportDirective.source);
2231 ExportDirective resultExportDirective = directives[1] as ExportDirective; 2235 ExportDirective resultExportDirective = directives[1] as ExportDirective;
2232 JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); 2236 JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent);
2233 JUnitTestCase.assertSame(exportSource, resultExportDirective.source); 2237 JUnitTestCase.assertSame(exportSource, resultExportDirective.source);
2234 PartDirective resultPartDirective = directives[2] as PartDirective; 2238 PartDirective resultPartDirective = directives[2] as PartDirective;
2235 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); 2239 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 PartDirective resultPartDirective = directives[2] as PartDirective; 2284 PartDirective resultPartDirective = directives[2] as PartDirective;
2281 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); 2285 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent);
2282 JUnitTestCase.assertSame(partSource, resultPartDirective.source); 2286 JUnitTestCase.assertSame(partSource, resultPartDirective.source);
2283 } 2287 }
2284 2288
2285 void test_getStateInLibrary_invalid_element() { 2289 void test_getStateInLibrary_invalid_element() {
2286 DartEntry entry = new DartEntry(); 2290 DartEntry entry = new DartEntry();
2287 try { 2291 try {
2288 entry.getStateInLibrary(DartEntry.ELEMENT, new TestSource()); 2292 entry.getStateInLibrary(DartEntry.ELEMENT, new TestSource());
2289 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); 2293 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT");
2290 } on IllegalArgumentException catch (exception) { 2294 } on ArgumentError catch (exception) {
2291 // Expected 2295 // Expected
2292 } 2296 }
2293 } 2297 }
2294 2298
2295 void test_getState_invalid_resolutionErrors() { 2299 void test_getState_invalid_resolutionErrors() {
2296 DartEntry entry = new DartEntry(); 2300 DartEntry entry = new DartEntry();
2297 try { 2301 try {
2298 entry.getState(DartEntry.RESOLUTION_ERRORS); 2302 entry.getState(DartEntry.RESOLUTION_ERRORS);
2299 JUnitTestCase.fail( 2303 JUnitTestCase.fail(
2300 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); 2304 "Expected IllegalArgumentException for RESOLUTION_ERRORS");
2301 } on IllegalArgumentException catch (exception) { 2305 } on ArgumentError catch (exception) {
2302 // Expected 2306 // Expected
2303 } 2307 }
2304 } 2308 }
2305 2309
2306 void test_getState_invalid_verificationErrors() { 2310 void test_getState_invalid_verificationErrors() {
2307 DartEntry entry = new DartEntry(); 2311 DartEntry entry = new DartEntry();
2308 try { 2312 try {
2309 entry.getState(DartEntry.VERIFICATION_ERRORS); 2313 entry.getState(DartEntry.VERIFICATION_ERRORS);
2310 JUnitTestCase.fail( 2314 JUnitTestCase.fail(
2311 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); 2315 "Expected IllegalArgumentException for VERIFICATION_ERRORS");
2312 } on IllegalArgumentException catch (exception) { 2316 } on ArgumentError catch (exception) {
2313 // Expected 2317 // Expected
2314 } 2318 }
2315 } 2319 }
2316 2320
2321 void test_getValue_containingLibraries() {
2322 Source testSource = new TestSource();
2323 DartEntry entry = new DartEntry();
2324 List<Source> value = entry.containingLibraries;
2325 EngineTestCase.assertLength(0, value);
2326 entry.addContainingLibrary(testSource);
2327 value = entry.containingLibraries;
2328 EngineTestCase.assertLength(1, value);
2329 JUnitTestCase.assertEquals(testSource, value[0]);
2330 entry.removeContainingLibrary(testSource);
2331 value = entry.containingLibraries;
2332 EngineTestCase.assertLength(0, value);
2333 }
2334
2317 void test_getValueInLibrary_invalid_element() { 2335 void test_getValueInLibrary_invalid_element() {
2318 DartEntry entry = new DartEntry(); 2336 DartEntry entry = new DartEntry();
2319 try { 2337 try {
2320 entry.getValueInLibrary(DartEntry.ELEMENT, new TestSource()); 2338 entry.getValueInLibrary(DartEntry.ELEMENT, new TestSource());
2321 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); 2339 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT");
2322 } on IllegalArgumentException catch (exception) { 2340 } on ArgumentError catch (exception) {
2323 // Expected 2341 // Expected
2324 } 2342 }
2325 } 2343 }
2326 2344
2327 void test_getValueInLibrary_invalid_resolutionErrors_multiple() { 2345 void test_getValueInLibrary_invalid_resolutionErrors_multiple() {
2328 Source source1 = new TestSource(); 2346 Source source1 = new TestSource();
2329 Source source2 = new TestSource(); 2347 Source source2 = new TestSource();
2330 Source source3 = new TestSource(); 2348 Source source3 = new TestSource();
2331 DartEntry entry = new DartEntry(); 2349 DartEntry entry = new DartEntry();
2332 entry.setValueInLibrary( 2350 entry.setValueInLibrary(
2333 DartEntry.RESOLVED_UNIT, 2351 DartEntry.RESOLVED_UNIT,
2334 source1, 2352 source1,
2335 AstFactory.compilationUnit()); 2353 AstFactory.compilationUnit());
2336 entry.setValueInLibrary( 2354 entry.setValueInLibrary(
2337 DartEntry.RESOLVED_UNIT, 2355 DartEntry.RESOLVED_UNIT,
2338 source2, 2356 source2,
2339 AstFactory.compilationUnit()); 2357 AstFactory.compilationUnit());
2340 entry.setValueInLibrary( 2358 entry.setValueInLibrary(
2341 DartEntry.RESOLVED_UNIT, 2359 DartEntry.RESOLVED_UNIT,
2342 source3, 2360 source3,
2343 AstFactory.compilationUnit()); 2361 AstFactory.compilationUnit());
2344 try { 2362 try {
2345 entry.getValueInLibrary(DartEntry.ELEMENT, source3); 2363 entry.getValueInLibrary(DartEntry.ELEMENT, source3);
2346 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); 2364 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT");
2347 } on IllegalArgumentException catch (exception) { 2365 } on ArgumentError catch (exception) {
2348 // Expected 2366 // Expected
2349 } 2367 }
2350 } 2368 }
2351 2369
2352 void test_getValue_containingLibraries() {
2353 Source testSource = new TestSource();
2354 DartEntry entry = new DartEntry();
2355 List<Source> value = entry.getValue(DartEntry.CONTAINING_LIBRARIES);
2356 EngineTestCase.assertLength(0, value);
2357 entry.addContainingLibrary(testSource);
2358 value = entry.getValue(DartEntry.CONTAINING_LIBRARIES);
2359 EngineTestCase.assertLength(1, value);
2360 JUnitTestCase.assertEquals(testSource, value[0]);
2361 entry.removeContainingLibrary(testSource);
2362 value = entry.getValue(DartEntry.CONTAINING_LIBRARIES);
2363 EngineTestCase.assertLength(0, value);
2364 }
2365
2366 void test_getValue_invalid_resolutionErrors() { 2370 void test_getValue_invalid_resolutionErrors() {
2367 DartEntry entry = new DartEntry(); 2371 DartEntry entry = new DartEntry();
2368 try { 2372 try {
2369 entry.getValue(DartEntry.RESOLUTION_ERRORS); 2373 entry.getValue(DartEntry.RESOLUTION_ERRORS);
2370 JUnitTestCase.fail( 2374 JUnitTestCase.fail(
2371 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); 2375 "Expected IllegalArgumentException for RESOLUTION_ERRORS");
2372 } on IllegalArgumentException catch (exception) { 2376 } on ArgumentError catch (exception) {
2373 } 2377 }
2374 } 2378 }
2375 2379
2376 void test_getValue_invalid_verificationErrors() { 2380 void test_getValue_invalid_verificationErrors() {
2377 DartEntry entry = new DartEntry(); 2381 DartEntry entry = new DartEntry();
2378 try { 2382 try {
2379 entry.getValue(DartEntry.VERIFICATION_ERRORS); 2383 entry.getValue(DartEntry.VERIFICATION_ERRORS);
2380 JUnitTestCase.fail( 2384 JUnitTestCase.fail(
2381 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); 2385 "Expected IllegalArgumentException for VERIFICATION_ERRORS");
2382 } on IllegalArgumentException catch (exception) { 2386 } on ArgumentError catch (exception) {
2383 // Expected 2387 // Expected
2384 } 2388 }
2385 } 2389 }
2386 2390
2387 void test_hasInvalidData_false() { 2391 void test_hasInvalidData_false() {
2388 DartEntry entry = new DartEntry(); 2392 DartEntry entry = new DartEntry();
2389 entry.recordScanError(new CaughtException(new AnalysisException(), null)); 2393 entry.recordScanError(new CaughtException(new AnalysisException(), null));
2390 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.ELEMENT)); 2394 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.ELEMENT));
2391 JUnitTestCase.assertFalse( 2395 JUnitTestCase.assertFalse(
2392 entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIES)); 2396 entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIES));
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 // any way of setting the state for data associated with a library we 2823 // any way of setting the state for data associated with a library we
2820 // don't know anything about. 2824 // don't know anything about.
2821 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME NT_ERRORS, source)); 2825 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME NT_ERRORS, source));
2822 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT, source)); 2826 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT, source));
2823 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour ce)); 2827 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour ce));
2824 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); 2828 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source));
2825 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); 2829 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source));
2826 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); 2830 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source));
2827 } 2831 }
2828 2832
2829 void test_recordParseInProcess() {
2830 DartEntry entry = new DartEntry();
2831 entry.recordParseInProcess();
2832 JUnitTestCase.assertSame(
2833 CacheState.IN_PROCESS,
2834 entry.getState(DartEntry.PARSE_ERRORS));
2835 JUnitTestCase.assertSame(
2836 CacheState.IN_PROCESS,
2837 entry.getState(DartEntry.PARSED_UNIT));
2838 JUnitTestCase.assertSame(
2839 CacheState.IN_PROCESS,
2840 entry.getState(DartEntry.SOURCE_KIND));
2841 }
2842
2843 void test_recordResolutionError() { 2833 void test_recordResolutionError() {
2844 // Source source = new TestSource(); 2834 // Source source = new TestSource();
2845 DartEntry entry = new DartEntry(); 2835 DartEntry entry = new DartEntry();
2846 entry.recordResolutionError( 2836 entry.recordResolutionError(
2847 new CaughtException(new AnalysisException(), null)); 2837 new CaughtException(new AnalysisException(), null));
2848 JUnitTestCase.assertSame( 2838 JUnitTestCase.assertSame(
2849 CacheState.INVALID, 2839 CacheState.INVALID,
2850 entry.getState(SourceEntry.CONTENT)); 2840 entry.getState(SourceEntry.CONTENT));
2851 JUnitTestCase.assertSame( 2841 JUnitTestCase.assertSame(
2852 CacheState.ERROR, 2842 CacheState.ERROR,
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3013 // any way of setting the state for data associated with a library we 3003 // any way of setting the state for data associated with a library we
3014 // don't know anything about. 3004 // don't know anything about.
3015 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME NT_ERRORS, source)); 3005 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME NT_ERRORS, source));
3016 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT, source)); 3006 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT, source));
3017 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour ce)); 3007 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour ce));
3018 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); 3008 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source));
3019 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); 3009 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source));
3020 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); 3010 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source));
3021 } 3011 }
3022 3012
3023 void test_recordScanInProcess() {
3024 DartEntry entry = new DartEntry();
3025 entry.recordScanInProcess();
3026 JUnitTestCase.assertSame(
3027 CacheState.IN_PROCESS,
3028 entry.getState(SourceEntry.LINE_INFO));
3029 JUnitTestCase.assertSame(
3030 CacheState.IN_PROCESS,
3031 entry.getState(DartEntry.SCAN_ERRORS));
3032 JUnitTestCase.assertSame(
3033 CacheState.IN_PROCESS,
3034 entry.getState(DartEntry.TOKEN_STREAM));
3035 }
3036
3037 void test_recordVerificationErrorInLibrary() { 3013 void test_recordVerificationErrorInLibrary() {
3038 // TODO(brianwilkerson) This test should set the state for two libraries, 3014 // TODO(brianwilkerson) This test should set the state for two libraries,
3039 // record an error in one library, then verify that the data for the other 3015 // record an error in one library, then verify that the data for the other
3040 // library is still valid. 3016 // library is still valid.
3041 Source source = new TestSource(); 3017 Source source = new TestSource();
3042 DartEntry entry = new DartEntry(); 3018 DartEntry entry = new DartEntry();
3043 entry.recordVerificationErrorInLibrary( 3019 entry.recordVerificationErrorInLibrary(
3044 source, 3020 source,
3045 new CaughtException(new AnalysisException(), null)); 3021 new CaughtException(new AnalysisException(), null));
3046 JUnitTestCase.assertSame( 3022 JUnitTestCase.assertSame(
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
3187 3163
3188 void test_setState_includedParts() { 3164 void test_setState_includedParts() {
3189 state2 = DartEntry.INCLUDED_PARTS; 3165 state2 = DartEntry.INCLUDED_PARTS;
3190 } 3166 }
3191 3167
3192 void test_setState_invalid_element() { 3168 void test_setState_invalid_element() {
3193 DartEntry entry = new DartEntry(); 3169 DartEntry entry = new DartEntry();
3194 try { 3170 try {
3195 entry.setStateInLibrary(DartEntry.ELEMENT, null, CacheState.FLUSHED); 3171 entry.setStateInLibrary(DartEntry.ELEMENT, null, CacheState.FLUSHED);
3196 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); 3172 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT");
3197 } on IllegalArgumentException catch (exception) { 3173 } on ArgumentError catch (exception) {
3198 // Expected 3174 // Expected
3199 } 3175 }
3200 } 3176 }
3201 3177
3202 void test_setState_invalid_resolutionErrors() { 3178 void test_setState_invalid_resolutionErrors() {
3203 DartEntry entry = new DartEntry(); 3179 DartEntry entry = new DartEntry();
3204 try { 3180 try {
3205 entry.setState(DartEntry.RESOLUTION_ERRORS, CacheState.FLUSHED); 3181 entry.setState(DartEntry.RESOLUTION_ERRORS, CacheState.FLUSHED);
3206 JUnitTestCase.fail( 3182 JUnitTestCase.fail(
3207 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); 3183 "Expected IllegalArgumentException for RESOLUTION_ERRORS");
3208 } on IllegalArgumentException catch (exception) { 3184 } on ArgumentError catch (exception) {
3209 // Expected 3185 // Expected
3210 } 3186 }
3211 } 3187 }
3212 3188
3213 void test_setState_invalid_validState() { 3189 void test_setState_invalid_validState() {
3214 DartEntry entry = new DartEntry(); 3190 DartEntry entry = new DartEntry();
3215 try { 3191 try {
3216 entry.setState(SourceEntry.LINE_INFO, CacheState.VALID); 3192 entry.setState(SourceEntry.LINE_INFO, CacheState.VALID);
3217 JUnitTestCase.fail( 3193 JUnitTestCase.fail(
3218 "Expected IllegalArgumentException for a state of VALID"); 3194 "Expected ArgumentError for a state of VALID");
3219 } on IllegalArgumentException catch (exception) { 3195 } on ArgumentError catch (exception) {
3220 } 3196 }
3221 } 3197 }
3222 3198
3223 void test_setState_invalid_verificationErrors() { 3199 void test_setState_invalid_verificationErrors() {
3224 DartEntry entry = new DartEntry(); 3200 DartEntry entry = new DartEntry();
3225 try { 3201 try {
3226 entry.setState(DartEntry.VERIFICATION_ERRORS, CacheState.FLUSHED); 3202 entry.setState(DartEntry.VERIFICATION_ERRORS, CacheState.FLUSHED);
3227 JUnitTestCase.fail( 3203 JUnitTestCase.fail(
3228 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); 3204 "Expected IllegalArgumentException for VERIFICATION_ERRORS");
3229 } on IllegalArgumentException catch (exception) { 3205 } on ArgumentError catch (exception) {
3230 // Expected 3206 // Expected
3231 } 3207 }
3232 } 3208 }
3233 3209
3234 void test_setState_isClient() { 3210 void test_setState_isClient() {
3235 state2 = DartEntry.IS_CLIENT; 3211 state2 = DartEntry.IS_CLIENT;
3236 } 3212 }
3237 3213
3238 void test_setState_isLaunchable() { 3214 void test_setState_isLaunchable() {
3239 state2 = DartEntry.IS_LAUNCHABLE; 3215 state2 = DartEntry.IS_LAUNCHABLE;
3240 } 3216 }
3241 3217
3242 void test_setState_lineInfo() { 3218 void test_setState_lineInfo() {
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3928 HtmlEntry.HINTS, 3904 HtmlEntry.HINTS,
3929 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE, [])]); 3905 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE, [])]);
3930 } 3906 }
3931 3907
3932 void test_setValue_illegal() { 3908 void test_setValue_illegal() {
3933 HtmlEntry entry = new HtmlEntry(); 3909 HtmlEntry entry = new HtmlEntry();
3934 try { 3910 try {
3935 entry.setValue(DartEntry.ELEMENT, null); 3911 entry.setValue(DartEntry.ELEMENT, null);
3936 JUnitTestCase.fail( 3912 JUnitTestCase.fail(
3937 "Expected IllegalArgumentException for DartEntry.ELEMENT"); 3913 "Expected IllegalArgumentException for DartEntry.ELEMENT");
3938 } on IllegalArgumentException catch (exception) { 3914 } on ArgumentError catch (exception) {
3939 } 3915 }
3940 } 3916 }
3941 3917
3942 void test_setValue_lineInfo() { 3918 void test_setValue_lineInfo() {
3943 _setValue(SourceEntry.LINE_INFO, new LineInfo(<int>[0])); 3919 _setValue(SourceEntry.LINE_INFO, new LineInfo(<int>[0]));
3944 } 3920 }
3945 3921
3946 void test_setValue_parseErrors() { 3922 void test_setValue_parseErrors() {
3947 _setValue( 3923 _setValue(
3948 HtmlEntry.PARSE_ERRORS, 3924 HtmlEntry.PARSE_ERRORS,
(...skipping 25 matching lines...) Expand all
3974 3950
3975 void test_setValue_resolutionErrors() { 3951 void test_setValue_resolutionErrors() {
3976 _setValue( 3952 _setValue(
3977 HtmlEntry.RESOLUTION_ERRORS, 3953 HtmlEntry.RESOLUTION_ERRORS,
3978 <AnalysisError>[ 3954 <AnalysisError>[
3979 new AnalysisError.con1(null, HtmlWarningCode.INVALID_URI, ["-"])]); 3955 new AnalysisError.con1(null, HtmlWarningCode.INVALID_URI, ["-"])]);
3980 } 3956 }
3981 3957
3982 HtmlEntry _entryWithValidState() { 3958 HtmlEntry _entryWithValidState() {
3983 HtmlEntry entry = new HtmlEntry(); 3959 HtmlEntry entry = new HtmlEntry();
3960 entry.setValue(HtmlEntry.ANGULAR_APPLICATION, null);
3961 entry.setValue(HtmlEntry.ANGULAR_COMPONENT, null);
3984 entry.setValue(HtmlEntry.ANGULAR_ERRORS, null); 3962 entry.setValue(HtmlEntry.ANGULAR_ERRORS, null);
3985 entry.setValue(HtmlEntry.ELEMENT, null); 3963 entry.setValue(HtmlEntry.ELEMENT, null);
3986 entry.setValue(HtmlEntry.HINTS, null); 3964 entry.setValue(HtmlEntry.HINTS, null);
3987 entry.setValue(SourceEntry.LINE_INFO, null); 3965 entry.setValue(SourceEntry.LINE_INFO, null);
3988 entry.setValue(HtmlEntry.PARSE_ERRORS, null); 3966 entry.setValue(HtmlEntry.PARSE_ERRORS, null);
3989 entry.setValue(HtmlEntry.PARSED_UNIT, null); 3967 entry.setValue(HtmlEntry.PARSED_UNIT, null);
3990 entry.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, null); 3968 entry.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, null);
3991 entry.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, null); 3969 entry.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, null);
3992 entry.setValue(HtmlEntry.REFERENCED_LIBRARIES, null); 3970 entry.setValue(HtmlEntry.REFERENCED_LIBRARIES, null);
3993 entry.setValue(HtmlEntry.RESOLUTION_ERRORS, null); 3971 entry.setValue(HtmlEntry.RESOLUTION_ERRORS, null);
(...skipping 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after
7141 } 7119 }
7142 } 7120 }
7143 7121
7144 7122
7145 class _UniversalCachePartitionTest_test_setMaxCacheSize implements 7123 class _UniversalCachePartitionTest_test_setMaxCacheSize implements
7146 CacheRetentionPolicy { 7124 CacheRetentionPolicy {
7147 @override 7125 @override
7148 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 7126 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
7149 RetentionPriority.LOW; 7127 RetentionPriority.LOW;
7150 } 7128 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698