| OLD | NEW |
| 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 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 expect( | 1629 expect( |
| 1630 _context.getResolvedCompilationUnit2(libSource, libSource), | 1630 _context.getResolvedCompilationUnit2(libSource, libSource), |
| 1631 isNotNull, | 1631 isNotNull, |
| 1632 reason: "library resolved 3"); | 1632 reason: "library resolved 3"); |
| 1633 expect( | 1633 expect( |
| 1634 _context.getResolvedCompilationUnit2(partSource, libSource), | 1634 _context.getResolvedCompilationUnit2(partSource, libSource), |
| 1635 isNotNull, | 1635 isNotNull, |
| 1636 reason: "part resolved 3"); | 1636 reason: "part resolved 3"); |
| 1637 } | 1637 } |
| 1638 | 1638 |
| 1639 void test_performAnalysisTask_getContentException_dart() { |
| 1640 // add source that throw an exception on "get content" |
| 1641 Source source = new _Source_getContent_throwException('test.dart'); |
| 1642 { |
| 1643 ChangeSet changeSet = new ChangeSet(); |
| 1644 changeSet.addedSource(source); |
| 1645 _context.applyChanges(changeSet); |
| 1646 } |
| 1647 // prepare errors |
| 1648 _analyzeAll_assertFinished(); |
| 1649 List<AnalysisError> errors = _context.getErrors(source).errors; |
| 1650 // validate errors |
| 1651 expect(errors, hasLength(1)); |
| 1652 AnalysisError error = errors[0]; |
| 1653 expect(error.source, same(source)); |
| 1654 expect(error.errorCode, ScannerErrorCode.UNABLE_GET_CONTENT); |
| 1655 } |
| 1656 |
| 1639 void test_performAnalysisTask_importedLibraryAdd() { | 1657 void test_performAnalysisTask_importedLibraryAdd() { |
| 1640 Source libASource = | 1658 Source libASource = |
| 1641 _addSource("/libA.dart", "library libA; import 'libB.dart';"); | 1659 _addSource("/libA.dart", "library libA; import 'libB.dart';"); |
| 1642 _analyzeAll_assertFinished(); | 1660 _analyzeAll_assertFinished(); |
| 1643 expect( | 1661 expect( |
| 1644 _context.getResolvedCompilationUnit2(libASource, libASource), | 1662 _context.getResolvedCompilationUnit2(libASource, libASource), |
| 1645 isNotNull, | 1663 isNotNull, |
| 1646 reason: "libA resolved 1"); | 1664 reason: "libA resolved 1"); |
| 1647 expect( | 1665 expect( |
| 1648 _hasAnalysisErrorWithErrorSeverity(_context.getErrors(libASource)), | 1666 _hasAnalysisErrorWithErrorSeverity(_context.getErrors(libASource)), |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2212 List<AnalysisError> errors = errorInfo.errors; | 2230 List<AnalysisError> errors = errorInfo.errors; |
| 2213 for (AnalysisError analysisError in errors) { | 2231 for (AnalysisError analysisError in errors) { |
| 2214 if (analysisError.errorCode.errorSeverity == ErrorSeverity.ERROR) { | 2232 if (analysisError.errorCode.errorSeverity == ErrorSeverity.ERROR) { |
| 2215 return true; | 2233 return true; |
| 2216 } | 2234 } |
| 2217 } | 2235 } |
| 2218 return false; | 2236 return false; |
| 2219 } | 2237 } |
| 2220 } | 2238 } |
| 2221 | 2239 |
| 2222 | |
| 2223 class AnalysisContextImplTest_Source_exists_true extends TestSource { | 2240 class AnalysisContextImplTest_Source_exists_true extends TestSource { |
| 2224 @override | 2241 @override |
| 2225 bool exists() => true; | 2242 bool exists() => true; |
| 2226 } | 2243 } |
| 2227 | 2244 |
| 2228 | 2245 |
| 2229 class AnalysisContextImplTest_Source_getModificationStamp_fromSource extends | 2246 class AnalysisContextImplTest_Source_getModificationStamp_fromSource extends |
| 2230 TestSource { | 2247 TestSource { |
| 2231 int stamp; | 2248 int stamp; |
| 2232 AnalysisContextImplTest_Source_getModificationStamp_fromSource(this.stamp); | 2249 AnalysisContextImplTest_Source_getModificationStamp_fromSource(this.stamp); |
| (...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3982 new GenerateDartHintsTaskTestTV_perform(librarySource, partSource)); | 3999 new GenerateDartHintsTaskTestTV_perform(librarySource, partSource)); |
| 3983 } | 4000 } |
| 3984 } | 4001 } |
| 3985 | 4002 |
| 3986 | 4003 |
| 3987 class GenerateDartHintsTaskTestTV_accept extends TestTaskVisitor<bool> { | 4004 class GenerateDartHintsTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 3988 @override | 4005 @override |
| 3989 bool visitGenerateDartHintsTask(GenerateDartHintsTask task) => true; | 4006 bool visitGenerateDartHintsTask(GenerateDartHintsTask task) => true; |
| 3990 } | 4007 } |
| 3991 | 4008 |
| 4009 |
| 3992 class GenerateDartHintsTaskTestTV_perform extends TestTaskVisitor<bool> { | 4010 class GenerateDartHintsTaskTestTV_perform extends TestTaskVisitor<bool> { |
| 3993 Source librarySource; | 4011 Source librarySource; |
| 3994 Source partSource; | 4012 Source partSource; |
| 3995 GenerateDartHintsTaskTestTV_perform(this.librarySource, this.partSource); | 4013 GenerateDartHintsTaskTestTV_perform(this.librarySource, this.partSource); |
| 3996 @override | 4014 @override |
| 3997 bool visitGenerateDartHintsTask(GenerateDartHintsTask task) { | 4015 bool visitGenerateDartHintsTask(GenerateDartHintsTask task) { |
| 3998 CaughtException exception = task.exception; | 4016 CaughtException exception = task.exception; |
| 3999 if (exception != null) { | 4017 if (exception != null) { |
| 4000 throw exception; | 4018 throw exception; |
| 4001 } | 4019 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4108 | 4126 |
| 4109 void test_perform_valid() { | 4127 void test_perform_valid() { |
| 4110 Source source = new TestSource('/test.dart', 'class A {}'); | 4128 Source source = new TestSource('/test.dart', 'class A {}'); |
| 4111 InternalAnalysisContext context = new AnalysisContextImpl(); | 4129 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 4112 context.sourceFactory = new SourceFactory([new FileUriResolver()]); | 4130 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 4113 GetContentTask task = new GetContentTask(context, source); | 4131 GetContentTask task = new GetContentTask(context, source); |
| 4114 task.perform(new GetContentTaskTestTV_perform_valid(context, source)); | 4132 task.perform(new GetContentTaskTestTV_perform_valid(context, source)); |
| 4115 } | 4133 } |
| 4116 } | 4134 } |
| 4117 | 4135 |
| 4118 | |
| 4119 class GetContentTaskTestTV_accept extends TestTaskVisitor<bool> { | 4136 class GetContentTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 4120 @override | 4137 @override |
| 4121 bool visitGetContentTask(GetContentTask task) => true; | 4138 bool visitGetContentTask(GetContentTask task) => true; |
| 4122 } | 4139 } |
| 4123 | 4140 |
| 4141 |
| 4124 class GetContentTaskTestTV_perform_exception extends TestTaskVisitor<bool> { | 4142 class GetContentTaskTestTV_perform_exception extends TestTaskVisitor<bool> { |
| 4125 @override | 4143 @override |
| 4126 bool visitGetContentTask(GetContentTask task) { | 4144 bool visitGetContentTask(GetContentTask task) { |
| 4127 expect(task.exception, isNotNull); | 4145 expect(task.exception, isNotNull); |
| 4128 return true; | 4146 return true; |
| 4129 } | 4147 } |
| 4130 } | 4148 } |
| 4131 | 4149 |
| 4132 | |
| 4133 class GetContentTaskTestTV_perform_valid extends TestTaskVisitor<bool> { | 4150 class GetContentTaskTestTV_perform_valid extends TestTaskVisitor<bool> { |
| 4134 InternalAnalysisContext context; | 4151 InternalAnalysisContext context; |
| 4135 Source source; | 4152 Source source; |
| 4136 GetContentTaskTestTV_perform_valid(this.context, this.source); | 4153 GetContentTaskTestTV_perform_valid(this.context, this.source); |
| 4137 @override | 4154 @override |
| 4138 bool visitGetContentTask(GetContentTask task) { | 4155 bool visitGetContentTask(GetContentTask task) { |
| 4139 CaughtException exception = task.exception; | 4156 CaughtException exception = task.exception; |
| 4140 if (exception != null) { | 4157 if (exception != null) { |
| 4141 throw exception; | 4158 throw exception; |
| 4142 } | 4159 } |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4992 expect(visited, isTrue); | 5009 expect(visited, isTrue); |
| 4993 } | 5010 } |
| 4994 | 5011 |
| 4995 @override | 5012 @override |
| 4996 Object visitCompilationUnit(CompilationUnit node) { | 5013 Object visitCompilationUnit(CompilationUnit node) { |
| 4997 visited = true; | 5014 visited = true; |
| 4998 return null; | 5015 return null; |
| 4999 } | 5016 } |
| 5000 } | 5017 } |
| 5001 | 5018 |
| 5019 |
| 5002 class LintGeneratorTest_Linter_Null_Visitor extends Linter { | 5020 class LintGeneratorTest_Linter_Null_Visitor extends Linter { |
| 5003 @override | 5021 @override |
| 5004 AstVisitor getVisitor() => null; | 5022 AstVisitor getVisitor() => null; |
| 5005 } | 5023 } |
| 5006 | 5024 |
| 5007 | |
| 5008 @reflectiveTest | 5025 @reflectiveTest |
| 5009 class ParseDartTaskTest extends EngineTestCase { | 5026 class ParseDartTaskTest extends EngineTestCase { |
| 5010 void test_accept() { | 5027 void test_accept() { |
| 5011 ParseDartTask task = new ParseDartTask(null, null, null, null); | 5028 ParseDartTask task = new ParseDartTask(null, null, null, null); |
| 5012 expect(task.accept(new ParseDartTaskTestTV_accept()), isTrue); | 5029 expect(task.accept(new ParseDartTaskTestTV_accept()), isTrue); |
| 5013 } | 5030 } |
| 5014 | 5031 |
| 5015 void test_getCompilationUnit() { | 5032 void test_getCompilationUnit() { |
| 5016 ParseDartTask task = new ParseDartTask(null, null, null, null); | 5033 ParseDartTask task = new ParseDartTask(null, null, null, null); |
| 5017 expect(task.compilationUnit, isNull); | 5034 expect(task.compilationUnit, isNull); |
| (...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7086 | 7103 |
| 7087 class _AnalysisContextImplTest_test_applyChanges_removeContainer implements | 7104 class _AnalysisContextImplTest_test_applyChanges_removeContainer implements |
| 7088 SourceContainer { | 7105 SourceContainer { |
| 7089 Source libB; | 7106 Source libB; |
| 7090 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); | 7107 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); |
| 7091 @override | 7108 @override |
| 7092 bool contains(Source source) => source == libB; | 7109 bool contains(Source source) => source == libB; |
| 7093 } | 7110 } |
| 7094 | 7111 |
| 7095 | 7112 |
| 7113 class _Source_getContent_throwException extends NonExistingSource { |
| 7114 _Source_getContent_throwException(String name) |
| 7115 : super(name, UriKind.FILE_URI); |
| 7116 |
| 7117 @override |
| 7118 TimestampedData<String> get contents { |
| 7119 throw 'Read error'; |
| 7120 } |
| 7121 } |
| 7122 |
| 7123 |
| 7096 class _UniversalCachePartitionTest_test_setMaxCacheSize implements | 7124 class _UniversalCachePartitionTest_test_setMaxCacheSize implements |
| 7097 CacheRetentionPolicy { | 7125 CacheRetentionPolicy { |
| 7098 @override | 7126 @override |
| 7099 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => | 7127 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => |
| 7100 RetentionPriority.LOW; | 7128 RetentionPriority.LOW; |
| 7101 } | 7129 } |
| OLD | NEW |