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

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

Issue 712083003: Create fewer unnecessary lists (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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:collection'; 10 import 'dart:collection';
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 class DartEntryTest extends EngineTestCase { 2001 class DartEntryTest extends EngineTestCase {
2002 void test_allErrors() { 2002 void test_allErrors() {
2003 Source source = new TestSource(); 2003 Source source = new TestSource();
2004 DartEntry entry = new DartEntry(); 2004 DartEntry entry = new DartEntry();
2005 expect(entry.allErrors, hasLength(0)); 2005 expect(entry.allErrors, hasLength(0));
2006 entry.setValue( 2006 entry.setValue(
2007 DartEntry.SCAN_ERRORS, 2007 DartEntry.SCAN_ERRORS,
2008 <AnalysisError>[ 2008 <AnalysisError>[
2009 new AnalysisError.con1( 2009 new AnalysisError.con1(
2010 source, 2010 source,
2011 ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 2011 ScannerErrorCode.UNTERMINATED_STRING_LITERAL)]);
2012 [])]);
2013 entry.setValue( 2012 entry.setValue(
2014 DartEntry.PARSE_ERRORS, 2013 DartEntry.PARSE_ERRORS,
2015 <AnalysisError>[ 2014 <AnalysisError>[
2016 new AnalysisError.con1(source, ParserErrorCode.ABSTRACT_CLASS_MEMBER , [])]); 2015 new AnalysisError.con1(source, ParserErrorCode.ABSTRACT_CLASS_MEMBER )]);
2017 entry.setValueInLibrary( 2016 entry.setValueInLibrary(
2018 DartEntry.RESOLUTION_ERRORS, 2017 DartEntry.RESOLUTION_ERRORS,
2019 source, 2018 source,
2020 <AnalysisError>[ 2019 <AnalysisError>[
2021 new AnalysisError.con1( 2020 new AnalysisError.con1(
2022 source, 2021 source,
2023 CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION, 2022 CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION)]);
2024 [])]);
2025 entry.setValueInLibrary( 2023 entry.setValueInLibrary(
2026 DartEntry.VERIFICATION_ERRORS, 2024 DartEntry.VERIFICATION_ERRORS,
2027 source, 2025 source,
2028 <AnalysisError>[ 2026 <AnalysisError>[
2029 new AnalysisError.con1( 2027 new AnalysisError.con1(
2030 source, 2028 source,
2031 StaticWarningCode.CASE_BLOCK_NOT_TERMINATED, 2029 StaticWarningCode.CASE_BLOCK_NOT_TERMINATED)]);
2032 [])]);
2033 entry.setValueInLibrary( 2030 entry.setValueInLibrary(
2034 DartEntry.ANGULAR_ERRORS, 2031 DartEntry.ANGULAR_ERRORS,
2035 source, 2032 source,
2036 <AnalysisError>[new AnalysisError.con1(source, AngularCode.MISSING_NAME, [])]); 2033 <AnalysisError>[new AnalysisError.con1(source, AngularCode.MISSING_NAME) ]);
2037 entry.setValueInLibrary( 2034 entry.setValueInLibrary(
2038 DartEntry.HINTS, 2035 DartEntry.HINTS,
2039 source, 2036 source,
2040 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE, [])]) ; 2037 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE)]);
2041 expect(entry.allErrors, hasLength(5)); 2038 expect(entry.allErrors, hasLength(5));
2042 } 2039 }
2043 2040
2044 void test_creation() { 2041 void test_creation() {
2045 Source librarySource = new TestSource(); 2042 Source librarySource = new TestSource();
2046 DartEntry entry = new DartEntry(); 2043 DartEntry entry = new DartEntry();
2047 expect(entry.getState(SourceEntry.CONTENT), same(CacheState.INVALID)); 2044 expect(entry.getState(SourceEntry.CONTENT), same(CacheState.INVALID));
2048 expect(entry.getState(SourceEntry.LINE_INFO), same(CacheState.INVALID)); 2045 expect(entry.getState(SourceEntry.LINE_INFO), same(CacheState.INVALID));
2049 expect(entry.getState(DartEntry.CONTAINING_LIBRARIES), same(CacheState.INVAL ID)); 2046 expect(entry.getState(DartEntry.CONTAINING_LIBRARIES), same(CacheState.INVAL ID));
2050 expect(entry.getState(DartEntry.ELEMENT), same(CacheState.INVALID)); 2047 expect(entry.getState(DartEntry.ELEMENT), same(CacheState.INVALID));
(...skipping 21 matching lines...) Expand all
2072 void test_getResolvableCompilationUnit_none() { 2069 void test_getResolvableCompilationUnit_none() {
2073 DartEntry entry = new DartEntry(); 2070 DartEntry entry = new DartEntry();
2074 expect(entry.resolvableCompilationUnit, isNull); 2071 expect(entry.resolvableCompilationUnit, isNull);
2075 } 2072 }
2076 2073
2077 void test_getResolvableCompilationUnit_parsed_accessed() { 2074 void test_getResolvableCompilationUnit_parsed_accessed() {
2078 Source librarySource = new TestSource("/lib.dart"); 2075 Source librarySource = new TestSource("/lib.dart");
2079 String importUri = "/f1.dart"; 2076 String importUri = "/f1.dart";
2080 Source importSource = new TestSource(importUri); 2077 Source importSource = new TestSource(importUri);
2081 ImportDirective importDirective = 2078 ImportDirective importDirective =
2082 AstFactory.importDirective3(importUri, null, []); 2079 AstFactory.importDirective3(importUri, null);
2083 importDirective.source = importSource; 2080 importDirective.source = importSource;
2084 importDirective.uriContent = importUri; 2081 importDirective.uriContent = importUri;
2085 String exportUri = "/f2.dart"; 2082 String exportUri = "/f2.dart";
2086 Source exportSource = new TestSource(exportUri); 2083 Source exportSource = new TestSource(exportUri);
2087 ExportDirective exportDirective = 2084 ExportDirective exportDirective =
2088 AstFactory.exportDirective2(exportUri, []); 2085 AstFactory.exportDirective2(exportUri);
2089 exportDirective.source = exportSource; 2086 exportDirective.source = exportSource;
2090 exportDirective.uriContent = exportUri; 2087 exportDirective.uriContent = exportUri;
2091 String partUri = "/f3.dart"; 2088 String partUri = "/f3.dart";
2092 Source partSource = new TestSource(partUri); 2089 Source partSource = new TestSource(partUri);
2093 PartDirective partDirective = AstFactory.partDirective2(partUri); 2090 PartDirective partDirective = AstFactory.partDirective2(partUri);
2094 partDirective.source = partSource; 2091 partDirective.source = partSource;
2095 partDirective.uriContent = partUri; 2092 partDirective.uriContent = partUri;
2096 CompilationUnit unit = 2093 CompilationUnit unit =
2097 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]); 2094 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]);
2098 DartEntry entry = new DartEntry(); 2095 DartEntry entry = new DartEntry();
(...skipping 20 matching lines...) Expand all
2119 CompilationUnit unit = AstFactory.compilationUnit(); 2116 CompilationUnit unit = AstFactory.compilationUnit();
2120 DartEntry entry = new DartEntry(); 2117 DartEntry entry = new DartEntry();
2121 entry.setValue(DartEntry.PARSED_UNIT, unit); 2118 entry.setValue(DartEntry.PARSED_UNIT, unit);
2122 expect(entry.resolvableCompilationUnit, same(unit)); 2119 expect(entry.resolvableCompilationUnit, same(unit));
2123 } 2120 }
2124 2121
2125 void test_getResolvableCompilationUnit_resolved() { 2122 void test_getResolvableCompilationUnit_resolved() {
2126 String importUri = "f1.dart"; 2123 String importUri = "f1.dart";
2127 Source importSource = new TestSource(importUri); 2124 Source importSource = new TestSource(importUri);
2128 ImportDirective importDirective = 2125 ImportDirective importDirective =
2129 AstFactory.importDirective3(importUri, null, []); 2126 AstFactory.importDirective3(importUri, null);
2130 importDirective.source = importSource; 2127 importDirective.source = importSource;
2131 importDirective.uriContent = importUri; 2128 importDirective.uriContent = importUri;
2132 String exportUri = "f2.dart"; 2129 String exportUri = "f2.dart";
2133 Source exportSource = new TestSource(exportUri); 2130 Source exportSource = new TestSource(exportUri);
2134 ExportDirective exportDirective = 2131 ExportDirective exportDirective =
2135 AstFactory.exportDirective2(exportUri, []); 2132 AstFactory.exportDirective2(exportUri);
2136 exportDirective.source = exportSource; 2133 exportDirective.source = exportSource;
2137 exportDirective.uriContent = exportUri; 2134 exportDirective.uriContent = exportUri;
2138 String partUri = "f3.dart"; 2135 String partUri = "f3.dart";
2139 Source partSource = new TestSource(partUri); 2136 Source partSource = new TestSource(partUri);
2140 PartDirective partDirective = AstFactory.partDirective2(partUri); 2137 PartDirective partDirective = AstFactory.partDirective2(partUri);
2141 partDirective.source = partSource; 2138 partDirective.source = partSource;
2142 partDirective.uriContent = partUri; 2139 partDirective.uriContent = partUri;
2143 CompilationUnit unit = 2140 CompilationUnit unit =
2144 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]); 2141 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]);
2145 DartEntry entry = new DartEntry(); 2142 DartEntry entry = new DartEntry();
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2967 new LibraryElementImpl.forNode(null, AstFactory.libraryIdentifier2(["lib "]))); 2964 new LibraryElementImpl.forNode(null, AstFactory.libraryIdentifier2(["lib "])));
2968 } 2965 }
2969 2966
2970 void test_setValue_exportedLibraries() { 2967 void test_setValue_exportedLibraries() {
2971 _setValue(DartEntry.EXPORTED_LIBRARIES, <Source>[new TestSource()]); 2968 _setValue(DartEntry.EXPORTED_LIBRARIES, <Source>[new TestSource()]);
2972 } 2969 }
2973 2970
2974 void test_setValue_hints() { 2971 void test_setValue_hints() {
2975 _setValueInLibrary( 2972 _setValueInLibrary(
2976 DartEntry.HINTS, 2973 DartEntry.HINTS,
2977 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE, [])]); 2974 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE)]);
2978 } 2975 }
2979 2976
2980 void test_setValue_importedLibraries() { 2977 void test_setValue_importedLibraries() {
2981 _setValue(DartEntry.IMPORTED_LIBRARIES, <Source>[new TestSource()]); 2978 _setValue(DartEntry.IMPORTED_LIBRARIES, <Source>[new TestSource()]);
2982 } 2979 }
2983 2980
2984 void test_setValue_includedParts() { 2981 void test_setValue_includedParts() {
2985 _setValue(DartEntry.INCLUDED_PARTS, <Source>[new TestSource()]); 2982 _setValue(DartEntry.INCLUDED_PARTS, <Source>[new TestSource()]);
2986 } 2983 }
2987 2984
2988 void test_setValue_isClient() { 2985 void test_setValue_isClient() {
2989 _setValue(DartEntry.IS_CLIENT, true); 2986 _setValue(DartEntry.IS_CLIENT, true);
2990 } 2987 }
2991 2988
2992 void test_setValue_isLaunchable() { 2989 void test_setValue_isLaunchable() {
2993 _setValue(DartEntry.IS_LAUNCHABLE, true); 2990 _setValue(DartEntry.IS_LAUNCHABLE, true);
2994 } 2991 }
2995 2992
2996 void test_setValue_lineInfo() { 2993 void test_setValue_lineInfo() {
2997 _setValue(SourceEntry.LINE_INFO, new LineInfo(<int>[0])); 2994 _setValue(SourceEntry.LINE_INFO, new LineInfo(<int>[0]));
2998 } 2995 }
2999 2996
3000 void test_setValue_parseErrors() { 2997 void test_setValue_parseErrors() {
3001 _setValue( 2998 _setValue(
3002 DartEntry.PARSE_ERRORS, 2999 DartEntry.PARSE_ERRORS,
3003 <AnalysisError>[ 3000 <AnalysisError>[
3004 new AnalysisError.con1(null, ParserErrorCode.ABSTRACT_CLASS_MEMBER, [])]); 3001 new AnalysisError.con1(null, ParserErrorCode.ABSTRACT_CLASS_MEMBER)] );
3005 } 3002 }
3006 3003
3007 void test_setValue_parsedUnit() { 3004 void test_setValue_parsedUnit() {
3008 _setValue(DartEntry.PARSED_UNIT, AstFactory.compilationUnit()); 3005 _setValue(DartEntry.PARSED_UNIT, AstFactory.compilationUnit());
3009 } 3006 }
3010 3007
3011 void test_setValue_publicNamespace() { 3008 void test_setValue_publicNamespace() {
3012 _setValue( 3009 _setValue(
3013 DartEntry.PUBLIC_NAMESPACE, 3010 DartEntry.PUBLIC_NAMESPACE,
3014 new Namespace(new HashMap<String, Element>())); 3011 new Namespace(new HashMap<String, Element>()));
3015 } 3012 }
3016 3013
3017 void test_setValue_resolutionErrors() { 3014 void test_setValue_resolutionErrors() {
3018 _setValueInLibrary( 3015 _setValueInLibrary(
3019 DartEntry.RESOLUTION_ERRORS, 3016 DartEntry.RESOLUTION_ERRORS,
3020 <AnalysisError>[ 3017 <AnalysisError>[
3021 new AnalysisError.con1( 3018 new AnalysisError.con1(
3022 null, 3019 null,
3023 CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION, 3020 CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION)]);
3024 [])]);
3025 } 3021 }
3026 3022
3027 void test_setValue_resolvedUnit() { 3023 void test_setValue_resolvedUnit() {
3028 _setValueInLibrary(DartEntry.RESOLVED_UNIT, AstFactory.compilationUnit()); 3024 _setValueInLibrary(DartEntry.RESOLVED_UNIT, AstFactory.compilationUnit());
3029 } 3025 }
3030 3026
3031 void test_setValue_scanErrors() { 3027 void test_setValue_scanErrors() {
3032 _setValue( 3028 _setValue(
3033 DartEntry.SCAN_ERRORS, 3029 DartEntry.SCAN_ERRORS,
3034 <AnalysisError>[ 3030 <AnalysisError>[
3035 new AnalysisError.con1( 3031 new AnalysisError.con1(
3036 null, 3032 null,
3037 ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT, 3033 ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT)]);
3038 [])]);
3039 } 3034 }
3040 3035
3041 void test_setValue_sourceKind() { 3036 void test_setValue_sourceKind() {
3042 _setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); 3037 _setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY);
3043 } 3038 }
3044 3039
3045 void test_setValue_tokenStream() { 3040 void test_setValue_tokenStream() {
3046 _setValue(DartEntry.TOKEN_STREAM, new Token(TokenType.LT, 5)); 3041 _setValue(DartEntry.TOKEN_STREAM, new Token(TokenType.LT, 5));
3047 } 3042 }
3048 3043
3049 void test_setValue_verificationErrors() { 3044 void test_setValue_verificationErrors() {
3050 _setValueInLibrary( 3045 _setValueInLibrary(
3051 DartEntry.VERIFICATION_ERRORS, 3046 DartEntry.VERIFICATION_ERRORS,
3052 <AnalysisError>[ 3047 <AnalysisError>[
3053 new AnalysisError.con1(null, StaticWarningCode.CASE_BLOCK_NOT_TERMIN ATED, [])]); 3048 new AnalysisError.con1(null, StaticWarningCode.CASE_BLOCK_NOT_TERMIN ATED)]);
3054 } 3049 }
3055 3050
3056 DartEntry _entryWithValidState([Source firstLibrary, Source secondLibrary]) { 3051 DartEntry _entryWithValidState([Source firstLibrary, Source secondLibrary]) {
3057 DartEntry entry = new DartEntry(); 3052 DartEntry entry = new DartEntry();
3058 entry.setValue(SourceEntry.CONTENT, null); 3053 entry.setValue(SourceEntry.CONTENT, null);
3059 entry.setValue(SourceEntry.LINE_INFO, null); 3054 entry.setValue(SourceEntry.LINE_INFO, null);
3060 entry.setValue(DartEntry.CONTAINING_LIBRARIES, null); 3055 entry.setValue(DartEntry.CONTAINING_LIBRARIES, null);
3061 entry.setValue(DartEntry.ELEMENT, null); 3056 entry.setValue(DartEntry.ELEMENT, null);
3062 entry.setValue(DartEntry.EXPORTED_LIBRARIES, null); 3057 entry.setValue(DartEntry.EXPORTED_LIBRARIES, null);
3063 entry.setValue(DartEntry.IMPORTED_LIBRARIES, null); 3058 entry.setValue(DartEntry.IMPORTED_LIBRARIES, null);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
3496 entry.setValue( 3491 entry.setValue(
3497 HtmlEntry.POLYMER_BUILD_ERRORS, 3492 HtmlEntry.POLYMER_BUILD_ERRORS,
3498 <AnalysisError>[ 3493 <AnalysisError>[
3499 new AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, [ "-"])]); 3494 new AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, [ "-"])]);
3500 entry.setValue( 3495 entry.setValue(
3501 HtmlEntry.POLYMER_RESOLUTION_ERRORS, 3496 HtmlEntry.POLYMER_RESOLUTION_ERRORS,
3502 <AnalysisError>[ 3497 <AnalysisError>[
3503 new AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, [ "-"])]); 3498 new AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, [ "-"])]);
3504 entry.setValue( 3499 entry.setValue(
3505 HtmlEntry.HINTS, 3500 HtmlEntry.HINTS,
3506 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE, [])]) ; 3501 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE)]);
3507 expect(entry.allErrors, hasLength(6)); 3502 expect(entry.allErrors, hasLength(6));
3508 } 3503 }
3509 3504
3510 void test_invalidateAllResolutionInformation() { 3505 void test_invalidateAllResolutionInformation() {
3511 HtmlEntry entry = _entryWithValidState(); 3506 HtmlEntry entry = _entryWithValidState();
3512 entry.invalidateAllResolutionInformation(false); 3507 entry.invalidateAllResolutionInformation(false);
3513 expect(entry.getState(HtmlEntry.ANGULAR_APPLICATION), same(CacheState.VALID) ); 3508 expect(entry.getState(HtmlEntry.ANGULAR_APPLICATION), same(CacheState.VALID) );
3514 expect(entry.getState(HtmlEntry.ANGULAR_COMPONENT), same(CacheState.VALID)); 3509 expect(entry.getState(HtmlEntry.ANGULAR_COMPONENT), same(CacheState.VALID));
3515 expect(entry.getState(HtmlEntry.ANGULAR_ENTRY), same(CacheState.INVALID)); 3510 expect(entry.getState(HtmlEntry.ANGULAR_ENTRY), same(CacheState.INVALID));
3516 expect(entry.getState(HtmlEntry.ANGULAR_ERRORS), same(CacheState.INVALID)); 3511 expect(entry.getState(HtmlEntry.ANGULAR_ERRORS), same(CacheState.INVALID));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3590 new AnalysisError.con1(null, AngularCode.INVALID_REPEAT_SYNTAX, ["-" ])]); 3585 new AnalysisError.con1(null, AngularCode.INVALID_REPEAT_SYNTAX, ["-" ])]);
3591 } 3586 }
3592 3587
3593 void test_setValue_element() { 3588 void test_setValue_element() {
3594 _setValue(HtmlEntry.ELEMENT, new HtmlElementImpl(null, "test.html")); 3589 _setValue(HtmlEntry.ELEMENT, new HtmlElementImpl(null, "test.html"));
3595 } 3590 }
3596 3591
3597 void test_setValue_hints() { 3592 void test_setValue_hints() {
3598 _setValue( 3593 _setValue(
3599 HtmlEntry.HINTS, 3594 HtmlEntry.HINTS,
3600 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE, [])]); 3595 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE)]);
3601 } 3596 }
3602 3597
3603 void test_setValue_illegal() { 3598 void test_setValue_illegal() {
3604 HtmlEntry entry = new HtmlEntry(); 3599 HtmlEntry entry = new HtmlEntry();
3605 try { 3600 try {
3606 entry.setValue(DartEntry.ELEMENT, null); 3601 entry.setValue(DartEntry.ELEMENT, null);
3607 fail("Expected IllegalArgumentException for DartEntry.ELEMENT"); 3602 fail("Expected IllegalArgumentException for DartEntry.ELEMENT");
3608 } on ArgumentError catch (exception) { 3603 } on ArgumentError catch (exception) {
3609 } 3604 }
3610 } 3605 }
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
4924 ParseDartTaskTestTV_perform_validateDirectives(this.context, this.source); 4919 ParseDartTaskTestTV_perform_validateDirectives(this.context, this.source);
4925 @override 4920 @override
4926 Object visitParseDartTask(ParseDartTask task) { 4921 Object visitParseDartTask(ParseDartTask task) {
4927 CaughtException exception = task.exception; 4922 CaughtException exception = task.exception;
4928 if (exception != null) { 4923 if (exception != null) {
4929 throw exception; 4924 throw exception;
4930 } 4925 }
4931 expect(task.compilationUnit, isNotNull); 4926 expect(task.compilationUnit, isNotNull);
4932 GatheringErrorListener errorListener = new GatheringErrorListener(); 4927 GatheringErrorListener errorListener = new GatheringErrorListener();
4933 errorListener.addAll(task.errors); 4928 errorListener.addAll(task.errors);
4934 errorListener.assertErrorsWithCodes( 4929 errorListener.assertErrorsWithCodes([
4935 [ 4930 CompileTimeErrorCode.URI_WITH_INTERPOLATION,
4936 CompileTimeErrorCode.URI_WITH_INTERPOLATION, 4931 CompileTimeErrorCode.INVALID_URI]);
4937 CompileTimeErrorCode.INVALID_URI]);
4938 expect(task.source, same(source)); 4932 expect(task.source, same(source));
4939 expect(task.hasNonPartOfDirective, isTrue); 4933 expect(task.hasNonPartOfDirective, isTrue);
4940 expect(task.hasPartOfDirective, isFalse); 4934 expect(task.hasPartOfDirective, isFalse);
4941 return null; 4935 return null;
4942 } 4936 }
4943 } 4937 }
4944 4938
4945 4939
4946 class ParseHtmlTaskTest extends EngineTestCase { 4940 class ParseHtmlTaskTest extends EngineTestCase {
4947 ParseHtmlTask parseContents(String contents, TestLogger testLogger) { 4941 ParseHtmlTask parseContents(String contents, TestLogger testLogger) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
5280 ResolveDartUnitTask task = 5274 ResolveDartUnitTask task =
5281 new ResolveDartUnitTask(context, source, element); 5275 new ResolveDartUnitTask(context, source, element);
5282 task.perform(new ResolveDartUnitTaskTestTV_perform_exception()); 5276 task.perform(new ResolveDartUnitTaskTestTV_perform_exception());
5283 } 5277 }
5284 5278
5285 void test_perform_library() { 5279 void test_perform_library() {
5286 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); 5280 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore();
5287 LibraryElementImpl libraryElement = ElementFactory.library(context, "lib"); 5281 LibraryElementImpl libraryElement = ElementFactory.library(context, "lib");
5288 CompilationUnitElementImpl unitElement = 5282 CompilationUnitElementImpl unitElement =
5289 libraryElement.definingCompilationUnit as CompilationUnitElementImpl; 5283 libraryElement.definingCompilationUnit as CompilationUnitElementImpl;
5290 ClassElementImpl classElement = ElementFactory.classElement2("A", []); 5284 ClassElementImpl classElement = ElementFactory.classElement2("A");
5291 classElement.nameOffset = 19; 5285 classElement.nameOffset = 19;
5292 ConstructorElementImpl constructorElement = 5286 ConstructorElementImpl constructorElement =
5293 ElementFactory.constructorElement2(classElement, null, []); 5287 ElementFactory.constructorElement2(classElement, null);
5294 constructorElement.synthetic = true; 5288 constructorElement.synthetic = true;
5295 classElement.constructors = <ConstructorElement>[constructorElement]; 5289 classElement.constructors = <ConstructorElement>[constructorElement];
5296 unitElement.types = <ClassElement>[classElement]; 5290 unitElement.types = <ClassElement>[classElement];
5297 Source source = unitElement.source; 5291 Source source = unitElement.source;
5298 context.setContents( 5292 context.setContents(
5299 source, 5293 source,
5300 r''' 5294 r'''
5301 library lib; 5295 library lib;
5302 class A {}'''); 5296 class A {}''');
5303 ResolveDartUnitTask task = 5297 ResolveDartUnitTask task =
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
6735 } 6729 }
6736 } 6730 }
6737 6731
6738 6732
6739 class _UniversalCachePartitionTest_test_setMaxCacheSize implements 6733 class _UniversalCachePartitionTest_test_setMaxCacheSize implements
6740 CacheRetentionPolicy { 6734 CacheRetentionPolicy {
6741 @override 6735 @override
6742 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 6736 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
6743 RetentionPriority.LOW; 6737 RetentionPriority.LOW;
6744 } 6738 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/element_test.dart ('k') | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698