| 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 // // This code was auto-generated, is not intended to be edited, and is subject
to | 4 |
| 5 // // significant change. Please see the README file for more information. | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // library engine.engine_test; | 6 // significant change. Please see the README file for more information. |
| 7 // import 'dart:collection'; | 7 |
| 8 // import 'package:analyzer/src/generated/ast.dart'; | 8 library engine.engine_test; |
| 9 // import 'package:analyzer/src/generated/element.dart'; | 9 |
| 10 // import 'package:analyzer/src/generated/engine.dart'; | 10 import 'dart:collection'; |
| 11 // import 'package:analyzer/src/generated/error.dart'; | 11 |
| 12 // import 'package:analyzer/src/generated/java_core.dart'; | 12 import 'package:analyzer/src/generated/ast.dart'; |
| 13 // import 'package:analyzer/src/generated/java_engine.dart'; | 13 import 'package:analyzer/src/generated/constant.dart'; |
| 14 // import 'package:analyzer/src/generated/java_engine_io.dart'; | 14 import 'package:analyzer/src/generated/element.dart'; |
| 15 // import 'package:analyzer/src/generated/java_io.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 16 // import 'package:analyzer/src/generated/java_junit.dart'; | 16 import 'package:analyzer/src/generated/error.dart'; |
| 17 // import 'package:analyzer/src/generated/parser.dart'; | 17 import 'package:analyzer/src/generated/html.dart' as ht; |
| 18 // import 'package:analyzer/src/generated/resolver.dart'; | 18 import 'package:analyzer/src/generated/java_core.dart'; |
| 19 // import 'package:analyzer/src/generated/scanner.dart'; | 19 import 'package:analyzer/src/generated/java_engine.dart'; |
| 20 // import 'package:analyzer/src/generated/source_io.dart'; | 20 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 21 // import 'package:unittest/unittest.dart' as _ut; | 21 import 'package:analyzer/src/generated/java_junit.dart'; |
| 22 // import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 22 import 'package:analyzer/src/generated/parser.dart'; |
| 23 // import 'package:analyzer/src/generated/testing/element_factory.dart'; | 23 import 'package:analyzer/src/generated/resolver.dart'; |
| 24 // import 'resolver_test.dart'; | 24 import 'package:analyzer/src/generated/scanner.dart'; |
| 25 // import 'test_support.dart'; | 25 import 'package:analyzer/src/generated/sdk.dart'; |
| 26 // class AnalysisCacheTest extends EngineTestCase { | 26 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 27 // void test_creation() { | 27 import 'package:analyzer/src/generated/source_io.dart'; |
| 28 // JUnitTestCase.assertNotNull(new AnalysisCache(new List<CachePartition>(0)
)); | 28 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 29 // } | 29 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 30 // void test_get() { | 30 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 31 // AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); | 31 import 'package:typed_mock/typed_mock.dart'; |
| 32 // TestSource source = new TestSource(); | 32 import 'package:unittest/unittest.dart' as _ut; |
| 33 // JUnitTestCase.assertNull(cache.get(source)); | 33 |
| 34 // } | 34 import 'all_the_rest.dart'; |
| 35 // void test_iterator() { | 35 import 'resolver_test.dart'; |
| 36 // CachePartition partition = new UniversalCachePartition(null, 8, new Defau
ltRetentionPolicy()); | 36 import 'test_support.dart'; |
| 37 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); | 37 |
| 38 // TestSource source = new TestSource(); | |
| 39 // DartEntryImpl entry = new DartEntryImpl(); | |
| 40 // cache.put(source, entry); | |
| 41 // MapIterator<Source, SourceEntry> iterator = cache.iterator(); | |
| 42 // JUnitTestCase.assertTrue(iterator.moveNext()); | |
| 43 // JUnitTestCase.assertSame(source, iterator.key); | |
| 44 // JUnitTestCase.assertSame(entry, iterator.value); | |
| 45 // JUnitTestCase.assertFalse(iterator.moveNext()); | |
| 46 // } | |
| 47 // void test_put_noFlush() { | |
| 48 // CachePartition partition = new UniversalCachePartition(null, 8, new Defau
ltRetentionPolicy()); | |
| 49 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); | |
| 50 // TestSource source = new TestSource(); | |
| 51 // DartEntryImpl entry = new DartEntryImpl(); | |
| 52 // cache.put(source, entry); | |
| 53 // JUnitTestCase.assertSame(entry, cache.get(source)); | |
| 54 // } | |
| 55 // void test_setMaxCacheSize() { | |
| 56 // CachePartition partition = new UniversalCachePartition(null, 8, new Cache
RetentionPolicy_AnalysisCacheTest_test_setMaxCacheSize()); | |
| 57 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); | |
| 58 // int size = 6; | |
| 59 // for (int i = 0; i < size; i++) { | |
| 60 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); | |
| 61 // DartEntryImpl entry = new DartEntryImpl(); | |
| 62 // entry.setValue(DartEntry.PARSED_UNIT, null); | |
| 63 // cache.put(source, entry); | |
| 64 // cache.accessedAst(source); | |
| 65 // } | |
| 66 // _assertNonFlushedCount(size, cache); | |
| 67 // int newSize = size - 2; | |
| 68 // partition.maxCacheSize = newSize; | |
| 69 // _assertNonFlushedCount(newSize, cache); | |
| 70 // } | |
| 71 // void test_size() { | |
| 72 // CachePartition partition = new UniversalCachePartition(null, 8, new Defau
ltRetentionPolicy()); | |
| 73 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); | |
| 74 // int size = 4; | |
| 75 // for (int i = 0; i < size; i++) { | |
| 76 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); | |
| 77 // cache.put(source, new DartEntryImpl()); | |
| 78 // cache.accessedAst(source); | |
| 79 // } | |
| 80 // JUnitTestCase.assertEquals(size, cache.size()); | |
| 81 // } | |
| 82 // void _assertNonFlushedCount(int expectedCount, AnalysisCache cache) { | |
| 83 // int nonFlushedCount = 0; | |
| 84 // MapIterator<Source, SourceEntry> iterator = cache.iterator(); | |
| 85 // while (iterator.moveNext()) { | |
| 86 // if (iterator.value.getState(DartEntry.PARSED_UNIT) != CacheState.FLUSHE
D) { | |
| 87 // nonFlushedCount++; | |
| 88 // } | |
| 89 // } | |
| 90 // JUnitTestCase.assertEquals(expectedCount, nonFlushedCount); | |
| 91 // } | |
| 92 // static dartSuite() { | |
| 93 // _ut.group('AnalysisCacheTest', () { | |
| 94 // _ut.test('test_creation', () { | |
| 95 // final __test = new AnalysisCacheTest(); | |
| 96 // runJUnitTest(__test, __test.test_creation); | |
| 97 // }); | |
| 98 // _ut.test('test_get', () { | |
| 99 // final __test = new AnalysisCacheTest(); | |
| 100 // runJUnitTest(__test, __test.test_get); | |
| 101 // }); | |
| 102 // _ut.test('test_iterator', () { | |
| 103 // final __test = new AnalysisCacheTest(); | |
| 104 // runJUnitTest(__test, __test.test_iterator); | |
| 105 // }); | |
| 106 // _ut.test('test_put_noFlush', () { | |
| 107 // final __test = new AnalysisCacheTest(); | |
| 108 // runJUnitTest(__test, __test.test_put_noFlush); | |
| 109 // }); | |
| 110 // _ut.test('test_setMaxCacheSize', () { | |
| 111 // final __test = new AnalysisCacheTest(); | |
| 112 // runJUnitTest(__test, __test.test_setMaxCacheSize); | |
| 113 // }); | |
| 114 // _ut.test('test_size', () { | |
| 115 // final __test = new AnalysisCacheTest(); | |
| 116 // runJUnitTest(__test, __test.test_size); | |
| 117 // }); | |
| 118 // }); | |
| 119 // } | |
| 120 // } | |
| 121 // class AnalysisContextFactory_AnalysisContextForTests_AnalysisContextImplTest_
test_resolveCompilationUnit_sourceChangeDuringResolution extends AnalysisContext
Factory_AnalysisContextForTests { | |
| 122 // @override | |
| 123 // DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task)
{ | |
| 124 // ChangeSet changeSet = new ChangeSet(); | |
| 125 // changeSet.changedSource(task.librarySource); | |
| 126 // applyChanges(changeSet); | |
| 127 // return super.recordResolveDartLibraryTaskResults(task); | |
| 128 // } | |
| 129 // } | |
| 130 // class AnalysisContextImplTest extends EngineTestCase { | |
| 131 // /** | |
| 132 // * Returns `true` if there is an [AnalysisError] with [ErrorSeverity#ERROR]
in | |
| 133 // * the given [AnalysisErrorInfo]. | |
| 134 // */ | |
| 135 // static bool _hasAnalysisErrorWithErrorSeverity(AnalysisErrorInfo errorInfo)
{ | |
| 136 // List<AnalysisError> errors = errorInfo.errors; | |
| 137 // for (AnalysisError analysisError in errors) { | |
| 138 // if (analysisError.errorCode.errorSeverity == ErrorSeverity.ERROR) { | |
| 139 // return true; | |
| 140 // } | |
| 141 // } | |
| 142 // return false; | |
| 143 // } | |
| 144 // /** | |
| 145 // * An analysis context whose source factory is [sourceFactory]. | |
| 146 // */ | |
| 147 // AnalysisContextImpl _context; | |
| 148 // /** | |
| 149 // * The source factory associated with the analysis [context]. | |
| 150 // */ | |
| 151 // SourceFactory _sourceFactory; | |
| 152 // void fail_extractContext() { | |
| 153 // JUnitTestCase.fail("Implement this"); | |
| 154 // } | |
| 155 // void fail_mergeContext() { | |
| 156 // JUnitTestCase.fail("Implement this"); | |
| 157 // } | |
| 158 // void fail_performAnalysisTask_importedLibraryDelete_html() { | |
| 159 // Source htmlSource = _addSource("/page.html", EngineTestCase.createSource(
[ | |
| 160 // "<html><body><script type=\"application/dart\">", | |
| 161 // " import 'libB.dart';", | |
| 162 // " main() {print('hello dart');}", | |
| 163 // "</script></body></html>"])); | |
| 164 // Source libBSource = _addSource("/libB.dart", "library libB;"); | |
| 165 // _analyzeAll_assertFinished(); | |
| 166 // JUnitTestCase.assertNotNullMsg("htmlUnit resolved 1", _context.getResolve
dHtmlUnit(htmlSource)); | |
| 167 // JUnitTestCase.assertNotNullMsg("libB resolved 1", _context.getResolvedCom
pilationUnit2(libBSource, libBSource)); | |
| 168 // JUnitTestCase.assertTrueMsg("htmlSource doesn't have errors", !_hasAnalys
isErrorWithErrorSeverity(_context.getErrors(htmlSource))); | |
| 169 // // remove libB.dart content and analyze | |
| 170 // _context.setContents(libBSource, null); | |
| 171 // _analyzeAll_assertFinished(); | |
| 172 // JUnitTestCase.assertNotNullMsg("htmlUnit resolved 1", _context.getResolve
dHtmlUnit(htmlSource)); | |
| 173 // AnalysisErrorInfo errors = _context.getErrors(htmlSource); | |
| 174 // JUnitTestCase.assertTrueMsg("htmlSource has an error", _hasAnalysisErrorW
ithErrorSeverity(errors)); | |
| 175 // } | |
| 176 // void fail_recordLibraryElements() { | |
| 177 // JUnitTestCase.fail("Implement this"); | |
| 178 // } | |
| 179 // @override | |
| 180 // void setUp() { | |
| 181 // _context = new AnalysisContextImpl(); | |
| 182 // _sourceFactory = new SourceFactory([ | |
| 183 // new DartUriResolver(DirectoryBasedDartSdk.defaultSdk), | |
| 184 // new FileUriResolver()]); | |
| 185 // _context.sourceFactory = _sourceFactory; | |
| 186 // AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(_context.analy
sisOptions); | |
| 187 // options.cacheSize = 256; | |
| 188 // _context.analysisOptions = options; | |
| 189 // } | |
| 190 // void test_applyChanges_add() { | |
| 191 // JUnitTestCase.assertTrue(_context.sourcesNeedingProcessing.isEmpty); | |
| 192 // Source source = _addSource("/test.dart", "main() {}"); | |
| 193 // JUnitTestCase.assertTrue(_context.sourcesNeedingProcessing.contains(sourc
e)); | |
| 194 // } | |
| 195 // void test_applyChanges_change_flush_element() { | |
| 196 // _context = AnalysisContextFactory.contextWithCore(); | |
| 197 // _sourceFactory = _context.sourceFactory; | |
| 198 // Source librarySource = _addSource("/lib.dart", EngineTestCase.createSourc
e(["library lib;", "int a = 0;"])); | |
| 199 // JUnitTestCase.assertNotNull(_context.computeLibraryElement(librarySource)
); | |
| 200 // _context.setContents(librarySource, EngineTestCase.createSource(["library
lib;", "int aa = 0;"])); | |
| 201 // JUnitTestCase.assertNull(_context.getLibraryElement(librarySource)); | |
| 202 // } | |
| 203 // void test_applyChanges_change_multiple() { | |
| 204 // _context = AnalysisContextFactory.contextWithCore(); | |
| 205 // _sourceFactory = _context.sourceFactory; | |
| 206 // Source librarySource = _addSource("/lib.dart", EngineTestCase.createSourc
e(["library lib;", "part 'part.dart';", "int a = 0;"])); | |
| 207 // Source partSource = _addSource("/part.dart", EngineTestCase.createSource(
["part of lib;", "int b = a;"])); | |
| 208 // _context.computeLibraryElement(librarySource); | |
| 209 // _context.setContents(librarySource, EngineTestCase.createSource(["library
lib;", "part 'part.dart';", "int aa = 0;"])); | |
| 210 // _context.setContents(partSource, EngineTestCase.createSource(["part of li
b;", "int b = aa;"])); | |
| 211 // _context.computeLibraryElement(librarySource); | |
| 212 // CompilationUnit libraryUnit = _context.resolveCompilationUnit2(librarySou
rce, librarySource); | |
| 213 // CompilationUnit partUnit = _context.resolveCompilationUnit2(partSource, l
ibrarySource); | |
| 214 // TopLevelVariableDeclaration declaration = libraryUnit.declarations[0] as
TopLevelVariableDeclaration; | |
| 215 // Element declarationElement = declaration.variables.variables[0].element; | |
| 216 // TopLevelVariableDeclaration use = partUnit.declarations[0] as TopLevelVar
iableDeclaration; | |
| 217 // Element useElement = (use.variables.variables[0].initializer as SimpleIde
ntifier).staticElement; | |
| 218 // JUnitTestCase.assertSame(declarationElement, (useElement as PropertyAcces
sorElement).variable); | |
| 219 // } | |
| 220 // void test_applyChanges_empty() { | |
| 221 // _context.applyChanges(new ChangeSet()); | |
| 222 // JUnitTestCase.assertNull(_context.performAnalysisTask().changeNotices); | |
| 223 // } | |
| 224 // void test_applyChanges_overriddenSource() { | |
| 225 // // Note: addSource adds the source to the contentCache. | |
| 226 // Source source = _addSource("/test.dart", "library test;"); | |
| 227 // _context.computeErrors(source); | |
| 228 // while (!_context.sourcesNeedingProcessing.isEmpty) { | |
| 229 // _context.performAnalysisTask(); | |
| 230 // } | |
| 231 // // Adding the source as a changedSource should have no effect since it is
already overridden | |
| 232 // // in the content cache. | |
| 233 // ChangeSet changeSet = new ChangeSet(); | |
| 234 // changeSet.changedSource(source); | |
| 235 // _context.applyChanges(changeSet); | |
| 236 // EngineTestCase.assertSizeOfList(0, _context.sourcesNeedingProcessing); | |
| 237 // } | |
| 238 // void test_applyChanges_remove() { | |
| 239 // _context = AnalysisContextFactory.contextWithCore(); | |
| 240 // _sourceFactory = _context.sourceFactory; | |
| 241 // Source libA = _addSource("/libA.dart", EngineTestCase.createSource(["libr
ary libA;", "import 'libB.dart';"])); | |
| 242 // Source libB = _addSource("/libB.dart", EngineTestCase.createSource(["libr
ary libB;"])); | |
| 243 // LibraryElement libAElement = _context.computeLibraryElement(libA); | |
| 244 // List<LibraryElement> importedLibraries = libAElement.importedLibraries; | |
| 245 // EngineTestCase.assertLength(2, importedLibraries); | |
| 246 // _context.computeErrors(libA); | |
| 247 // _context.computeErrors(libB); | |
| 248 // EngineTestCase.assertSizeOfList(0, _context.sourcesNeedingProcessing); | |
| 249 // _context.setContents(libB, null); | |
| 250 // _removeSource(libB); | |
| 251 // List<Source> sources = _context.sourcesNeedingProcessing; | |
| 252 // EngineTestCase.assertSizeOfList(1, sources); | |
| 253 // JUnitTestCase.assertSame(libA, sources[0]); | |
| 254 // libAElement = _context.computeLibraryElement(libA); | |
| 255 // importedLibraries = libAElement.importedLibraries; | |
| 256 // EngineTestCase.assertLength(1, importedLibraries); | |
| 257 // } | |
| 258 // void test_applyChanges_removeContainer() { | |
| 259 // _context = AnalysisContextFactory.contextWithCore(); | |
| 260 // _sourceFactory = _context.sourceFactory; | |
| 261 // Source libA = _addSource("/libA.dart", EngineTestCase.createSource(["libr
ary libA;", "import 'libB.dart';"])); | |
| 262 // Source libB = _addSource("/libB.dart", EngineTestCase.createSource(["libr
ary libB;"])); | |
| 263 // _context.computeLibraryElement(libA); | |
| 264 // _context.computeErrors(libA); | |
| 265 // _context.computeErrors(libB); | |
| 266 // EngineTestCase.assertSizeOfList(0, _context.sourcesNeedingProcessing); | |
| 267 // ChangeSet changeSet = new ChangeSet(); | |
| 268 // changeSet.removedContainer(new SourceContainer_AnalysisContextImplTest_te
st_applyChanges_removeContainer(libB)); | |
| 269 // _context.applyChanges(changeSet); | |
| 270 // List<Source> sources = _context.sourcesNeedingProcessing; | |
| 271 // EngineTestCase.assertSizeOfList(1, sources); | |
| 272 // JUnitTestCase.assertSame(libA, sources[0]); | |
| 273 // } | |
| 274 // void test_computeDocumentationComment_block() { | |
| 275 // _context = AnalysisContextFactory.contextWithCore(); | |
| 276 // _sourceFactory = _context.sourceFactory; | |
| 277 // String comment = "/** Comment */"; | |
| 278 // Source source = _addSource("/test.dart", EngineTestCase.createSource([com
ment, "class A {}"])); | |
| 279 // LibraryElement libraryElement = _context.computeLibraryElement(source); | |
| 280 // JUnitTestCase.assertNotNull(libraryElement); | |
| 281 // ClassElement classElement = libraryElement.definingCompilationUnit.types[
0]; | |
| 282 // JUnitTestCase.assertNotNull(libraryElement); | |
| 283 // JUnitTestCase.assertEquals(comment, _context.computeDocumentationComment(
classElement)); | |
| 284 // } | |
| 285 // void test_computeDocumentationComment_none() { | |
| 286 // _context = AnalysisContextFactory.contextWithCore(); | |
| 287 // _sourceFactory = _context.sourceFactory; | |
| 288 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["cl
ass A {}"])); | |
| 289 // LibraryElement libraryElement = _context.computeLibraryElement(source); | |
| 290 // JUnitTestCase.assertNotNull(libraryElement); | |
| 291 // ClassElement classElement = libraryElement.definingCompilationUnit.types[
0]; | |
| 292 // JUnitTestCase.assertNotNull(libraryElement); | |
| 293 // JUnitTestCase.assertNull(_context.computeDocumentationComment(classElemen
t)); | |
| 294 // } | |
| 295 // void test_computeDocumentationComment_null() { | |
| 296 // JUnitTestCase.assertNull(_context.computeDocumentationComment(null)); | |
| 297 // } | |
| 298 // void test_computeDocumentationComment_singleLine_multiple_EOL_n() { | |
| 299 // _context = AnalysisContextFactory.contextWithCore(); | |
| 300 // _sourceFactory = _context.sourceFactory; | |
| 301 // String comment = "/// line 1\n/// line 2\n/// line 3\n"; | |
| 302 // Source source = _addSource("/test.dart", "${comment}class A {}"); | |
| 303 // LibraryElement libraryElement = _context.computeLibraryElement(source); | |
| 304 // JUnitTestCase.assertNotNull(libraryElement); | |
| 305 // ClassElement classElement = libraryElement.definingCompilationUnit.types[
0]; | |
| 306 // JUnitTestCase.assertNotNull(libraryElement); | |
| 307 // String actual = _context.computeDocumentationComment(classElement); | |
| 308 // JUnitTestCase.assertEquals("/// line 1\n/// line 2\n/// line 3", actual); | |
| 309 // } | |
| 310 // void test_computeDocumentationComment_singleLine_multiple_EOL_rn() { | |
| 311 // _context = AnalysisContextFactory.contextWithCore(); | |
| 312 // _sourceFactory = _context.sourceFactory; | |
| 313 // String comment = "/// line 1\r\n/// line 2\r\n/// line 3\r\n"; | |
| 314 // Source source = _addSource("/test.dart", "${comment}class A {}"); | |
| 315 // LibraryElement libraryElement = _context.computeLibraryElement(source); | |
| 316 // JUnitTestCase.assertNotNull(libraryElement); | |
| 317 // ClassElement classElement = libraryElement.definingCompilationUnit.types[
0]; | |
| 318 // JUnitTestCase.assertNotNull(libraryElement); | |
| 319 // String actual = _context.computeDocumentationComment(classElement); | |
| 320 // JUnitTestCase.assertEquals("/// line 1\n/// line 2\n/// line 3", actual); | |
| 321 // } | |
| 322 // void test_computeErrors_dart_none() { | |
| 323 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 324 // List<AnalysisError> errors = _context.computeErrors(source); | |
| 325 // EngineTestCase.assertLength(0, errors); | |
| 326 // } | |
| 327 // void test_computeErrors_dart_part() { | |
| 328 // Source librarySource = _addSource("/lib.dart", "library lib; part 'part.d
art';"); | |
| 329 // Source partSource = _addSource("/part.dart", "part of 'lib';"); | |
| 330 // _context.parseCompilationUnit(librarySource); | |
| 331 // List<AnalysisError> errors = _context.computeErrors(partSource); | |
| 332 // JUnitTestCase.assertNotNull(errors); | |
| 333 // JUnitTestCase.assertTrue(errors.length > 0); | |
| 334 // } | |
| 335 // void test_computeErrors_dart_some() { | |
| 336 // Source source = _addSource("/lib.dart", "library 'lib';"); | |
| 337 // List<AnalysisError> errors = _context.computeErrors(source); | |
| 338 // JUnitTestCase.assertNotNull(errors); | |
| 339 // JUnitTestCase.assertTrue(errors.length > 0); | |
| 340 // } | |
| 341 // void test_computeErrors_html_none() { | |
| 342 // Source source = _addSource("/test.html", "<html></html>"); | |
| 343 // List<AnalysisError> errors = _context.computeErrors(source); | |
| 344 // EngineTestCase.assertLength(0, errors); | |
| 345 // } | |
| 346 // void test_computeExportedLibraries_none() { | |
| 347 // Source source = _addSource("/test.dart", "library test;"); | |
| 348 // EngineTestCase.assertLength(0, _context.computeExportedLibraries(source))
; | |
| 349 // } | |
| 350 // void test_computeExportedLibraries_some() { | |
| 351 // // addSource("/lib1.dart", "library lib1;"); | |
| 352 // // addSource("/lib2.dart", "library lib2;"); | |
| 353 // Source source = _addSource("/test.dart", "library test; export 'lib1.dart
'; export 'lib2.dart';"); | |
| 354 // EngineTestCase.assertLength(2, _context.computeExportedLibraries(source))
; | |
| 355 // } | |
| 356 // void test_computeHtmlElement_nonHtml() { | |
| 357 // Source source = _addSource("/test.dart", "library test;"); | |
| 358 // JUnitTestCase.assertNull(_context.computeHtmlElement(source)); | |
| 359 // } | |
| 360 // void test_computeHtmlElement_valid() { | |
| 361 // Source source = _addSource("/test.html", "<html></html>"); | |
| 362 // HtmlElement element = _context.computeHtmlElement(source); | |
| 363 // JUnitTestCase.assertNotNull(element); | |
| 364 // JUnitTestCase.assertSame(element, _context.computeHtmlElement(source)); | |
| 365 // } | |
| 366 // void test_computeImportedLibraries_none() { | |
| 367 // Source source = _addSource("/test.dart", "library test;"); | |
| 368 // EngineTestCase.assertLength(0, _context.computeImportedLibraries(source))
; | |
| 369 // } | |
| 370 // void test_computeImportedLibraries_some() { | |
| 371 // // addSource("/lib1.dart", "library lib1;"); | |
| 372 // // addSource("/lib2.dart", "library lib2;"); | |
| 373 // Source source = _addSource("/test.dart", "library test; import 'lib1.dart
'; import 'lib2.dart';"); | |
| 374 // EngineTestCase.assertLength(2, _context.computeImportedLibraries(source))
; | |
| 375 // } | |
| 376 // void test_computeKindOf_html() { | |
| 377 // Source source = _addSource("/test.html", ""); | |
| 378 // JUnitTestCase.assertSame(SourceKind.HTML, _context.computeKindOf(source))
; | |
| 379 // } | |
| 380 // void test_computeKindOf_library() { | |
| 381 // Source source = _addSource("/test.dart", "library lib;"); | |
| 382 // JUnitTestCase.assertSame(SourceKind.LIBRARY, _context.computeKindOf(sourc
e)); | |
| 383 // } | |
| 384 // void test_computeKindOf_libraryAndPart() { | |
| 385 // Source source = _addSource("/test.dart", "library lib; part of lib;"); | |
| 386 // JUnitTestCase.assertSame(SourceKind.LIBRARY, _context.computeKindOf(sourc
e)); | |
| 387 // } | |
| 388 // void test_computeKindOf_part() { | |
| 389 // Source source = _addSource("/test.dart", "part of lib;"); | |
| 390 // JUnitTestCase.assertSame(SourceKind.PART, _context.computeKindOf(source))
; | |
| 391 // } | |
| 392 // void test_computeLibraryElement() { | |
| 393 // _context = AnalysisContextFactory.contextWithCore(); | |
| 394 // _sourceFactory = _context.sourceFactory; | |
| 395 // Source source = _addSource("/test.dart", "library lib;"); | |
| 396 // LibraryElement element = _context.computeLibraryElement(source); | |
| 397 // JUnitTestCase.assertNotNull(element); | |
| 398 // } | |
| 399 // void test_computeLineInfo_dart() { | |
| 400 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["li
brary lib;", "", "main() {}"])); | |
| 401 // LineInfo info = _context.computeLineInfo(source); | |
| 402 // JUnitTestCase.assertNotNull(info); | |
| 403 // } | |
| 404 // void test_computeLineInfo_html() { | |
| 405 // Source source = _addSource("/test.html", EngineTestCase.createSource([ | |
| 406 // "<html>", | |
| 407 // " <body>", | |
| 408 // " <h1>A</h1>", | |
| 409 // " </body>", | |
| 410 // "</html>"])); | |
| 411 // LineInfo info = _context.computeLineInfo(source); | |
| 412 // JUnitTestCase.assertNotNull(info); | |
| 413 // } | |
| 414 // void test_computeResolvableCompilationUnit_dart_exception() { | |
| 415 // TestSource source = _addSourceWithException("/test.dart"); | |
| 416 // try { | |
| 417 // _context.computeResolvableCompilationUnit(source); | |
| 418 // JUnitTestCase.fail("Expected AnalysisException"); | |
| 419 // } on AnalysisException catch (exception) { | |
| 420 // } | |
| 421 // } | |
| 422 // void test_computeResolvableCompilationUnit_html_exception() { | |
| 423 // Source source = _addSource("/lib.html", "<html></html>"); | |
| 424 // try { | |
| 425 // _context.computeResolvableCompilationUnit(source); | |
| 426 // JUnitTestCase.fail("Expected AnalysisException"); | |
| 427 // } on AnalysisException catch (exception) { | |
| 428 // } | |
| 429 // } | |
| 430 // void test_computeResolvableCompilationUnit_valid() { | |
| 431 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 432 // CompilationUnit parsedUnit = _context.parseCompilationUnit(source); | |
| 433 // JUnitTestCase.assertNotNull(parsedUnit); | |
| 434 // CompilationUnit resolvedUnit = _context.computeResolvableCompilationUnit(
source).compilationUnit; | |
| 435 // JUnitTestCase.assertNotNull(resolvedUnit); | |
| 436 // JUnitTestCase.assertNotSame(parsedUnit, resolvedUnit); | |
| 437 // } | |
| 438 // void test_dispose() { | |
| 439 // JUnitTestCase.assertFalse(_context.isDisposed); | |
| 440 // _context.dispose(); | |
| 441 // JUnitTestCase.assertTrue(_context.isDisposed); | |
| 442 // } | |
| 443 // void test_exists_false() { | |
| 444 // JUnitTestCase.assertFalse(_context.exists(new TestSource())); | |
| 445 // } | |
| 446 // void test_exists_null() { | |
| 447 // JUnitTestCase.assertFalse(_context.exists(null)); | |
| 448 // } | |
| 449 // void test_exists_overridden() { | |
| 450 // Source source = new TestSource(); | |
| 451 // _context.setContents(source, ""); | |
| 452 // JUnitTestCase.assertTrue(_context.exists(source)); | |
| 453 // } | |
| 454 // void test_exists_true() { | |
| 455 // JUnitTestCase.assertTrue(_context.exists(new TestSource_AnalysisContextIm
plTest_test_exists_true())); | |
| 456 // } | |
| 457 // void test_getAnalysisOptions() { | |
| 458 // JUnitTestCase.assertNotNull(_context.analysisOptions); | |
| 459 // } | |
| 460 // void test_getContents_fromSource() { | |
| 461 // String content = "library lib;"; | |
| 462 // TimestampedData<String> contents = _context.getContents(new TestSource.co
n2(content)); | |
| 463 // JUnitTestCase.assertEquals(content, contents.data.toString()); | |
| 464 // } | |
| 465 // void test_getContents_overridden() { | |
| 466 // String content = "library lib;"; | |
| 467 // Source source = new TestSource(); | |
| 468 // _context.setContents(source, content); | |
| 469 // TimestampedData<String> contents = _context.getContents(source); | |
| 470 // JUnitTestCase.assertEquals(content, contents.data.toString()); | |
| 471 // } | |
| 472 // void test_getContents_unoverridden() { | |
| 473 // String content = "library lib;"; | |
| 474 // Source source = new TestSource.con2(content); | |
| 475 // _context.setContents(source, "part of lib;"); | |
| 476 // _context.setContents(source, null); | |
| 477 // TimestampedData<String> contents = _context.getContents(source); | |
| 478 // JUnitTestCase.assertEquals(content, contents.data.toString()); | |
| 479 // } | |
| 480 // void test_getDeclaredVariables() { | |
| 481 // _context = AnalysisContextFactory.contextWithCore(); | |
| 482 // JUnitTestCase.assertNotNull(_context.declaredVariables); | |
| 483 // } | |
| 484 // void test_getElement() { | |
| 485 // _context = AnalysisContextFactory.contextWithCore(); | |
| 486 // _sourceFactory = _context.sourceFactory; | |
| 487 // LibraryElement core = _context.computeLibraryElement(_sourceFactory.forUr
i("dart:core")); | |
| 488 // JUnitTestCase.assertNotNull(core); | |
| 489 // ClassElement classObject = _findClass(core.definingCompilationUnit, "Obje
ct"); | |
| 490 // JUnitTestCase.assertNotNull(classObject); | |
| 491 // ElementLocation location = classObject.location; | |
| 492 // Element element = _context.getElement(location); | |
| 493 // JUnitTestCase.assertSame(classObject, element); | |
| 494 // } | |
| 495 // void test_getElement_constructor_named() { | |
| 496 // Source source = _addSource("/lib.dart", EngineTestCase.createSource(["cla
ss A {", " A.named() {}", "}"])); | |
| 497 // _analyzeAll_assertFinished(); | |
| 498 // LibraryElement library = _context.computeLibraryElement(source); | |
| 499 // ClassElement classA = _findClass(library.definingCompilationUnit, "A"); | |
| 500 // ConstructorElement constructor = classA.constructors[0]; | |
| 501 // ElementLocation location = constructor.location; | |
| 502 // Element element = _context.getElement(location); | |
| 503 // JUnitTestCase.assertSame(constructor, element); | |
| 504 // } | |
| 505 // void test_getElement_constructor_unnamed() { | |
| 506 // Source source = _addSource("/lib.dart", EngineTestCase.createSource(["cla
ss A {", " A() {}", "}"])); | |
| 507 // _analyzeAll_assertFinished(); | |
| 508 // LibraryElement library = _context.computeLibraryElement(source); | |
| 509 // ClassElement classA = _findClass(library.definingCompilationUnit, "A"); | |
| 510 // ConstructorElement constructor = classA.constructors[0]; | |
| 511 // ElementLocation location = constructor.location; | |
| 512 // Element element = _context.getElement(location); | |
| 513 // JUnitTestCase.assertSame(constructor, element); | |
| 514 // } | |
| 515 // void test_getErrors_dart_none() { | |
| 516 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 517 // List<AnalysisError> errors = _context.getErrors(source).errors; | |
| 518 // EngineTestCase.assertLength(0, errors); | |
| 519 // _context.computeErrors(source); | |
| 520 // errors = _context.getErrors(source).errors; | |
| 521 // EngineTestCase.assertLength(0, errors); | |
| 522 // } | |
| 523 // void test_getErrors_dart_some() { | |
| 524 // Source source = _addSource("/lib.dart", "library 'lib';"); | |
| 525 // List<AnalysisError> errors = _context.getErrors(source).errors; | |
| 526 // EngineTestCase.assertLength(0, errors); | |
| 527 // _context.computeErrors(source); | |
| 528 // errors = _context.getErrors(source).errors; | |
| 529 // EngineTestCase.assertLength(1, errors); | |
| 530 // } | |
| 531 // void test_getErrors_html_none() { | |
| 532 // Source source = _addSource("/test.html", "<html></html>"); | |
| 533 // List<AnalysisError> errors = _context.getErrors(source).errors; | |
| 534 // EngineTestCase.assertLength(0, errors); | |
| 535 // _context.computeErrors(source); | |
| 536 // errors = _context.getErrors(source).errors; | |
| 537 // EngineTestCase.assertLength(0, errors); | |
| 538 // } | |
| 539 // void test_getErrors_html_some() { | |
| 540 // Source source = _addSource("/test.html", EngineTestCase.createSource([ | |
| 541 // "<html><head>", | |
| 542 // "<script type='application/dart' src='test.dart'/>", | |
| 543 // "</head></html>"])); | |
| 544 // List<AnalysisError> errors = _context.getErrors(source).errors; | |
| 545 // EngineTestCase.assertLength(0, errors); | |
| 546 // _context.computeErrors(source); | |
| 547 // errors = _context.getErrors(source).errors; | |
| 548 // EngineTestCase.assertLength(1, errors); | |
| 549 // } | |
| 550 // void test_getHtmlElement_dart() { | |
| 551 // Source source = _addSource("/test.dart", ""); | |
| 552 // JUnitTestCase.assertNull(_context.getHtmlElement(source)); | |
| 553 // JUnitTestCase.assertNull(_context.computeHtmlElement(source)); | |
| 554 // JUnitTestCase.assertNull(_context.getHtmlElement(source)); | |
| 555 // } | |
| 556 // void test_getHtmlElement_html() { | |
| 557 // Source source = _addSource("/test.html", "<html></html>"); | |
| 558 // HtmlElement element = _context.getHtmlElement(source); | |
| 559 // JUnitTestCase.assertNull(element); | |
| 560 // _context.computeHtmlElement(source); | |
| 561 // element = _context.getHtmlElement(source); | |
| 562 // JUnitTestCase.assertNotNull(element); | |
| 563 // } | |
| 564 // void test_getHtmlFilesReferencing_html() { | |
| 565 // _context = AnalysisContextFactory.contextWithCore(); | |
| 566 // _sourceFactory = _context.sourceFactory; | |
| 567 // Source htmlSource = _addSource("/test.html", EngineTestCase.createSource(
[ | |
| 568 // "<html><head>", | |
| 569 // "<script type='application/dart' src='test.dart'/>", | |
| 570 // "<script type='application/dart' src='test.js'/>", | |
| 571 // "</head></html>"])); | |
| 572 // Source librarySource = _addSource("/test.dart", "library lib;"); | |
| 573 // Source secondHtmlSource = _addSource("/test.html", "<html></html>"); | |
| 574 // _context.computeLibraryElement(librarySource); | |
| 575 // List<Source> result = _context.getHtmlFilesReferencing(secondHtmlSource); | |
| 576 // EngineTestCase.assertLength(0, result); | |
| 577 // _context.parseHtmlUnit(htmlSource); | |
| 578 // result = _context.getHtmlFilesReferencing(secondHtmlSource); | |
| 579 // EngineTestCase.assertLength(0, result); | |
| 580 // } | |
| 581 // void test_getHtmlFilesReferencing_library() { | |
| 582 // Source htmlSource = _addSource("/test.html", EngineTestCase.createSource(
[ | |
| 583 // "<html><head>", | |
| 584 // "<script type='application/dart' src='test.dart'/>", | |
| 585 // "<script type='application/dart' src='test.js'/>", | |
| 586 // "</head></html>"])); | |
| 587 // Source librarySource = _addSource("/test.dart", "library lib;"); | |
| 588 // List<Source> result = _context.getHtmlFilesReferencing(librarySource); | |
| 589 // EngineTestCase.assertLength(0, result); | |
| 590 // _context.parseHtmlUnit(htmlSource); | |
| 591 // result = _context.getHtmlFilesReferencing(librarySource); | |
| 592 // EngineTestCase.assertLength(1, result); | |
| 593 // JUnitTestCase.assertEquals(htmlSource, result[0]); | |
| 594 // } | |
| 595 // void test_getHtmlFilesReferencing_part() { | |
| 596 // _context = AnalysisContextFactory.contextWithCore(); | |
| 597 // _sourceFactory = _context.sourceFactory; | |
| 598 // Source htmlSource = _addSource("/test.html", EngineTestCase.createSource(
[ | |
| 599 // "<html><head>", | |
| 600 // "<script type='application/dart' src='test.dart'/>", | |
| 601 // "<script type='application/dart' src='test.js'/>", | |
| 602 // "</head></html>"])); | |
| 603 // Source librarySource = _addSource("/test.dart", "library lib; part 'part.
dart';"); | |
| 604 // Source partSource = _addSource("/part.dart", "part of lib;"); | |
| 605 // _context.computeLibraryElement(librarySource); | |
| 606 // List<Source> result = _context.getHtmlFilesReferencing(partSource); | |
| 607 // EngineTestCase.assertLength(0, result); | |
| 608 // _context.parseHtmlUnit(htmlSource); | |
| 609 // result = _context.getHtmlFilesReferencing(partSource); | |
| 610 // EngineTestCase.assertLength(1, result); | |
| 611 // JUnitTestCase.assertEquals(htmlSource, result[0]); | |
| 612 // } | |
| 613 // void test_getHtmlSources() { | |
| 614 // List<Source> sources = _context.htmlSources; | |
| 615 // EngineTestCase.assertLength(0, sources); | |
| 616 // Source source = _addSource("/test.html", ""); | |
| 617 // _context.computeKindOf(source); | |
| 618 // sources = _context.htmlSources; | |
| 619 // EngineTestCase.assertLength(1, sources); | |
| 620 // JUnitTestCase.assertEquals(source, sources[0]); | |
| 621 // } | |
| 622 // void test_getKindOf_html() { | |
| 623 // Source source = _addSource("/test.html", ""); | |
| 624 // JUnitTestCase.assertSame(SourceKind.HTML, _context.getKindOf(source)); | |
| 625 // } | |
| 626 // void test_getKindOf_library() { | |
| 627 // Source source = _addSource("/test.dart", "library lib;"); | |
| 628 // JUnitTestCase.assertSame(SourceKind.UNKNOWN, _context.getKindOf(source)); | |
| 629 // _context.computeKindOf(source); | |
| 630 // JUnitTestCase.assertSame(SourceKind.LIBRARY, _context.getKindOf(source)); | |
| 631 // } | |
| 632 // void test_getKindOf_part() { | |
| 633 // Source source = _addSource("/test.dart", "part of lib;"); | |
| 634 // JUnitTestCase.assertSame(SourceKind.UNKNOWN, _context.getKindOf(source)); | |
| 635 // _context.computeKindOf(source); | |
| 636 // JUnitTestCase.assertSame(SourceKind.PART, _context.getKindOf(source)); | |
| 637 // } | |
| 638 // void test_getKindOf_unknown() { | |
| 639 // Source source = _addSource("/test.css", ""); | |
| 640 // JUnitTestCase.assertSame(SourceKind.UNKNOWN, _context.getKindOf(source)); | |
| 641 // } | |
| 642 // void test_getLaunchableClientLibrarySources() { | |
| 643 // _context = AnalysisContextFactory.contextWithCore(); | |
| 644 // _sourceFactory = _context.sourceFactory; | |
| 645 // List<Source> sources = _context.launchableClientLibrarySources; | |
| 646 // EngineTestCase.assertLength(0, sources); | |
| 647 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["im
port 'dart:html';", "main() {}"])); | |
| 648 // _context.computeLibraryElement(source); | |
| 649 // sources = _context.launchableClientLibrarySources; | |
| 650 // EngineTestCase.assertLength(1, sources); | |
| 651 // } | |
| 652 // void test_getLaunchableServerLibrarySources() { | |
| 653 // _context = AnalysisContextFactory.contextWithCore(); | |
| 654 // _sourceFactory = _context.sourceFactory; | |
| 655 // List<Source> sources = _context.launchableServerLibrarySources; | |
| 656 // EngineTestCase.assertLength(0, sources); | |
| 657 // Source source = _addSource("/test.dart", "main() {}"); | |
| 658 // _context.computeLibraryElement(source); | |
| 659 // sources = _context.launchableServerLibrarySources; | |
| 660 // EngineTestCase.assertLength(1, sources); | |
| 661 // } | |
| 662 // void test_getLibrariesContaining() { | |
| 663 // _context = AnalysisContextFactory.contextWithCore(); | |
| 664 // _sourceFactory = _context.sourceFactory; | |
| 665 // Source librarySource = _addSource("/lib.dart", EngineTestCase.createSourc
e(["library lib;", "part 'part.dart';"])); | |
| 666 // Source partSource = _addSource("/part.dart", "part of lib;"); | |
| 667 // _context.computeLibraryElement(librarySource); | |
| 668 // List<Source> result = _context.getLibrariesContaining(librarySource); | |
| 669 // EngineTestCase.assertLength(1, result); | |
| 670 // JUnitTestCase.assertEquals(librarySource, result[0]); | |
| 671 // result = _context.getLibrariesContaining(partSource); | |
| 672 // EngineTestCase.assertLength(1, result); | |
| 673 // JUnitTestCase.assertEquals(librarySource, result[0]); | |
| 674 // } | |
| 675 // void test_getLibrariesDependingOn() { | |
| 676 // _context = AnalysisContextFactory.contextWithCore(); | |
| 677 // _sourceFactory = _context.sourceFactory; | |
| 678 // Source libASource = _addSource("/libA.dart", "library libA;"); | |
| 679 // _addSource("/libB.dart", "library libB;"); | |
| 680 // Source lib1Source = _addSource("/lib1.dart", EngineTestCase.createSource(
[ | |
| 681 // "library lib1;", | |
| 682 // "import 'libA.dart';", | |
| 683 // "export 'libB.dart';"])); | |
| 684 // Source lib2Source = _addSource("/lib2.dart", EngineTestCase.createSource(
[ | |
| 685 // "library lib2;", | |
| 686 // "import 'libB.dart';", | |
| 687 // "export 'libA.dart';"])); | |
| 688 // _context.computeLibraryElement(lib1Source); | |
| 689 // _context.computeLibraryElement(lib2Source); | |
| 690 // List<Source> result = _context.getLibrariesDependingOn(libASource); | |
| 691 // EngineTestCase.assertContains(result, [lib1Source, lib2Source]); | |
| 692 // } | |
| 693 // void test_getLibrariesReferencedFromHtml() { | |
| 694 // _context = AnalysisContextFactory.contextWithCore(); | |
| 695 // _sourceFactory = _context.sourceFactory; | |
| 696 // Source htmlSource = _addSource("/test.html", EngineTestCase.createSource(
[ | |
| 697 // "<html><head>", | |
| 698 // "<script type='application/dart' src='test.dart'/>", | |
| 699 // "<script type='application/dart' src='test.js'/>", | |
| 700 // "</head></html>"])); | |
| 701 // Source librarySource = _addSource("/test.dart", "library lib;"); | |
| 702 // _context.computeLibraryElement(librarySource); | |
| 703 // _context.parseHtmlUnit(htmlSource); | |
| 704 // List<Source> result = _context.getLibrariesReferencedFromHtml(htmlSource)
; | |
| 705 // EngineTestCase.assertLength(1, result); | |
| 706 // JUnitTestCase.assertEquals(librarySource, result[0]); | |
| 707 // } | |
| 708 // void test_getLibrariesReferencedFromHtml_no() { | |
| 709 // _context = AnalysisContextFactory.contextWithCore(); | |
| 710 // _sourceFactory = _context.sourceFactory; | |
| 711 // Source htmlSource = _addSource("/test.html", EngineTestCase.createSource(
[ | |
| 712 // "<html><head>", | |
| 713 // "<script type='application/dart' src='test.js'/>", | |
| 714 // "</head></html>"])); | |
| 715 // _addSource("/test.dart", "library lib;"); | |
| 716 // _context.parseHtmlUnit(htmlSource); | |
| 717 // List<Source> result = _context.getLibrariesReferencedFromHtml(htmlSource)
; | |
| 718 // EngineTestCase.assertLength(0, result); | |
| 719 // } | |
| 720 // void test_getLibraryElement() { | |
| 721 // _context = AnalysisContextFactory.contextWithCore(); | |
| 722 // _sourceFactory = _context.sourceFactory; | |
| 723 // Source source = _addSource("/test.dart", "library lib;"); | |
| 724 // LibraryElement element = _context.getLibraryElement(source); | |
| 725 // JUnitTestCase.assertNull(element); | |
| 726 // _context.computeLibraryElement(source); | |
| 727 // element = _context.getLibraryElement(source); | |
| 728 // JUnitTestCase.assertNotNull(element); | |
| 729 // } | |
| 730 // void test_getLibrarySources() { | |
| 731 // List<Source> sources = _context.librarySources; | |
| 732 // int originalLength = sources.length; | |
| 733 // Source source = _addSource("/test.dart", "library lib;"); | |
| 734 // _context.computeKindOf(source); | |
| 735 // sources = _context.librarySources; | |
| 736 // EngineTestCase.assertLength(originalLength + 1, sources); | |
| 737 // for (Source returnedSource in sources) { | |
| 738 // if (returnedSource == source) { | |
| 739 // return; | |
| 740 // } | |
| 741 // } | |
| 742 // JUnitTestCase.fail("The added source was not in the list of library sourc
es"); | |
| 743 // } | |
| 744 // void test_getLineInfo() { | |
| 745 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["li
brary lib;", "", "main() {}"])); | |
| 746 // LineInfo info = _context.getLineInfo(source); | |
| 747 // JUnitTestCase.assertNull(info); | |
| 748 // _context.parseCompilationUnit(source); | |
| 749 // info = _context.getLineInfo(source); | |
| 750 // JUnitTestCase.assertNotNull(info); | |
| 751 // } | |
| 752 // void test_getModificationStamp_fromSource() { | |
| 753 // int stamp = 42; | |
| 754 // JUnitTestCase.assertEquals(stamp, _context.getModificationStamp(new TestS
ource_AnalysisContextImplTest_test_getModificationStamp_fromSource(stamp))); | |
| 755 // } | |
| 756 // void test_getModificationStamp_overridden() { | |
| 757 // int stamp = 42; | |
| 758 // Source source = new TestSource_AnalysisContextImplTest_test_getModificati
onStamp_overridden(stamp); | |
| 759 // _context.setContents(source, ""); | |
| 760 // JUnitTestCase.assertTrue(stamp != _context.getModificationStamp(source)); | |
| 761 // } | |
| 762 // void test_getPublicNamespace_element() { | |
| 763 // _context = AnalysisContextFactory.contextWithCore(); | |
| 764 // _sourceFactory = _context.sourceFactory; | |
| 765 // Source source = _addSource("/test.dart", "class A {}"); | |
| 766 // LibraryElement library = _context.computeLibraryElement(source); | |
| 767 // Namespace namespace = _context.getPublicNamespace(library); | |
| 768 // JUnitTestCase.assertNotNull(namespace); | |
| 769 // EngineTestCase.assertInstanceOf((obj) => obj is ClassElement, ClassElemen
t, namespace.get("A")); | |
| 770 // } | |
| 771 // void test_getRefactoringUnsafeSources() { | |
| 772 // // not sources initially | |
| 773 // List<Source> sources = _context.refactoringUnsafeSources; | |
| 774 // EngineTestCase.assertLength(0, sources); | |
| 775 // // add new source, unresolved | |
| 776 // Source source = _addSource("/test.dart", "library lib;"); | |
| 777 // sources = _context.refactoringUnsafeSources; | |
| 778 // EngineTestCase.assertLength(1, sources); | |
| 779 // JUnitTestCase.assertEquals(source, sources[0]); | |
| 780 // // resolve source | |
| 781 // _context.computeLibraryElement(source); | |
| 782 // sources = _context.refactoringUnsafeSources; | |
| 783 // EngineTestCase.assertLength(0, sources); | |
| 784 // } | |
| 785 // void test_getResolvedCompilationUnit_library() { | |
| 786 // _context = AnalysisContextFactory.contextWithCore(); | |
| 787 // _sourceFactory = _context.sourceFactory; | |
| 788 // Source source = _addSource("/lib.dart", "library libb;"); | |
| 789 // LibraryElement library = _context.computeLibraryElement(source); | |
| 790 // JUnitTestCase.assertNotNull(_context.getResolvedCompilationUnit(source, l
ibrary)); | |
| 791 // _context.setContents(source, "library lib;"); | |
| 792 // JUnitTestCase.assertNull(_context.getResolvedCompilationUnit(source, libr
ary)); | |
| 793 // } | |
| 794 // void test_getResolvedCompilationUnit_library_null() { | |
| 795 // _context = AnalysisContextFactory.contextWithCore(); | |
| 796 // _sourceFactory = _context.sourceFactory; | |
| 797 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 798 // JUnitTestCase.assertNull(_context.getResolvedCompilationUnit(source, null
as LibraryElement)); | |
| 799 // } | |
| 800 // void test_getResolvedCompilationUnit_source_dart() { | |
| 801 // _context = AnalysisContextFactory.contextWithCore(); | |
| 802 // _sourceFactory = _context.sourceFactory; | |
| 803 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 804 // JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(source, sou
rce)); | |
| 805 // _context.resolveCompilationUnit2(source, source); | |
| 806 // JUnitTestCase.assertNotNull(_context.getResolvedCompilationUnit2(source,
source)); | |
| 807 // } | |
| 808 // void test_getResolvedCompilationUnit_source_html() { | |
| 809 // _context = AnalysisContextFactory.contextWithCore(); | |
| 810 // _sourceFactory = _context.sourceFactory; | |
| 811 // Source source = _addSource("/test.html", "<html></html>"); | |
| 812 // JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(source, sou
rce)); | |
| 813 // JUnitTestCase.assertNull(_context.resolveCompilationUnit2(source, source)
); | |
| 814 // JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(source, sou
rce)); | |
| 815 // } | |
| 816 // void test_getResolvedHtmlUnit() { | |
| 817 // _context = AnalysisContextFactory.contextWithCore(); | |
| 818 // _sourceFactory = _context.sourceFactory; | |
| 819 // Source source = _addSource("/test.html", "<html></html>"); | |
| 820 // JUnitTestCase.assertNull(_context.getResolvedHtmlUnit(source)); | |
| 821 // _context.resolveHtmlUnit(source); | |
| 822 // JUnitTestCase.assertNotNull(_context.getResolvedHtmlUnit(source)); | |
| 823 // } | |
| 824 // void test_getSourceFactory() { | |
| 825 // JUnitTestCase.assertSame(_sourceFactory, _context.sourceFactory); | |
| 826 // } | |
| 827 // void test_getStatistics() { | |
| 828 // AnalysisContextStatistics statistics = _context.statistics; | |
| 829 // JUnitTestCase.assertNotNull(statistics); | |
| 830 // } | |
| 831 // void test_isClientLibrary_dart() { | |
| 832 // _context = AnalysisContextFactory.contextWithCore(); | |
| 833 // _sourceFactory = _context.sourceFactory; | |
| 834 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["im
port 'dart:html';", "", "main() {}"])); | |
| 835 // JUnitTestCase.assertFalse(_context.isClientLibrary(source)); | |
| 836 // JUnitTestCase.assertFalse(_context.isServerLibrary(source)); | |
| 837 // _context.computeLibraryElement(source); | |
| 838 // JUnitTestCase.assertTrue(_context.isClientLibrary(source)); | |
| 839 // JUnitTestCase.assertFalse(_context.isServerLibrary(source)); | |
| 840 // } | |
| 841 // void test_isClientLibrary_html() { | |
| 842 // Source source = _addSource("/test.html", "<html></html>"); | |
| 843 // JUnitTestCase.assertFalse(_context.isClientLibrary(source)); | |
| 844 // } | |
| 845 // void test_isServerLibrary_dart() { | |
| 846 // _context = AnalysisContextFactory.contextWithCore(); | |
| 847 // _sourceFactory = _context.sourceFactory; | |
| 848 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["li
brary lib;", "", "main() {}"])); | |
| 849 // JUnitTestCase.assertFalse(_context.isClientLibrary(source)); | |
| 850 // JUnitTestCase.assertFalse(_context.isServerLibrary(source)); | |
| 851 // _context.computeLibraryElement(source); | |
| 852 // JUnitTestCase.assertFalse(_context.isClientLibrary(source)); | |
| 853 // JUnitTestCase.assertTrue(_context.isServerLibrary(source)); | |
| 854 // } | |
| 855 // void test_isServerLibrary_html() { | |
| 856 // Source source = _addSource("/test.html", "<html></html>"); | |
| 857 // JUnitTestCase.assertFalse(_context.isServerLibrary(source)); | |
| 858 // } | |
| 859 // void test_parseCompilationUnit_errors() { | |
| 860 // Source source = _addSource("/lib.dart", "library {"); | |
| 861 // CompilationUnit compilationUnit = _context.parseCompilationUnit(source); | |
| 862 // JUnitTestCase.assertNotNull(compilationUnit); | |
| 863 // List<AnalysisError> errors = _context.getErrors(source).errors; | |
| 864 // JUnitTestCase.assertNotNull(errors); | |
| 865 // JUnitTestCase.assertTrue(errors.length > 0); | |
| 866 // } | |
| 867 // void test_parseCompilationUnit_exception() { | |
| 868 // Source source = _addSourceWithException("/test.dart"); | |
| 869 // try { | |
| 870 // _context.parseCompilationUnit(source); | |
| 871 // JUnitTestCase.fail("Expected AnalysisException"); | |
| 872 // } on AnalysisException catch (exception) { | |
| 873 // } | |
| 874 // } | |
| 875 // void test_parseCompilationUnit_html() { | |
| 876 // Source source = _addSource("/test.html", "<html></html>"); | |
| 877 // JUnitTestCase.assertNull(_context.parseCompilationUnit(source)); | |
| 878 // } | |
| 879 // void test_parseCompilationUnit_noErrors() { | |
| 880 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 881 // CompilationUnit compilationUnit = _context.parseCompilationUnit(source); | |
| 882 // JUnitTestCase.assertNotNull(compilationUnit); | |
| 883 // EngineTestCase.assertLength(0, _context.getErrors(source).errors); | |
| 884 // } | |
| 885 // void test_parseCompilationUnit_nonExistentSource() { | |
| 886 // Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test
.dart")); | |
| 887 // try { | |
| 888 // _context.parseCompilationUnit(source); | |
| 889 // JUnitTestCase.fail("Expected AnalysisException because file does not ex
ist"); | |
| 890 // } on AnalysisException catch (exception) { | |
| 891 // } | |
| 892 // } | |
| 893 // void test_parseHtmlUnit_noErrors() { | |
| 894 // Source source = _addSource("/lib.html", "<html></html>"); | |
| 895 // HtmlUnit unit = _context.parseHtmlUnit(source); | |
| 896 // JUnitTestCase.assertNotNull(unit); | |
| 897 // } | |
| 898 // void test_parseHtmlUnit_resolveDirectives() { | |
| 899 // Source libSource = _addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "class ClassA {}"])); | |
| 900 // Source source = _addSource("/lib.html", EngineTestCase.createSource([ | |
| 901 // "<html>", | |
| 902 // "<head>", | |
| 903 // " <script type='application/dart'>", | |
| 904 // " import 'lib.dart';", | |
| 905 // " ClassA v = null;", | |
| 906 // " </script>", | |
| 907 // "</head>", | |
| 908 // "<body>", | |
| 909 // "</body>", | |
| 910 // "</html>"])); | |
| 911 // HtmlUnit unit = _context.parseHtmlUnit(source); | |
| 912 // // import directive should be resolved | |
| 913 // XmlTagNode htmlNode = unit.tagNodes[0]; | |
| 914 // XmlTagNode headNode = htmlNode.tagNodes[0]; | |
| 915 // HtmlScriptTagNode scriptNode = headNode.tagNodes[0] as HtmlScriptTagNode; | |
| 916 // CompilationUnit script = scriptNode.script; | |
| 917 // ImportDirective importNode = script.directives[0] as ImportDirective; | |
| 918 // JUnitTestCase.assertNotNull(importNode.uriContent); | |
| 919 // JUnitTestCase.assertEquals(libSource, importNode.source); | |
| 920 // } | |
| 921 // void test_performAnalysisTask_addPart() { | |
| 922 // Source libSource = _addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "part 'part.dart';"])); | |
| 923 // // run all tasks without part | |
| 924 // _analyzeAll_assertFinished(); | |
| 925 // // add part and run all tasks | |
| 926 // Source partSource = _addSource("/part.dart", EngineTestCase.createSource(
["part of lib;", ""])); | |
| 927 // _analyzeAll_assertFinished(); | |
| 928 // // "libSource" should be here | |
| 929 // List<Source> librariesWithPart = _context.getLibrariesContaining(partSour
ce); | |
| 930 // EngineTestCase.assertContains(librariesWithPart, [libSource]); | |
| 931 // } | |
| 932 // void test_performAnalysisTask_changeLibraryContents() { | |
| 933 // Source libSource = _addSource("/test.dart", "library lib; part 'test-part
.dart';"); | |
| 934 // Source partSource = _addSource("/test-part.dart", "part of lib;"); | |
| 935 // _analyzeAll_assertFinished(); | |
| 936 // JUnitTestCase.assertNotNullMsg("library resolved 1", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 937 // JUnitTestCase.assertNotNullMsg("part resolved 1", _context.getResolvedCom
pilationUnit2(partSource, libSource)); | |
| 938 // // update and analyze #1 | |
| 939 // _context.setContents(libSource, "library lib;"); | |
| 940 // JUnitTestCase.assertNullMsg("library changed 2", _context.getResolvedComp
ilationUnit2(libSource, libSource)); | |
| 941 // JUnitTestCase.assertNullMsg("part changed 2", _context.getResolvedCompila
tionUnit2(partSource, libSource)); | |
| 942 // _analyzeAll_assertFinished(); | |
| 943 // JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 944 // JUnitTestCase.assertNullMsg("part resolved 2", _context.getResolvedCompil
ationUnit2(partSource, libSource)); | |
| 945 // // update and analyze #2 | |
| 946 // _context.setContents(libSource, "library lib; part 'test-part.dart';"); | |
| 947 // JUnitTestCase.assertNullMsg("library changed 3", _context.getResolvedComp
ilationUnit2(libSource, libSource)); | |
| 948 // JUnitTestCase.assertNullMsg("part changed 3", _context.getResolvedCompila
tionUnit2(partSource, libSource)); | |
| 949 // _analyzeAll_assertFinished(); | |
| 950 // JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 951 // JUnitTestCase.assertNotNullMsg("part resolved 3", _context.getResolvedCom
pilationUnit2(partSource, libSource)); | |
| 952 // } | |
| 953 // void test_performAnalysisTask_changeLibraryThenPartContents() { | |
| 954 // Source libSource = _addSource("/test.dart", "library lib; part 'test-part
.dart';"); | |
| 955 // Source partSource = _addSource("/test-part.dart", "part of lib;"); | |
| 956 // _analyzeAll_assertFinished(); | |
| 957 // JUnitTestCase.assertNotNullMsg("library resolved 1", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 958 // JUnitTestCase.assertNotNullMsg("part resolved 1", _context.getResolvedCom
pilationUnit2(partSource, libSource)); | |
| 959 // // update and analyze #1 | |
| 960 // _context.setContents(libSource, "library lib;"); | |
| 961 // JUnitTestCase.assertNullMsg("library changed 2", _context.getResolvedComp
ilationUnit2(libSource, libSource)); | |
| 962 // JUnitTestCase.assertNullMsg("part changed 2", _context.getResolvedCompila
tionUnit2(partSource, libSource)); | |
| 963 // _analyzeAll_assertFinished(); | |
| 964 // JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 965 // JUnitTestCase.assertNullMsg("part resolved 2", _context.getResolvedCompil
ationUnit2(partSource, libSource)); | |
| 966 // // update and analyze #2 | |
| 967 // _context.setContents(partSource, "part of lib; // 1"); | |
| 968 // // Assert that changing the part's content does not effect the library | |
| 969 // // now that it is no longer part of that library | |
| 970 // JUnitTestCase.assertNotNullMsg("library changed 3", _context.getResolvedC
ompilationUnit2(libSource, libSource)); | |
| 971 // JUnitTestCase.assertNullMsg("part changed 3", _context.getResolvedCompila
tionUnit2(partSource, libSource)); | |
| 972 // _analyzeAll_assertFinished(); | |
| 973 // JUnitTestCase.assertNotNullMsg("library resolved 3", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 974 // JUnitTestCase.assertNullMsg("part resolved 3", _context.getResolvedCompil
ationUnit2(partSource, libSource)); | |
| 975 // } | |
| 976 // void test_performAnalysisTask_changePartContents_makeItAPart() { | |
| 977 // Source libSource = _addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "part 'part.dart';", "void f(x) {}"])); | |
| 978 // Source partSource = _addSource("/part.dart", EngineTestCase.createSource(
["void g() { f(null); }"])); | |
| 979 // _analyzeAll_assertFinished(); | |
| 980 // JUnitTestCase.assertNotNullMsg("library resolved 1", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 981 // JUnitTestCase.assertNotNullMsg("part resolved 1", _context.getResolvedCom
pilationUnit2(partSource, libSource)); | |
| 982 // // update and analyze | |
| 983 // _context.setContents(partSource, EngineTestCase.createSource(["part of li
b;", "void g() { f(null); }"])); | |
| 984 // JUnitTestCase.assertNullMsg("library changed 2", _context.getResolvedComp
ilationUnit2(libSource, libSource)); | |
| 985 // JUnitTestCase.assertNullMsg("part changed 2", _context.getResolvedCompila
tionUnit2(partSource, libSource)); | |
| 986 // _analyzeAll_assertFinished(); | |
| 987 // JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 988 // JUnitTestCase.assertNotNullMsg("part resolved 2", _context.getResolvedCom
pilationUnit2(partSource, libSource)); | |
| 989 // EngineTestCase.assertLength(0, _context.getErrors(libSource).errors); | |
| 990 // EngineTestCase.assertLength(0, _context.getErrors(partSource).errors); | |
| 991 // } | |
| 992 // /** | |
| 993 // * https://code.google.com/p/dart/issues/detail?id=12424 | |
| 994 // */ | |
| 995 // void test_performAnalysisTask_changePartContents_makeItNotPart() { | |
| 996 // Source libSource = _addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "part 'part.dart';", "void f(x) {}"])); | |
| 997 // Source partSource = _addSource("/part.dart", EngineTestCase.createSource(
["part of lib;", "void g() { f(null); }"])); | |
| 998 // _analyzeAll_assertFinished(); | |
| 999 // EngineTestCase.assertLength(0, _context.getErrors(libSource).errors); | |
| 1000 // EngineTestCase.assertLength(0, _context.getErrors(partSource).errors); | |
| 1001 // // Remove 'part' directive, which should make "f(null)" an error. | |
| 1002 // _context.setContents(partSource, EngineTestCase.createSource(["//part of
lib;", "void g() { f(null); }"])); | |
| 1003 // _analyzeAll_assertFinished(); | |
| 1004 // JUnitTestCase.assertTrue(_context.getErrors(libSource).errors.length != 0
); | |
| 1005 // } | |
| 1006 // void test_performAnalysisTask_changePartContents_noSemanticChanges() { | |
| 1007 // Source libSource = _addSource("/test.dart", "library lib; part 'test-part
.dart';"); | |
| 1008 // Source partSource = _addSource("/test-part.dart", "part of lib;"); | |
| 1009 // _analyzeAll_assertFinished(); | |
| 1010 // JUnitTestCase.assertNotNullMsg("library resolved 1", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 1011 // JUnitTestCase.assertNotNullMsg("part resolved 1", _context.getResolvedCom
pilationUnit2(partSource, libSource)); | |
| 1012 // // update and analyze #1 | |
| 1013 // _context.setContents(partSource, "part of lib; // 1"); | |
| 1014 // JUnitTestCase.assertNullMsg("library changed 2", _context.getResolvedComp
ilationUnit2(libSource, libSource)); | |
| 1015 // JUnitTestCase.assertNullMsg("part changed 2", _context.getResolvedCompila
tionUnit2(partSource, libSource)); | |
| 1016 // _analyzeAll_assertFinished(); | |
| 1017 // JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 1018 // JUnitTestCase.assertNotNullMsg("part resolved 2", _context.getResolvedCom
pilationUnit2(partSource, libSource)); | |
| 1019 // // update and analyze #2 | |
| 1020 // _context.setContents(partSource, "part of lib; // 12"); | |
| 1021 // JUnitTestCase.assertNullMsg("library changed 3", _context.getResolvedComp
ilationUnit2(libSource, libSource)); | |
| 1022 // JUnitTestCase.assertNullMsg("part changed 3", _context.getResolvedCompila
tionUnit2(partSource, libSource)); | |
| 1023 // _analyzeAll_assertFinished(); | |
| 1024 // JUnitTestCase.assertNotNullMsg("library resolved 3", _context.getResolved
CompilationUnit2(libSource, libSource)); | |
| 1025 // JUnitTestCase.assertNotNullMsg("part resolved 3", _context.getResolvedCom
pilationUnit2(partSource, libSource)); | |
| 1026 // } | |
| 1027 // void test_performAnalysisTask_importedLibraryAdd() { | |
| 1028 // Source libASource = _addSource("/libA.dart", "library libA; import 'libB.
dart';"); | |
| 1029 // _analyzeAll_assertFinished(); | |
| 1030 // JUnitTestCase.assertNotNullMsg("libA resolved 1", _context.getResolvedCom
pilationUnit2(libASource, libASource)); | |
| 1031 // JUnitTestCase.assertTrueMsg("libA has an error", _hasAnalysisErrorWithErr
orSeverity(_context.getErrors(libASource))); | |
| 1032 // // add libB.dart and analyze | |
| 1033 // Source libBSource = _addSource("/libB.dart", "library libB;"); | |
| 1034 // _analyzeAll_assertFinished(); | |
| 1035 // JUnitTestCase.assertNotNullMsg("libA resolved 2", _context.getResolvedCom
pilationUnit2(libASource, libASource)); | |
| 1036 // JUnitTestCase.assertNotNullMsg("libB resolved 2", _context.getResolvedCom
pilationUnit2(libBSource, libBSource)); | |
| 1037 // JUnitTestCase.assertTrueMsg("libA doesn't have errors", !_hasAnalysisErro
rWithErrorSeverity(_context.getErrors(libASource))); | |
| 1038 // } | |
| 1039 // void test_performAnalysisTask_importedLibraryAdd_html() { | |
| 1040 // Source htmlSource = _addSource("/page.html", EngineTestCase.createSource(
[ | |
| 1041 // "<html><body><script type=\"application/dart\">", | |
| 1042 // " import '/libB.dart';", | |
| 1043 // " main() {print('hello dart');}", | |
| 1044 // "</script></body></html>"])); | |
| 1045 // _analyzeAll_assertFinished(); | |
| 1046 // JUnitTestCase.assertNotNullMsg("htmlUnit resolved 1", _context.getResolve
dHtmlUnit(htmlSource)); | |
| 1047 // JUnitTestCase.assertTrueMsg("htmlSource has an error", _hasAnalysisErrorW
ithErrorSeverity(_context.getErrors(htmlSource))); | |
| 1048 // // add libB.dart and analyze | |
| 1049 // Source libBSource = _addSource("/libB.dart", "library libB;"); | |
| 1050 // _analyzeAll_assertFinished(); | |
| 1051 // JUnitTestCase.assertNotNullMsg("htmlUnit resolved 1", _context.getResolve
dHtmlUnit(htmlSource)); | |
| 1052 // JUnitTestCase.assertNotNullMsg("libB resolved 2", _context.getResolvedCom
pilationUnit2(libBSource, libBSource)); | |
| 1053 // AnalysisErrorInfo errors = _context.getErrors(htmlSource); | |
| 1054 // JUnitTestCase.assertTrueMsg("htmlSource doesn't have errors", !_hasAnalys
isErrorWithErrorSeverity(errors)); | |
| 1055 // } | |
| 1056 // void test_performAnalysisTask_importedLibraryDelete() { | |
| 1057 // Source libASource = _addSource("/libA.dart", "library libA; import 'libB.
dart';"); | |
| 1058 // Source libBSource = _addSource("/libB.dart", "library libB;"); | |
| 1059 // _analyzeAll_assertFinished(); | |
| 1060 // JUnitTestCase.assertNotNullMsg("libA resolved 1", _context.getResolvedCom
pilationUnit2(libASource, libASource)); | |
| 1061 // JUnitTestCase.assertNotNullMsg("libB resolved 1", _context.getResolvedCom
pilationUnit2(libBSource, libBSource)); | |
| 1062 // JUnitTestCase.assertTrueMsg("libA doesn't have errors", !_hasAnalysisErro
rWithErrorSeverity(_context.getErrors(libASource))); | |
| 1063 // // remove libB.dart content and analyze | |
| 1064 // _context.setContents(libBSource, null); | |
| 1065 // _analyzeAll_assertFinished(); | |
| 1066 // JUnitTestCase.assertNotNullMsg("libA resolved 2", _context.getResolvedCom
pilationUnit2(libASource, libASource)); | |
| 1067 // JUnitTestCase.assertTrueMsg("libA has an error", _hasAnalysisErrorWithErr
orSeverity(_context.getErrors(libASource))); | |
| 1068 // } | |
| 1069 // void test_performAnalysisTask_IOException() { | |
| 1070 // TestSource source = _addSourceWithException2("/test.dart", "library test;
"); | |
| 1071 // int oldTimestamp = _context.getModificationStamp(source); | |
| 1072 // source.generateExceptionOnRead = false; | |
| 1073 // _analyzeAll_assertFinished(); | |
| 1074 // JUnitTestCase.assertEquals(1, source.readCount); | |
| 1075 // source.generateExceptionOnRead = true; | |
| 1076 // do { | |
| 1077 // _changeSource(source, ""); | |
| 1078 // } while (oldTimestamp == _context.getModificationStamp(source)); | |
| 1079 // _analyzeAll_assertFinished(); | |
| 1080 // JUnitTestCase.assertEquals(2, source.readCount); | |
| 1081 // } | |
| 1082 // void test_performAnalysisTask_missingPart() { | |
| 1083 // Source source = _addSource("/test.dart", "library lib; part 'no-such-file
.dart';"); | |
| 1084 // _analyzeAll_assertFinished(); | |
| 1085 // JUnitTestCase.assertNotNullMsg("performAnalysisTask failed to compute an
element model", _context.getLibraryElement(source)); | |
| 1086 // } | |
| 1087 // void test_performAnalysisTask_modifiedAfterParse() { | |
| 1088 // Source source = _addSource("/test.dart", "library lib;"); | |
| 1089 // int initialTime = _context.getModificationStamp(source); | |
| 1090 // List<Source> sources = new List<Source>(); | |
| 1091 // sources.add(source); | |
| 1092 // _context.analysisPriorityOrder = sources; | |
| 1093 // _context.parseCompilationUnit(source); | |
| 1094 // while (initialTime == JavaSystem.currentTimeMillis()) { | |
| 1095 // Thread.sleep(1); | |
| 1096 // } | |
| 1097 // _context.setContents(source, "library test;"); | |
| 1098 // JUnitTestCase.assertTrue(initialTime != _context.getModificationStamp(sou
rce)); | |
| 1099 // _analyzeAll_assertFinished(); | |
| 1100 // JUnitTestCase.assertNotNullMsg("performAnalysisTask failed to compute an
element model", _context.getLibraryElement(source)); | |
| 1101 // } | |
| 1102 // void test_resolveCompilationUnit_import_relative() { | |
| 1103 // _context = AnalysisContextFactory.contextWithCore(); | |
| 1104 // Source sourceA = _addSource("/libA.dart", "library libA; import 'libB.dar
t'; class A{}"); | |
| 1105 // _addSource("/libB.dart", "library libB; class B{}"); | |
| 1106 // CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source
A, sourceA); | |
| 1107 // LibraryElement library = compilationUnit.element.library; | |
| 1108 // List<LibraryElement> importedLibraries = library.importedLibraries; | |
| 1109 // assertNamedElements(importedLibraries, ["dart.core", "libB"]); | |
| 1110 // List<LibraryElement> visibleLibraries = library.visibleLibraries; | |
| 1111 // assertNamedElements(visibleLibraries, ["dart.core", "libA", "libB"]); | |
| 1112 // } | |
| 1113 // void test_resolveCompilationUnit_import_relative_cyclic() { | |
| 1114 // _context = AnalysisContextFactory.contextWithCore(); | |
| 1115 // Source sourceA = _addSource("/libA.dart", "library libA; import 'libB.dar
t'; class A{}"); | |
| 1116 // _addSource("/libB.dart", "library libB; import 'libA.dart'; class B{}"); | |
| 1117 // CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source
A, sourceA); | |
| 1118 // LibraryElement library = compilationUnit.element.library; | |
| 1119 // List<LibraryElement> importedLibraries = library.importedLibraries; | |
| 1120 // assertNamedElements(importedLibraries, ["dart.core", "libB"]); | |
| 1121 // List<LibraryElement> visibleLibraries = library.visibleLibraries; | |
| 1122 // assertNamedElements(visibleLibraries, ["dart.core", "libA", "libB"]); | |
| 1123 // } | |
| 1124 // void test_resolveCompilationUnit_library() { | |
| 1125 // _context = AnalysisContextFactory.contextWithCore(); | |
| 1126 // _sourceFactory = _context.sourceFactory; | |
| 1127 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 1128 // LibraryElement library = _context.computeLibraryElement(source); | |
| 1129 // CompilationUnit compilationUnit = _context.resolveCompilationUnit(source,
library); | |
| 1130 // JUnitTestCase.assertNotNull(compilationUnit); | |
| 1131 // JUnitTestCase.assertNotNull(compilationUnit.element); | |
| 1132 // } | |
| 1133 // void test_resolveCompilationUnit_source() { | |
| 1134 // _context = AnalysisContextFactory.contextWithCore(); | |
| 1135 // _sourceFactory = _context.sourceFactory; | |
| 1136 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 1137 // CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source
, source); | |
| 1138 // JUnitTestCase.assertNotNull(compilationUnit); | |
| 1139 // } | |
| 1140 // void test_resolveCompilationUnit_sourceChangeDuringResolution() { | |
| 1141 // _context = new AnalysisContextFactory_AnalysisContextForTests_AnalysisCon
textImplTest_test_resolveCompilationUnit_sourceChangeDuringResolution(); | |
| 1142 // AnalysisContextFactory.initContextWithCore(_context); | |
| 1143 // _sourceFactory = _context.sourceFactory; | |
| 1144 // Source source = _addSource("/lib.dart", "library lib;"); | |
| 1145 // CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source
, source); | |
| 1146 // JUnitTestCase.assertNotNull(compilationUnit); | |
| 1147 // JUnitTestCase.assertNotNull(_context.getLineInfo(source)); | |
| 1148 // } | |
| 1149 // void test_resolveHtmlUnit() { | |
| 1150 // Source source = _addSource("/lib.html", "<html></html>"); | |
| 1151 // HtmlUnit unit = _context.resolveHtmlUnit(source); | |
| 1152 // JUnitTestCase.assertNotNull(unit); | |
| 1153 // } | |
| 1154 // void test_setAnalysisOptions() { | |
| 1155 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1156 // options.cacheSize = 42; | |
| 1157 // options.dart2jsHint = false; | |
| 1158 // options.hint = false; | |
| 1159 // _context.analysisOptions = options; | |
| 1160 // AnalysisOptions result = _context.analysisOptions; | |
| 1161 // JUnitTestCase.assertEquals(options.cacheSize, result.cacheSize); | |
| 1162 // JUnitTestCase.assertEquals(options.dart2jsHint, result.dart2jsHint); | |
| 1163 // JUnitTestCase.assertEquals(options.hint, result.hint); | |
| 1164 // } | |
| 1165 // void test_setAnalysisOptions_reduceAnalysisPriorityOrder() { | |
| 1166 // AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(_context.analy
sisOptions); | |
| 1167 // List<Source> sources = new List<Source>(); | |
| 1168 // for (int index = 0; index < options.cacheSize; index++) { | |
| 1169 // sources.add(_addSource("/lib.dart${index}", "")); | |
| 1170 // } | |
| 1171 // _context.analysisPriorityOrder = sources; | |
| 1172 // int oldPriorityOrderSize = _getPriorityOrder(_context).length; | |
| 1173 // options.cacheSize = options.cacheSize - 10; | |
| 1174 // _context.analysisOptions = options; | |
| 1175 // JUnitTestCase.assertTrue(oldPriorityOrderSize > _getPriorityOrder(_contex
t).length); | |
| 1176 // } | |
| 1177 // void test_setAnalysisPriorityOrder_empty() { | |
| 1178 // _context.analysisPriorityOrder = new List<Source>(); | |
| 1179 // } | |
| 1180 // void test_setAnalysisPriorityOrder_lessThanCacheSize() { | |
| 1181 // AnalysisOptions options = _context.analysisOptions; | |
| 1182 // List<Source> sources = new List<Source>(); | |
| 1183 // for (int index = 0; index < options.cacheSize; index++) { | |
| 1184 // sources.add(_addSource("/lib.dart${index}", "")); | |
| 1185 // } | |
| 1186 // _context.analysisPriorityOrder = sources; | |
| 1187 // JUnitTestCase.assertTrue(options.cacheSize > _getPriorityOrder(_context).
length); | |
| 1188 // } | |
| 1189 // void test_setAnalysisPriorityOrder_nonEmpty() { | |
| 1190 // List<Source> sources = new List<Source>(); | |
| 1191 // sources.add(_addSource("/lib.dart", "library lib;")); | |
| 1192 // _context.analysisPriorityOrder = sources; | |
| 1193 // } | |
| 1194 // void test_setChangedContents_libraryWithPart() { | |
| 1195 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1196 // options.incremental = true; | |
| 1197 // _context = AnalysisContextFactory.contextWithCoreAndOptions(options); | |
| 1198 // _sourceFactory = _context.sourceFactory; | |
| 1199 // String oldCode = EngineTestCase.createSource(["library lib;", "part 'part
.dart';", "int a = 0;"]); | |
| 1200 // Source librarySource = _addSource("/lib.dart", oldCode); | |
| 1201 // Source partSource = _addSource("/part.dart", EngineTestCase.createSource(
["part of lib;", "int b = a;"])); | |
| 1202 // LibraryElement element = _context.computeLibraryElement(librarySource); | |
| 1203 // CompilationUnit unit = _context.getResolvedCompilationUnit(librarySource,
element); | |
| 1204 // JUnitTestCase.assertNotNull(unit); | |
| 1205 // int offset = oldCode.indexOf("int a") + 4; | |
| 1206 // String newCode = EngineTestCase.createSource(["library lib;", "part 'part
.dart';", "int ya = 0;"]); | |
| 1207 // JUnitTestCase.assertNull(_getIncrementalAnalysisCache(_context)); | |
| 1208 // _context.setChangedContents(librarySource, newCode, offset, 0, 1); | |
| 1209 // JUnitTestCase.assertEquals(newCode, _context.getContents(librarySource).d
ata); | |
| 1210 // IncrementalAnalysisCache incrementalCache = _getIncrementalAnalysisCache(
_context); | |
| 1211 // JUnitTestCase.assertEquals(librarySource, incrementalCache.librarySource)
; | |
| 1212 // JUnitTestCase.assertSame(unit, incrementalCache.resolvedUnit); | |
| 1213 // JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(partSource,
librarySource)); | |
| 1214 // JUnitTestCase.assertEquals(newCode, incrementalCache.newContents); | |
| 1215 // } | |
| 1216 // void test_setChangedContents_notResolved() { | |
| 1217 // _context = AnalysisContextFactory.contextWithCore(); | |
| 1218 // AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(_context.analy
sisOptions); | |
| 1219 // options.incremental = true; | |
| 1220 // _context.analysisOptions = options; | |
| 1221 // _sourceFactory = _context.sourceFactory; | |
| 1222 // String oldCode = EngineTestCase.createSource(["library lib;", "int a = 0;
"]); | |
| 1223 // Source librarySource = _addSource("/lib.dart", oldCode); | |
| 1224 // int offset = oldCode.indexOf("int a") + 4; | |
| 1225 // String newCode = EngineTestCase.createSource(["library lib;", "int ya = 0
;"]); | |
| 1226 // _context.setChangedContents(librarySource, newCode, offset, 0, 1); | |
| 1227 // JUnitTestCase.assertEquals(newCode, _context.getContents(librarySource).d
ata); | |
| 1228 // JUnitTestCase.assertNull(_getIncrementalAnalysisCache(_context)); | |
| 1229 // } | |
| 1230 // void test_setContents_libraryWithPart() { | |
| 1231 // _context = AnalysisContextFactory.contextWithCore(); | |
| 1232 // _sourceFactory = _context.sourceFactory; | |
| 1233 // Source librarySource = _addSource("/lib.dart", EngineTestCase.createSourc
e(["library lib;", "part 'part.dart';", "int a = 0;"])); | |
| 1234 // Source partSource = _addSource("/part.dart", EngineTestCase.createSource(
["part of lib;", "int b = a;"])); | |
| 1235 // _context.computeLibraryElement(librarySource); | |
| 1236 // IncrementalAnalysisCache incrementalCache = new IncrementalAnalysisCache(
librarySource, librarySource, null, null, null, 0, 0, 0); | |
| 1237 // _setIncrementalAnalysisCache(_context, incrementalCache); | |
| 1238 // JUnitTestCase.assertSame(incrementalCache, _getIncrementalAnalysisCache(_
context)); | |
| 1239 // _context.setContents(librarySource, EngineTestCase.createSource(["library
lib;", "part 'part.dart';", "int aa = 0;"])); | |
| 1240 // JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(partSource,
librarySource)); | |
| 1241 // JUnitTestCase.assertNull(_getIncrementalAnalysisCache(_context)); | |
| 1242 // } | |
| 1243 // void test_setContents_null() { | |
| 1244 // _context = AnalysisContextFactory.contextWithCore(); | |
| 1245 // _sourceFactory = _context.sourceFactory; | |
| 1246 // Source librarySource = _addSource("/lib.dart", EngineTestCase.createSourc
e(["library lib;", "int a = 0;"])); | |
| 1247 // _context.computeLibraryElement(librarySource); | |
| 1248 // IncrementalAnalysisCache incrementalCache = new IncrementalAnalysisCache(
librarySource, librarySource, null, null, null, 0, 0, 0); | |
| 1249 // _setIncrementalAnalysisCache(_context, incrementalCache); | |
| 1250 // JUnitTestCase.assertSame(incrementalCache, _getIncrementalAnalysisCache(_
context)); | |
| 1251 // _context.setContents(librarySource, null); | |
| 1252 // JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(librarySour
ce, librarySource)); | |
| 1253 // JUnitTestCase.assertNull(_getIncrementalAnalysisCache(_context)); | |
| 1254 // } | |
| 1255 // void test_setSourceFactory() { | |
| 1256 // JUnitTestCase.assertEquals(_sourceFactory, _context.sourceFactory); | |
| 1257 // SourceFactory factory = new SourceFactory([]); | |
| 1258 // _context.sourceFactory = factory; | |
| 1259 // JUnitTestCase.assertEquals(factory, _context.sourceFactory); | |
| 1260 // } | |
| 1261 // void test_unreadableSource() { | |
| 1262 // _context = AnalysisContextFactory.contextWithCore(); | |
| 1263 // _sourceFactory = _context.sourceFactory; | |
| 1264 // Source test1 = _addSource("/test1.dart", EngineTestCase.createSource(["im
port 'test2.dart';", "library test1;"])); | |
| 1265 // Source test2 = _addSource("/test2.dart", EngineTestCase.createSource([ | |
| 1266 // "import 'test1.dart';", | |
| 1267 // "import 'test3.dart';", | |
| 1268 // "library test2;"])); | |
| 1269 // Source test3 = _addSourceWithException("/test3.dart"); | |
| 1270 // _analyzeAll_assertFinished(); | |
| 1271 // // test1 and test2 should have been successfully analyzed despite the fac
t that | |
| 1272 // // test3 couldn't be read. | |
| 1273 // JUnitTestCase.assertNotNull(_context.computeLibraryElement(test1)); | |
| 1274 // JUnitTestCase.assertNotNull(_context.computeLibraryElement(test2)); | |
| 1275 // JUnitTestCase.assertNull(_context.computeLibraryElement(test3)); | |
| 1276 // } | |
| 1277 // void test_updateAnalysis() { | |
| 1278 // JUnitTestCase.assertTrue(_context.sourcesNeedingProcessing.isEmpty); | |
| 1279 // Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test
.dart")); | |
| 1280 // AnalysisDelta delta = new AnalysisDelta(); | |
| 1281 // delta.setAnalysisLevel(source, AnalysisLevel.ALL); | |
| 1282 // _context.applyAnalysisDelta(delta); | |
| 1283 // JUnitTestCase.assertTrue(_context.sourcesNeedingProcessing.contains(sourc
e)); | |
| 1284 // delta = new AnalysisDelta(); | |
| 1285 // delta.setAnalysisLevel(source, AnalysisLevel.NONE); | |
| 1286 // _context.applyAnalysisDelta(delta); | |
| 1287 // JUnitTestCase.assertFalse(_context.sourcesNeedingProcessing.contains(sour
ce)); | |
| 1288 // } | |
| 1289 // void xtest_performAnalysisTask_stress() { | |
| 1290 // int maxCacheSize = 4; | |
| 1291 // AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(_context.analy
sisOptions); | |
| 1292 // options.cacheSize = maxCacheSize; | |
| 1293 // _context.analysisOptions = options; | |
| 1294 // int sourceCount = maxCacheSize + 2; | |
| 1295 // List<Source> sources = new List<Source>(); | |
| 1296 // ChangeSet changeSet = new ChangeSet(); | |
| 1297 // for (int i = 0; i < sourceCount; i++) { | |
| 1298 // Source source = _addSource("/lib${i}.dart", "library lib${i};"); | |
| 1299 // sources.add(source); | |
| 1300 // changeSet.addedSource(source); | |
| 1301 // } | |
| 1302 // _context.applyChanges(changeSet); | |
| 1303 // _context.analysisPriorityOrder = sources; | |
| 1304 // for (int i = 0; i < 1000; i++) { | |
| 1305 // List<ChangeNotice> notice = _context.performAnalysisTask().changeNotice
s; | |
| 1306 // if (notice == null) { | |
| 1307 // //System.out.println("test_performAnalysisTask_stress: " + i); | |
| 1308 // break; | |
| 1309 // } | |
| 1310 // } | |
| 1311 // List<ChangeNotice> notice = _context.performAnalysisTask().changeNotices; | |
| 1312 // if (notice != null) { | |
| 1313 // JUnitTestCase.fail("performAnalysisTask failed to terminate after analy
zing all sources"); | |
| 1314 // } | |
| 1315 // } | |
| 1316 // @override | |
| 1317 // void tearDown() { | |
| 1318 // _context = null; | |
| 1319 // _sourceFactory = null; | |
| 1320 // super.tearDown(); | |
| 1321 // } | |
| 1322 // Source _addSource(String fileName, String contents) { | |
| 1323 // Source source = new FileBasedSource.con1(FileUtilities2.createFile(fileNa
me)); | |
| 1324 // ChangeSet changeSet = new ChangeSet(); | |
| 1325 // changeSet.addedSource(source); | |
| 1326 // _context.applyChanges(changeSet); | |
| 1327 // _context.setContents(source, contents); | |
| 1328 // return source; | |
| 1329 // } | |
| 1330 // TestSource _addSourceWithException(String fileName) => _addSourceWithExcept
ion2(fileName, ""); | |
| 1331 // TestSource _addSourceWithException2(String fileName, String contents) { | |
| 1332 // TestSource source = new TestSource.con1(FileUtilities2.createFile(fileNam
e), contents); | |
| 1333 // source.generateExceptionOnRead = true; | |
| 1334 // ChangeSet changeSet = new ChangeSet(); | |
| 1335 // changeSet.addedSource(source); | |
| 1336 // _context.applyChanges(changeSet); | |
| 1337 // return source; | |
| 1338 // } | |
| 1339 // /** | |
| 1340 // * Perform analysis tasks up to 512 times and asserts that that was enough. | |
| 1341 // */ | |
| 1342 // void _analyzeAll_assertFinished() { | |
| 1343 // _analyzeAll_assertFinished2(512); | |
| 1344 // } | |
| 1345 // /** | |
| 1346 // * Perform analysis tasks up to the given number of times and asserts that
that was enough. | |
| 1347 // * | |
| 1348 // * @param maxIterations the maximum number of tasks to perform | |
| 1349 // */ | |
| 1350 // void _analyzeAll_assertFinished2(int maxIterations) { | |
| 1351 // for (int i = 0; i < maxIterations; i++) { | |
| 1352 // List<ChangeNotice> notice = _context.performAnalysisTask().changeNotice
s; | |
| 1353 // if (notice == null) { | |
| 1354 // return; | |
| 1355 // } | |
| 1356 // } | |
| 1357 // JUnitTestCase.fail("performAnalysisTask failed to terminate after analyzi
ng all sources"); | |
| 1358 // } | |
| 1359 // void _changeSource(TestSource source, String contents) { | |
| 1360 // source.contents = contents; | |
| 1361 // ChangeSet changeSet = new ChangeSet(); | |
| 1362 // changeSet.changedSource(source); | |
| 1363 // _context.applyChanges(changeSet); | |
| 1364 // } | |
| 1365 // /** | |
| 1366 // * Search the given compilation unit for a class with the given name. Retur
n the class with the | |
| 1367 // * given name, or `null` if the class cannot be found. | |
| 1368 // * | |
| 1369 // * @param unit the compilation unit being searched | |
| 1370 // * @param className the name of the class being searched for | |
| 1371 // * @return the class with the given name | |
| 1372 // */ | |
| 1373 // ClassElement _findClass(CompilationUnitElement unit, String className) { | |
| 1374 // for (ClassElement classElement in unit.types) { | |
| 1375 // if (classElement.displayName == className) { | |
| 1376 // return classElement; | |
| 1377 // } | |
| 1378 // } | |
| 1379 // return null; | |
| 1380 // } | |
| 1381 // IncrementalAnalysisCache _getIncrementalAnalysisCache(AnalysisContextImpl c
ontext2) { | |
| 1382 // return context2.incrementalAnalysisCache_J2DAccessor as IncrementalAnalys
isCache; | |
| 1383 // } | |
| 1384 // List<Source> _getPriorityOrder(AnalysisContextImpl context2) { | |
| 1385 // return context2.priorityOrder_J2DAccessor as List<Source>; | |
| 1386 // } | |
| 1387 // void _removeSource(Source source) { | |
| 1388 // ChangeSet changeSet = new ChangeSet(); | |
| 1389 // changeSet.removedSource(source); | |
| 1390 // _context.applyChanges(changeSet); | |
| 1391 // } | |
| 1392 // void _setIncrementalAnalysisCache(AnalysisContextImpl context2, Incremental
AnalysisCache incrementalCache) { | |
| 1393 // context2.incrementalAnalysisCache_J2DAccessor = incrementalCache; | |
| 1394 // } | |
| 1395 // static dartSuite() { | |
| 1396 // _ut.group('AnalysisContextImplTest', () { | |
| 1397 // _ut.test('test_applyChanges_add', () { | |
| 1398 // final __test = new AnalysisContextImplTest(); | |
| 1399 // runJUnitTest(__test, __test.test_applyChanges_add); | |
| 1400 // }); | |
| 1401 // _ut.test('test_applyChanges_change_flush_element', () { | |
| 1402 // final __test = new AnalysisContextImplTest(); | |
| 1403 // runJUnitTest(__test, __test.test_applyChanges_change_flush_element); | |
| 1404 // }); | |
| 1405 // _ut.test('test_applyChanges_change_multiple', () { | |
| 1406 // final __test = new AnalysisContextImplTest(); | |
| 1407 // runJUnitTest(__test, __test.test_applyChanges_change_multiple); | |
| 1408 // }); | |
| 1409 // _ut.test('test_applyChanges_empty', () { | |
| 1410 // final __test = new AnalysisContextImplTest(); | |
| 1411 // runJUnitTest(__test, __test.test_applyChanges_empty); | |
| 1412 // }); | |
| 1413 // _ut.test('test_applyChanges_overriddenSource', () { | |
| 1414 // final __test = new AnalysisContextImplTest(); | |
| 1415 // runJUnitTest(__test, __test.test_applyChanges_overriddenSource); | |
| 1416 // }); | |
| 1417 // _ut.test('test_applyChanges_remove', () { | |
| 1418 // final __test = new AnalysisContextImplTest(); | |
| 1419 // runJUnitTest(__test, __test.test_applyChanges_remove); | |
| 1420 // }); | |
| 1421 // _ut.test('test_applyChanges_removeContainer', () { | |
| 1422 // final __test = new AnalysisContextImplTest(); | |
| 1423 // runJUnitTest(__test, __test.test_applyChanges_removeContainer); | |
| 1424 // }); | |
| 1425 // _ut.test('test_computeDocumentationComment_block', () { | |
| 1426 // final __test = new AnalysisContextImplTest(); | |
| 1427 // runJUnitTest(__test, __test.test_computeDocumentationComment_block); | |
| 1428 // }); | |
| 1429 // _ut.test('test_computeDocumentationComment_none', () { | |
| 1430 // final __test = new AnalysisContextImplTest(); | |
| 1431 // runJUnitTest(__test, __test.test_computeDocumentationComment_none); | |
| 1432 // }); | |
| 1433 // _ut.test('test_computeDocumentationComment_null', () { | |
| 1434 // final __test = new AnalysisContextImplTest(); | |
| 1435 // runJUnitTest(__test, __test.test_computeDocumentationComment_null); | |
| 1436 // }); | |
| 1437 // _ut.test('test_computeDocumentationComment_singleLine_multiple_EOL_n',
() { | |
| 1438 // final __test = new AnalysisContextImplTest(); | |
| 1439 // runJUnitTest(__test, __test.test_computeDocumentationComment_singleLi
ne_multiple_EOL_n); | |
| 1440 // }); | |
| 1441 // _ut.test('test_computeDocumentationComment_singleLine_multiple_EOL_rn',
() { | |
| 1442 // final __test = new AnalysisContextImplTest(); | |
| 1443 // runJUnitTest(__test, __test.test_computeDocumentationComment_singleLi
ne_multiple_EOL_rn); | |
| 1444 // }); | |
| 1445 // _ut.test('test_computeErrors_dart_none', () { | |
| 1446 // final __test = new AnalysisContextImplTest(); | |
| 1447 // runJUnitTest(__test, __test.test_computeErrors_dart_none); | |
| 1448 // }); | |
| 1449 // _ut.test('test_computeErrors_dart_part', () { | |
| 1450 // final __test = new AnalysisContextImplTest(); | |
| 1451 // runJUnitTest(__test, __test.test_computeErrors_dart_part); | |
| 1452 // }); | |
| 1453 // _ut.test('test_computeErrors_dart_some', () { | |
| 1454 // final __test = new AnalysisContextImplTest(); | |
| 1455 // runJUnitTest(__test, __test.test_computeErrors_dart_some); | |
| 1456 // }); | |
| 1457 // _ut.test('test_computeErrors_html_none', () { | |
| 1458 // final __test = new AnalysisContextImplTest(); | |
| 1459 // runJUnitTest(__test, __test.test_computeErrors_html_none); | |
| 1460 // }); | |
| 1461 // _ut.test('test_computeExportedLibraries_none', () { | |
| 1462 // final __test = new AnalysisContextImplTest(); | |
| 1463 // runJUnitTest(__test, __test.test_computeExportedLibraries_none); | |
| 1464 // }); | |
| 1465 // _ut.test('test_computeExportedLibraries_some', () { | |
| 1466 // final __test = new AnalysisContextImplTest(); | |
| 1467 // runJUnitTest(__test, __test.test_computeExportedLibraries_some); | |
| 1468 // }); | |
| 1469 // _ut.test('test_computeHtmlElement_nonHtml', () { | |
| 1470 // final __test = new AnalysisContextImplTest(); | |
| 1471 // runJUnitTest(__test, __test.test_computeHtmlElement_nonHtml); | |
| 1472 // }); | |
| 1473 // _ut.test('test_computeHtmlElement_valid', () { | |
| 1474 // final __test = new AnalysisContextImplTest(); | |
| 1475 // runJUnitTest(__test, __test.test_computeHtmlElement_valid); | |
| 1476 // }); | |
| 1477 // _ut.test('test_computeImportedLibraries_none', () { | |
| 1478 // final __test = new AnalysisContextImplTest(); | |
| 1479 // runJUnitTest(__test, __test.test_computeImportedLibraries_none); | |
| 1480 // }); | |
| 1481 // _ut.test('test_computeImportedLibraries_some', () { | |
| 1482 // final __test = new AnalysisContextImplTest(); | |
| 1483 // runJUnitTest(__test, __test.test_computeImportedLibraries_some); | |
| 1484 // }); | |
| 1485 // _ut.test('test_computeKindOf_html', () { | |
| 1486 // final __test = new AnalysisContextImplTest(); | |
| 1487 // runJUnitTest(__test, __test.test_computeKindOf_html); | |
| 1488 // }); | |
| 1489 // _ut.test('test_computeKindOf_library', () { | |
| 1490 // final __test = new AnalysisContextImplTest(); | |
| 1491 // runJUnitTest(__test, __test.test_computeKindOf_library); | |
| 1492 // }); | |
| 1493 // _ut.test('test_computeKindOf_libraryAndPart', () { | |
| 1494 // final __test = new AnalysisContextImplTest(); | |
| 1495 // runJUnitTest(__test, __test.test_computeKindOf_libraryAndPart); | |
| 1496 // }); | |
| 1497 // _ut.test('test_computeKindOf_part', () { | |
| 1498 // final __test = new AnalysisContextImplTest(); | |
| 1499 // runJUnitTest(__test, __test.test_computeKindOf_part); | |
| 1500 // }); | |
| 1501 // _ut.test('test_computeLibraryElement', () { | |
| 1502 // final __test = new AnalysisContextImplTest(); | |
| 1503 // runJUnitTest(__test, __test.test_computeLibraryElement); | |
| 1504 // }); | |
| 1505 // _ut.test('test_computeLineInfo_dart', () { | |
| 1506 // final __test = new AnalysisContextImplTest(); | |
| 1507 // runJUnitTest(__test, __test.test_computeLineInfo_dart); | |
| 1508 // }); | |
| 1509 // _ut.test('test_computeLineInfo_html', () { | |
| 1510 // final __test = new AnalysisContextImplTest(); | |
| 1511 // runJUnitTest(__test, __test.test_computeLineInfo_html); | |
| 1512 // }); | |
| 1513 // _ut.test('test_computeResolvableCompilationUnit_dart_exception', () { | |
| 1514 // final __test = new AnalysisContextImplTest(); | |
| 1515 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_dar
t_exception); | |
| 1516 // }); | |
| 1517 // _ut.test('test_computeResolvableCompilationUnit_html_exception', () { | |
| 1518 // final __test = new AnalysisContextImplTest(); | |
| 1519 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_htm
l_exception); | |
| 1520 // }); | |
| 1521 // _ut.test('test_computeResolvableCompilationUnit_valid', () { | |
| 1522 // final __test = new AnalysisContextImplTest(); | |
| 1523 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_val
id); | |
| 1524 // }); | |
| 1525 // _ut.test('test_dispose', () { | |
| 1526 // final __test = new AnalysisContextImplTest(); | |
| 1527 // runJUnitTest(__test, __test.test_dispose); | |
| 1528 // }); | |
| 1529 // _ut.test('test_exists_false', () { | |
| 1530 // final __test = new AnalysisContextImplTest(); | |
| 1531 // runJUnitTest(__test, __test.test_exists_false); | |
| 1532 // }); | |
| 1533 // _ut.test('test_exists_null', () { | |
| 1534 // final __test = new AnalysisContextImplTest(); | |
| 1535 // runJUnitTest(__test, __test.test_exists_null); | |
| 1536 // }); | |
| 1537 // _ut.test('test_exists_overridden', () { | |
| 1538 // final __test = new AnalysisContextImplTest(); | |
| 1539 // runJUnitTest(__test, __test.test_exists_overridden); | |
| 1540 // }); | |
| 1541 // _ut.test('test_exists_true', () { | |
| 1542 // final __test = new AnalysisContextImplTest(); | |
| 1543 // runJUnitTest(__test, __test.test_exists_true); | |
| 1544 // }); | |
| 1545 // _ut.test('test_getAnalysisOptions', () { | |
| 1546 // final __test = new AnalysisContextImplTest(); | |
| 1547 // runJUnitTest(__test, __test.test_getAnalysisOptions); | |
| 1548 // }); | |
| 1549 // _ut.test('test_getContents_fromSource', () { | |
| 1550 // final __test = new AnalysisContextImplTest(); | |
| 1551 // runJUnitTest(__test, __test.test_getContents_fromSource); | |
| 1552 // }); | |
| 1553 // _ut.test('test_getContents_overridden', () { | |
| 1554 // final __test = new AnalysisContextImplTest(); | |
| 1555 // runJUnitTest(__test, __test.test_getContents_overridden); | |
| 1556 // }); | |
| 1557 // _ut.test('test_getContents_unoverridden', () { | |
| 1558 // final __test = new AnalysisContextImplTest(); | |
| 1559 // runJUnitTest(__test, __test.test_getContents_unoverridden); | |
| 1560 // }); | |
| 1561 // _ut.test('test_getDeclaredVariables', () { | |
| 1562 // final __test = new AnalysisContextImplTest(); | |
| 1563 // runJUnitTest(__test, __test.test_getDeclaredVariables); | |
| 1564 // }); | |
| 1565 // _ut.test('test_getElement', () { | |
| 1566 // final __test = new AnalysisContextImplTest(); | |
| 1567 // runJUnitTest(__test, __test.test_getElement); | |
| 1568 // }); | |
| 1569 // _ut.test('test_getElement_constructor_named', () { | |
| 1570 // final __test = new AnalysisContextImplTest(); | |
| 1571 // runJUnitTest(__test, __test.test_getElement_constructor_named); | |
| 1572 // }); | |
| 1573 // _ut.test('test_getElement_constructor_unnamed', () { | |
| 1574 // final __test = new AnalysisContextImplTest(); | |
| 1575 // runJUnitTest(__test, __test.test_getElement_constructor_unnamed); | |
| 1576 // }); | |
| 1577 // _ut.test('test_getErrors_dart_none', () { | |
| 1578 // final __test = new AnalysisContextImplTest(); | |
| 1579 // runJUnitTest(__test, __test.test_getErrors_dart_none); | |
| 1580 // }); | |
| 1581 // _ut.test('test_getErrors_dart_some', () { | |
| 1582 // final __test = new AnalysisContextImplTest(); | |
| 1583 // runJUnitTest(__test, __test.test_getErrors_dart_some); | |
| 1584 // }); | |
| 1585 // _ut.test('test_getErrors_html_none', () { | |
| 1586 // final __test = new AnalysisContextImplTest(); | |
| 1587 // runJUnitTest(__test, __test.test_getErrors_html_none); | |
| 1588 // }); | |
| 1589 // _ut.test('test_getErrors_html_some', () { | |
| 1590 // final __test = new AnalysisContextImplTest(); | |
| 1591 // runJUnitTest(__test, __test.test_getErrors_html_some); | |
| 1592 // }); | |
| 1593 // _ut.test('test_getHtmlElement_dart', () { | |
| 1594 // final __test = new AnalysisContextImplTest(); | |
| 1595 // runJUnitTest(__test, __test.test_getHtmlElement_dart); | |
| 1596 // }); | |
| 1597 // _ut.test('test_getHtmlElement_html', () { | |
| 1598 // final __test = new AnalysisContextImplTest(); | |
| 1599 // runJUnitTest(__test, __test.test_getHtmlElement_html); | |
| 1600 // }); | |
| 1601 // _ut.test('test_getHtmlFilesReferencing_html', () { | |
| 1602 // final __test = new AnalysisContextImplTest(); | |
| 1603 // runJUnitTest(__test, __test.test_getHtmlFilesReferencing_html); | |
| 1604 // }); | |
| 1605 // _ut.test('test_getHtmlFilesReferencing_library', () { | |
| 1606 // final __test = new AnalysisContextImplTest(); | |
| 1607 // runJUnitTest(__test, __test.test_getHtmlFilesReferencing_library); | |
| 1608 // }); | |
| 1609 // _ut.test('test_getHtmlFilesReferencing_part', () { | |
| 1610 // final __test = new AnalysisContextImplTest(); | |
| 1611 // runJUnitTest(__test, __test.test_getHtmlFilesReferencing_part); | |
| 1612 // }); | |
| 1613 // _ut.test('test_getHtmlSources', () { | |
| 1614 // final __test = new AnalysisContextImplTest(); | |
| 1615 // runJUnitTest(__test, __test.test_getHtmlSources); | |
| 1616 // }); | |
| 1617 // _ut.test('test_getKindOf_html', () { | |
| 1618 // final __test = new AnalysisContextImplTest(); | |
| 1619 // runJUnitTest(__test, __test.test_getKindOf_html); | |
| 1620 // }); | |
| 1621 // _ut.test('test_getKindOf_library', () { | |
| 1622 // final __test = new AnalysisContextImplTest(); | |
| 1623 // runJUnitTest(__test, __test.test_getKindOf_library); | |
| 1624 // }); | |
| 1625 // _ut.test('test_getKindOf_part', () { | |
| 1626 // final __test = new AnalysisContextImplTest(); | |
| 1627 // runJUnitTest(__test, __test.test_getKindOf_part); | |
| 1628 // }); | |
| 1629 // _ut.test('test_getKindOf_unknown', () { | |
| 1630 // final __test = new AnalysisContextImplTest(); | |
| 1631 // runJUnitTest(__test, __test.test_getKindOf_unknown); | |
| 1632 // }); | |
| 1633 // _ut.test('test_getLaunchableClientLibrarySources', () { | |
| 1634 // final __test = new AnalysisContextImplTest(); | |
| 1635 // runJUnitTest(__test, __test.test_getLaunchableClientLibrarySources); | |
| 1636 // }); | |
| 1637 // _ut.test('test_getLaunchableServerLibrarySources', () { | |
| 1638 // final __test = new AnalysisContextImplTest(); | |
| 1639 // runJUnitTest(__test, __test.test_getLaunchableServerLibrarySources); | |
| 1640 // }); | |
| 1641 // _ut.test('test_getLibrariesContaining', () { | |
| 1642 // final __test = new AnalysisContextImplTest(); | |
| 1643 // runJUnitTest(__test, __test.test_getLibrariesContaining); | |
| 1644 // }); | |
| 1645 // _ut.test('test_getLibrariesDependingOn', () { | |
| 1646 // final __test = new AnalysisContextImplTest(); | |
| 1647 // runJUnitTest(__test, __test.test_getLibrariesDependingOn); | |
| 1648 // }); | |
| 1649 // _ut.test('test_getLibrariesReferencedFromHtml', () { | |
| 1650 // final __test = new AnalysisContextImplTest(); | |
| 1651 // runJUnitTest(__test, __test.test_getLibrariesReferencedFromHtml); | |
| 1652 // }); | |
| 1653 // _ut.test('test_getLibrariesReferencedFromHtml_no', () { | |
| 1654 // final __test = new AnalysisContextImplTest(); | |
| 1655 // runJUnitTest(__test, __test.test_getLibrariesReferencedFromHtml_no); | |
| 1656 // }); | |
| 1657 // _ut.test('test_getLibraryElement', () { | |
| 1658 // final __test = new AnalysisContextImplTest(); | |
| 1659 // runJUnitTest(__test, __test.test_getLibraryElement); | |
| 1660 // }); | |
| 1661 // _ut.test('test_getLibrarySources', () { | |
| 1662 // final __test = new AnalysisContextImplTest(); | |
| 1663 // runJUnitTest(__test, __test.test_getLibrarySources); | |
| 1664 // }); | |
| 1665 // _ut.test('test_getLineInfo', () { | |
| 1666 // final __test = new AnalysisContextImplTest(); | |
| 1667 // runJUnitTest(__test, __test.test_getLineInfo); | |
| 1668 // }); | |
| 1669 // _ut.test('test_getModificationStamp_fromSource', () { | |
| 1670 // final __test = new AnalysisContextImplTest(); | |
| 1671 // runJUnitTest(__test, __test.test_getModificationStamp_fromSource); | |
| 1672 // }); | |
| 1673 // _ut.test('test_getModificationStamp_overridden', () { | |
| 1674 // final __test = new AnalysisContextImplTest(); | |
| 1675 // runJUnitTest(__test, __test.test_getModificationStamp_overridden); | |
| 1676 // }); | |
| 1677 // _ut.test('test_getPublicNamespace_element', () { | |
| 1678 // final __test = new AnalysisContextImplTest(); | |
| 1679 // runJUnitTest(__test, __test.test_getPublicNamespace_element); | |
| 1680 // }); | |
| 1681 // _ut.test('test_getRefactoringUnsafeSources', () { | |
| 1682 // final __test = new AnalysisContextImplTest(); | |
| 1683 // runJUnitTest(__test, __test.test_getRefactoringUnsafeSources); | |
| 1684 // }); | |
| 1685 // _ut.test('test_getResolvedCompilationUnit_library', () { | |
| 1686 // final __test = new AnalysisContextImplTest(); | |
| 1687 // runJUnitTest(__test, __test.test_getResolvedCompilationUnit_library); | |
| 1688 // }); | |
| 1689 // _ut.test('test_getResolvedCompilationUnit_library_null', () { | |
| 1690 // final __test = new AnalysisContextImplTest(); | |
| 1691 // runJUnitTest(__test, __test.test_getResolvedCompilationUnit_library_n
ull); | |
| 1692 // }); | |
| 1693 // _ut.test('test_getResolvedCompilationUnit_source_dart', () { | |
| 1694 // final __test = new AnalysisContextImplTest(); | |
| 1695 // runJUnitTest(__test, __test.test_getResolvedCompilationUnit_source_da
rt); | |
| 1696 // }); | |
| 1697 // _ut.test('test_getResolvedCompilationUnit_source_html', () { | |
| 1698 // final __test = new AnalysisContextImplTest(); | |
| 1699 // runJUnitTest(__test, __test.test_getResolvedCompilationUnit_source_ht
ml); | |
| 1700 // }); | |
| 1701 // _ut.test('test_getResolvedHtmlUnit', () { | |
| 1702 // final __test = new AnalysisContextImplTest(); | |
| 1703 // runJUnitTest(__test, __test.test_getResolvedHtmlUnit); | |
| 1704 // }); | |
| 1705 // _ut.test('test_getSourceFactory', () { | |
| 1706 // final __test = new AnalysisContextImplTest(); | |
| 1707 // runJUnitTest(__test, __test.test_getSourceFactory); | |
| 1708 // }); | |
| 1709 // _ut.test('test_getStatistics', () { | |
| 1710 // final __test = new AnalysisContextImplTest(); | |
| 1711 // runJUnitTest(__test, __test.test_getStatistics); | |
| 1712 // }); | |
| 1713 // _ut.test('test_isClientLibrary_dart', () { | |
| 1714 // final __test = new AnalysisContextImplTest(); | |
| 1715 // runJUnitTest(__test, __test.test_isClientLibrary_dart); | |
| 1716 // }); | |
| 1717 // _ut.test('test_isClientLibrary_html', () { | |
| 1718 // final __test = new AnalysisContextImplTest(); | |
| 1719 // runJUnitTest(__test, __test.test_isClientLibrary_html); | |
| 1720 // }); | |
| 1721 // _ut.test('test_isServerLibrary_dart', () { | |
| 1722 // final __test = new AnalysisContextImplTest(); | |
| 1723 // runJUnitTest(__test, __test.test_isServerLibrary_dart); | |
| 1724 // }); | |
| 1725 // _ut.test('test_isServerLibrary_html', () { | |
| 1726 // final __test = new AnalysisContextImplTest(); | |
| 1727 // runJUnitTest(__test, __test.test_isServerLibrary_html); | |
| 1728 // }); | |
| 1729 // _ut.test('test_parseCompilationUnit_errors', () { | |
| 1730 // final __test = new AnalysisContextImplTest(); | |
| 1731 // runJUnitTest(__test, __test.test_parseCompilationUnit_errors); | |
| 1732 // }); | |
| 1733 // _ut.test('test_parseCompilationUnit_exception', () { | |
| 1734 // final __test = new AnalysisContextImplTest(); | |
| 1735 // runJUnitTest(__test, __test.test_parseCompilationUnit_exception); | |
| 1736 // }); | |
| 1737 // _ut.test('test_parseCompilationUnit_html', () { | |
| 1738 // final __test = new AnalysisContextImplTest(); | |
| 1739 // runJUnitTest(__test, __test.test_parseCompilationUnit_html); | |
| 1740 // }); | |
| 1741 // _ut.test('test_parseCompilationUnit_noErrors', () { | |
| 1742 // final __test = new AnalysisContextImplTest(); | |
| 1743 // runJUnitTest(__test, __test.test_parseCompilationUnit_noErrors); | |
| 1744 // }); | |
| 1745 // _ut.test('test_parseCompilationUnit_nonExistentSource', () { | |
| 1746 // final __test = new AnalysisContextImplTest(); | |
| 1747 // runJUnitTest(__test, __test.test_parseCompilationUnit_nonExistentSour
ce); | |
| 1748 // }); | |
| 1749 // _ut.test('test_parseHtmlUnit_noErrors', () { | |
| 1750 // final __test = new AnalysisContextImplTest(); | |
| 1751 // runJUnitTest(__test, __test.test_parseHtmlUnit_noErrors); | |
| 1752 // }); | |
| 1753 // _ut.test('test_parseHtmlUnit_resolveDirectives', () { | |
| 1754 // final __test = new AnalysisContextImplTest(); | |
| 1755 // runJUnitTest(__test, __test.test_parseHtmlUnit_resolveDirectives); | |
| 1756 // }); | |
| 1757 // _ut.test('test_performAnalysisTask_IOException', () { | |
| 1758 // final __test = new AnalysisContextImplTest(); | |
| 1759 // runJUnitTest(__test, __test.test_performAnalysisTask_IOException); | |
| 1760 // }); | |
| 1761 // _ut.test('test_performAnalysisTask_addPart', () { | |
| 1762 // final __test = new AnalysisContextImplTest(); | |
| 1763 // runJUnitTest(__test, __test.test_performAnalysisTask_addPart); | |
| 1764 // }); | |
| 1765 // _ut.test('test_performAnalysisTask_changeLibraryContents', () { | |
| 1766 // final __test = new AnalysisContextImplTest(); | |
| 1767 // runJUnitTest(__test, __test.test_performAnalysisTask_changeLibraryCon
tents); | |
| 1768 // }); | |
| 1769 // _ut.test('test_performAnalysisTask_changeLibraryThenPartContents', () { | |
| 1770 // final __test = new AnalysisContextImplTest(); | |
| 1771 // runJUnitTest(__test, __test.test_performAnalysisTask_changeLibraryThe
nPartContents); | |
| 1772 // }); | |
| 1773 // _ut.test('test_performAnalysisTask_changePartContents_makeItAPart', ()
{ | |
| 1774 // final __test = new AnalysisContextImplTest(); | |
| 1775 // runJUnitTest(__test, __test.test_performAnalysisTask_changePartConten
ts_makeItAPart); | |
| 1776 // }); | |
| 1777 // _ut.test('test_performAnalysisTask_changePartContents_makeItNotPart', (
) { | |
| 1778 // final __test = new AnalysisContextImplTest(); | |
| 1779 // runJUnitTest(__test, __test.test_performAnalysisTask_changePartConten
ts_makeItNotPart); | |
| 1780 // }); | |
| 1781 // _ut.test('test_performAnalysisTask_changePartContents_noSemanticChanges
', () { | |
| 1782 // final __test = new AnalysisContextImplTest(); | |
| 1783 // runJUnitTest(__test, __test.test_performAnalysisTask_changePartConten
ts_noSemanticChanges); | |
| 1784 // }); | |
| 1785 // _ut.test('test_performAnalysisTask_importedLibraryAdd', () { | |
| 1786 // final __test = new AnalysisContextImplTest(); | |
| 1787 // runJUnitTest(__test, __test.test_performAnalysisTask_importedLibraryA
dd); | |
| 1788 // }); | |
| 1789 // _ut.test('test_performAnalysisTask_importedLibraryAdd_html', () { | |
| 1790 // final __test = new AnalysisContextImplTest(); | |
| 1791 // runJUnitTest(__test, __test.test_performAnalysisTask_importedLibraryA
dd_html); | |
| 1792 // }); | |
| 1793 // _ut.test('test_performAnalysisTask_importedLibraryDelete', () { | |
| 1794 // final __test = new AnalysisContextImplTest(); | |
| 1795 // runJUnitTest(__test, __test.test_performAnalysisTask_importedLibraryD
elete); | |
| 1796 // }); | |
| 1797 // _ut.test('test_performAnalysisTask_missingPart', () { | |
| 1798 // final __test = new AnalysisContextImplTest(); | |
| 1799 // runJUnitTest(__test, __test.test_performAnalysisTask_missingPart); | |
| 1800 // }); | |
| 1801 // _ut.test('test_performAnalysisTask_modifiedAfterParse', () { | |
| 1802 // final __test = new AnalysisContextImplTest(); | |
| 1803 // runJUnitTest(__test, __test.test_performAnalysisTask_modifiedAfterPar
se); | |
| 1804 // }); | |
| 1805 // _ut.test('test_resolveCompilationUnit_import_relative', () { | |
| 1806 // final __test = new AnalysisContextImplTest(); | |
| 1807 // runJUnitTest(__test, __test.test_resolveCompilationUnit_import_relati
ve); | |
| 1808 // }); | |
| 1809 // _ut.test('test_resolveCompilationUnit_import_relative_cyclic', () { | |
| 1810 // final __test = new AnalysisContextImplTest(); | |
| 1811 // runJUnitTest(__test, __test.test_resolveCompilationUnit_import_relati
ve_cyclic); | |
| 1812 // }); | |
| 1813 // _ut.test('test_resolveCompilationUnit_library', () { | |
| 1814 // final __test = new AnalysisContextImplTest(); | |
| 1815 // runJUnitTest(__test, __test.test_resolveCompilationUnit_library); | |
| 1816 // }); | |
| 1817 // _ut.test('test_resolveCompilationUnit_source', () { | |
| 1818 // final __test = new AnalysisContextImplTest(); | |
| 1819 // runJUnitTest(__test, __test.test_resolveCompilationUnit_source); | |
| 1820 // }); | |
| 1821 // _ut.test('test_resolveCompilationUnit_sourceChangeDuringResolution', ()
{ | |
| 1822 // final __test = new AnalysisContextImplTest(); | |
| 1823 // runJUnitTest(__test, __test.test_resolveCompilationUnit_sourceChangeD
uringResolution); | |
| 1824 // }); | |
| 1825 // _ut.test('test_resolveHtmlUnit', () { | |
| 1826 // final __test = new AnalysisContextImplTest(); | |
| 1827 // runJUnitTest(__test, __test.test_resolveHtmlUnit); | |
| 1828 // }); | |
| 1829 // _ut.test('test_setAnalysisOptions', () { | |
| 1830 // final __test = new AnalysisContextImplTest(); | |
| 1831 // runJUnitTest(__test, __test.test_setAnalysisOptions); | |
| 1832 // }); | |
| 1833 // _ut.test('test_setAnalysisOptions_reduceAnalysisPriorityOrder', () { | |
| 1834 // final __test = new AnalysisContextImplTest(); | |
| 1835 // runJUnitTest(__test, __test.test_setAnalysisOptions_reduceAnalysisPri
orityOrder); | |
| 1836 // }); | |
| 1837 // _ut.test('test_setAnalysisPriorityOrder_empty', () { | |
| 1838 // final __test = new AnalysisContextImplTest(); | |
| 1839 // runJUnitTest(__test, __test.test_setAnalysisPriorityOrder_empty); | |
| 1840 // }); | |
| 1841 // _ut.test('test_setAnalysisPriorityOrder_lessThanCacheSize', () { | |
| 1842 // final __test = new AnalysisContextImplTest(); | |
| 1843 // runJUnitTest(__test, __test.test_setAnalysisPriorityOrder_lessThanCac
heSize); | |
| 1844 // }); | |
| 1845 // _ut.test('test_setAnalysisPriorityOrder_nonEmpty', () { | |
| 1846 // final __test = new AnalysisContextImplTest(); | |
| 1847 // runJUnitTest(__test, __test.test_setAnalysisPriorityOrder_nonEmpty); | |
| 1848 // }); | |
| 1849 // _ut.test('test_setChangedContents_libraryWithPart', () { | |
| 1850 // final __test = new AnalysisContextImplTest(); | |
| 1851 // runJUnitTest(__test, __test.test_setChangedContents_libraryWithPart); | |
| 1852 // }); | |
| 1853 // _ut.test('test_setChangedContents_notResolved', () { | |
| 1854 // final __test = new AnalysisContextImplTest(); | |
| 1855 // runJUnitTest(__test, __test.test_setChangedContents_notResolved); | |
| 1856 // }); | |
| 1857 // _ut.test('test_setContents_libraryWithPart', () { | |
| 1858 // final __test = new AnalysisContextImplTest(); | |
| 1859 // runJUnitTest(__test, __test.test_setContents_libraryWithPart); | |
| 1860 // }); | |
| 1861 // _ut.test('test_setContents_null', () { | |
| 1862 // final __test = new AnalysisContextImplTest(); | |
| 1863 // runJUnitTest(__test, __test.test_setContents_null); | |
| 1864 // }); | |
| 1865 // _ut.test('test_setSourceFactory', () { | |
| 1866 // final __test = new AnalysisContextImplTest(); | |
| 1867 // runJUnitTest(__test, __test.test_setSourceFactory); | |
| 1868 // }); | |
| 1869 // _ut.test('test_unreadableSource', () { | |
| 1870 // final __test = new AnalysisContextImplTest(); | |
| 1871 // runJUnitTest(__test, __test.test_unreadableSource); | |
| 1872 // }); | |
| 1873 // _ut.test('test_updateAnalysis', () { | |
| 1874 // final __test = new AnalysisContextImplTest(); | |
| 1875 // runJUnitTest(__test, __test.test_updateAnalysis); | |
| 1876 // }); | |
| 1877 // }); | |
| 1878 // } | |
| 1879 // } | |
| 1880 // class AnalysisOptionsImplTest extends EngineTestCase { | |
| 1881 // void test_AnalysisOptionsImpl_copy() { | |
| 1882 // bool booleanValue = true; | |
| 1883 // for (int i = 0; i < 2; i++, booleanValue = !booleanValue) { | |
| 1884 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1885 // options.analyzeAngular = booleanValue; | |
| 1886 // options.analyzeFunctionBodies = booleanValue; | |
| 1887 // options.analyzePolymer = booleanValue; | |
| 1888 // options.cacheSize = i; | |
| 1889 // options.dart2jsHint = booleanValue; | |
| 1890 // options.enableDeferredLoading = booleanValue; | |
| 1891 // options.generateSdkErrors = booleanValue; | |
| 1892 // options.hint = booleanValue; | |
| 1893 // options.incremental = booleanValue; | |
| 1894 // options.preserveComments = booleanValue; | |
| 1895 // AnalysisOptionsImpl copy = new AnalysisOptionsImpl.con1(options); | |
| 1896 // JUnitTestCase.assertEquals(options.analyzeAngular, copy.analyzeAngular)
; | |
| 1897 // JUnitTestCase.assertEquals(options.analyzeFunctionBodies, copy.analyzeF
unctionBodies); | |
| 1898 // JUnitTestCase.assertEquals(options.analyzePolymer, copy.analyzePolymer)
; | |
| 1899 // JUnitTestCase.assertEquals(options.cacheSize, copy.cacheSize); | |
| 1900 // JUnitTestCase.assertEquals(options.dart2jsHint, copy.dart2jsHint); | |
| 1901 // JUnitTestCase.assertEquals(options.enableAsync, copy.enableAsync); | |
| 1902 // JUnitTestCase.assertEquals(options.enableDeferredLoading, copy.enableDe
ferredLoading); | |
| 1903 // JUnitTestCase.assertEquals(options.enableEnum, copy.enableEnum); | |
| 1904 // JUnitTestCase.assertEquals(options.generateSdkErrors, copy.generateSdkE
rrors); | |
| 1905 // JUnitTestCase.assertEquals(options.hint, copy.hint); | |
| 1906 // JUnitTestCase.assertEquals(options.incremental, copy.incremental); | |
| 1907 // JUnitTestCase.assertEquals(options.preserveComments, copy.preserveComme
nts); | |
| 1908 // } | |
| 1909 // } | |
| 1910 // void test_getAnalyzeAngular() { | |
| 1911 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1912 // bool value = !options.analyzeAngular; | |
| 1913 // options.analyzeAngular = value; | |
| 1914 // JUnitTestCase.assertEquals(value, options.analyzeAngular); | |
| 1915 // } | |
| 1916 // void test_getAnalyzeFunctionBodies() { | |
| 1917 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1918 // bool value = !options.analyzeFunctionBodies; | |
| 1919 // options.analyzeFunctionBodies = value; | |
| 1920 // JUnitTestCase.assertEquals(value, options.analyzeFunctionBodies); | |
| 1921 // } | |
| 1922 // void test_getAnalyzePolymer() { | |
| 1923 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1924 // bool value = !options.analyzePolymer; | |
| 1925 // options.analyzePolymer = value; | |
| 1926 // JUnitTestCase.assertEquals(value, options.analyzePolymer); | |
| 1927 // } | |
| 1928 // void test_getCacheSize() { | |
| 1929 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1930 // JUnitTestCase.assertEquals(AnalysisOptionsImpl.DEFAULT_CACHE_SIZE, option
s.cacheSize); | |
| 1931 // int value = options.cacheSize + 1; | |
| 1932 // options.cacheSize = value; | |
| 1933 // JUnitTestCase.assertEquals(value, options.cacheSize); | |
| 1934 // } | |
| 1935 // void test_getDart2jsHint() { | |
| 1936 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1937 // bool value = !options.dart2jsHint; | |
| 1938 // options.dart2jsHint = value; | |
| 1939 // JUnitTestCase.assertEquals(value, options.dart2jsHint); | |
| 1940 // } | |
| 1941 // void test_getEnableAsync() { | |
| 1942 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1943 // JUnitTestCase.assertEquals(AnalysisOptionsImpl.DEFAULT_ENABLE_ASYNC, opti
ons.enableAsync); | |
| 1944 // bool value = !options.enableAsync; | |
| 1945 // options.enableAsync = value; | |
| 1946 // JUnitTestCase.assertEquals(value, options.enableAsync); | |
| 1947 // } | |
| 1948 // void test_getEnableDeferredLoading() { | |
| 1949 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1950 // JUnitTestCase.assertEquals(AnalysisOptionsImpl.DEFAULT_ENABLE_DEFERRED_LO
ADING, options.enableDeferredLoading); | |
| 1951 // bool value = !options.enableDeferredLoading; | |
| 1952 // options.enableDeferredLoading = value; | |
| 1953 // JUnitTestCase.assertEquals(value, options.enableDeferredLoading); | |
| 1954 // } | |
| 1955 // void test_getEnableEnum() { | |
| 1956 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1957 // JUnitTestCase.assertEquals(AnalysisOptionsImpl.DEFAULT_ENABLE_ENUM, optio
ns.enableEnum); | |
| 1958 // bool value = !options.enableEnum; | |
| 1959 // options.enableEnum = value; | |
| 1960 // JUnitTestCase.assertEquals(value, options.enableEnum); | |
| 1961 // } | |
| 1962 // void test_getGenerateSdkErrors() { | |
| 1963 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1964 // bool value = !options.generateSdkErrors; | |
| 1965 // options.generateSdkErrors = value; | |
| 1966 // JUnitTestCase.assertEquals(value, options.generateSdkErrors); | |
| 1967 // } | |
| 1968 // void test_getHint() { | |
| 1969 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1970 // bool value = !options.hint; | |
| 1971 // options.hint = value; | |
| 1972 // JUnitTestCase.assertEquals(value, options.hint); | |
| 1973 // } | |
| 1974 // void test_getIncremental() { | |
| 1975 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1976 // bool value = !options.incremental; | |
| 1977 // options.incremental = value; | |
| 1978 // JUnitTestCase.assertEquals(value, options.incremental); | |
| 1979 // } | |
| 1980 // void test_getPreserveComments() { | |
| 1981 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
| 1982 // bool value = !options.preserveComments; | |
| 1983 // options.preserveComments = value; | |
| 1984 // JUnitTestCase.assertEquals(value, options.preserveComments); | |
| 1985 // } | |
| 1986 // static dartSuite() { | |
| 1987 // _ut.group('AnalysisOptionsImplTest', () { | |
| 1988 // _ut.test('test_AnalysisOptionsImpl_copy', () { | |
| 1989 // final __test = new AnalysisOptionsImplTest(); | |
| 1990 // runJUnitTest(__test, __test.test_AnalysisOptionsImpl_copy); | |
| 1991 // }); | |
| 1992 // _ut.test('test_getAnalyzeAngular', () { | |
| 1993 // final __test = new AnalysisOptionsImplTest(); | |
| 1994 // runJUnitTest(__test, __test.test_getAnalyzeAngular); | |
| 1995 // }); | |
| 1996 // _ut.test('test_getAnalyzeFunctionBodies', () { | |
| 1997 // final __test = new AnalysisOptionsImplTest(); | |
| 1998 // runJUnitTest(__test, __test.test_getAnalyzeFunctionBodies); | |
| 1999 // }); | |
| 2000 // _ut.test('test_getAnalyzePolymer', () { | |
| 2001 // final __test = new AnalysisOptionsImplTest(); | |
| 2002 // runJUnitTest(__test, __test.test_getAnalyzePolymer); | |
| 2003 // }); | |
| 2004 // _ut.test('test_getCacheSize', () { | |
| 2005 // final __test = new AnalysisOptionsImplTest(); | |
| 2006 // runJUnitTest(__test, __test.test_getCacheSize); | |
| 2007 // }); | |
| 2008 // _ut.test('test_getDart2jsHint', () { | |
| 2009 // final __test = new AnalysisOptionsImplTest(); | |
| 2010 // runJUnitTest(__test, __test.test_getDart2jsHint); | |
| 2011 // }); | |
| 2012 // _ut.test('test_getEnableAsync', () { | |
| 2013 // final __test = new AnalysisOptionsImplTest(); | |
| 2014 // runJUnitTest(__test, __test.test_getEnableAsync); | |
| 2015 // }); | |
| 2016 // _ut.test('test_getEnableDeferredLoading', () { | |
| 2017 // final __test = new AnalysisOptionsImplTest(); | |
| 2018 // runJUnitTest(__test, __test.test_getEnableDeferredLoading); | |
| 2019 // }); | |
| 2020 // _ut.test('test_getEnableEnum', () { | |
| 2021 // final __test = new AnalysisOptionsImplTest(); | |
| 2022 // runJUnitTest(__test, __test.test_getEnableEnum); | |
| 2023 // }); | |
| 2024 // _ut.test('test_getGenerateSdkErrors', () { | |
| 2025 // final __test = new AnalysisOptionsImplTest(); | |
| 2026 // runJUnitTest(__test, __test.test_getGenerateSdkErrors); | |
| 2027 // }); | |
| 2028 // _ut.test('test_getHint', () { | |
| 2029 // final __test = new AnalysisOptionsImplTest(); | |
| 2030 // runJUnitTest(__test, __test.test_getHint); | |
| 2031 // }); | |
| 2032 // _ut.test('test_getIncremental', () { | |
| 2033 // final __test = new AnalysisOptionsImplTest(); | |
| 2034 // runJUnitTest(__test, __test.test_getIncremental); | |
| 2035 // }); | |
| 2036 // _ut.test('test_getPreserveComments', () { | |
| 2037 // final __test = new AnalysisOptionsImplTest(); | |
| 2038 // runJUnitTest(__test, __test.test_getPreserveComments); | |
| 2039 // }); | |
| 2040 // }); | |
| 2041 // } | |
| 2042 // } | |
| 2043 // class AnalysisTaskTest extends EngineTestCase { | |
| 2044 // void test_perform_exception() { | |
| 2045 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 2046 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 2047 // AnalysisTask task = new AnalysisTask_AnalysisTaskTest_test_perform_except
ion(context); | |
| 2048 // task.perform(new TestTaskVisitor<Object>()); | |
| 2049 // } | |
| 2050 // static dartSuite() { | |
| 2051 // _ut.group('AnalysisTaskTest', () { | |
| 2052 // _ut.test('test_perform_exception', () { | |
| 2053 // final __test = new AnalysisTaskTest(); | |
| 2054 // runJUnitTest(__test, __test.test_perform_exception); | |
| 2055 // }); | |
| 2056 // }); | |
| 2057 // } | |
| 2058 // } | |
| 2059 // class AnalysisTask_AnalysisTaskTest_test_perform_exception extends AnalysisTa
sk { | |
| 2060 // AnalysisTask_AnalysisTaskTest_test_perform_exception(InternalAnalysisContex
t arg0) : super(arg0); | |
| 2061 // @override | |
| 2062 // accept(AnalysisTaskVisitor visitor) { | |
| 2063 // JUnitTestCase.assertNotNull(exception); | |
| 2064 // return null; | |
| 2065 // } | |
| 2066 // @override | |
| 2067 // String get taskDescription => null; | |
| 2068 // @override | |
| 2069 // void internalPerform() { | |
| 2070 // throw new AnalysisException("Forced exception"); | |
| 2071 // } | |
| 2072 // } | |
| 2073 // class CacheRetentionPolicy_AnalysisCacheTest_test_setMaxCacheSize implements
CacheRetentionPolicy { | |
| 2074 // @override | |
| 2075 // RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
RetentionPriority.LOW; | |
| 2076 // } | |
| 2077 // class CacheRetentionPolicy_UniversalCachePartitionTest_test_setMaxCacheSize i
mplements CacheRetentionPolicy { | |
| 2078 // @override | |
| 2079 // RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
RetentionPriority.LOW; | |
| 2080 // } | |
| 2081 // class DartEntryImplTest extends EngineTestCase { | |
| 2082 // void test_creation() { | |
| 2083 // Source librarySource = new TestSource(); | |
| 2084 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2085 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.C
ONTENT)); | |
| 2086 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELE
MENT)); | |
| 2087 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXP
ORTED_LIBRARIES)); | |
| 2088 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMP
ORTED_LIBRARIES)); | |
| 2089 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INC
LUDED_PARTS)); | |
| 2090 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
CLIENT)); | |
| 2091 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
LAUNCHABLE)); | |
| 2092 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.L
INE_INFO)); | |
| 2093 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SE_ERRORS)); | |
| 2094 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SED_UNIT)); | |
| 2095 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUB
LIC_NAMESPACE)); | |
| 2096 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCA
N_ERRORS)); | |
| 2097 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOU
RCE_KIND)); | |
| 2098 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOK
EN_STREAM)); | |
| 2099 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.HINTS, librarySource)); | |
| 2100 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.RESOLUTION_ERRORS, librarySource)); | |
| 2101 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.RESOLVED_UNIT, librarySource)); | |
| 2102 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.VERIFICATION_ERRORS, librarySource)); | |
| 2103 // } | |
| 2104 // void test_getAllErrors() { | |
| 2105 // Source source = new TestSource(); | |
| 2106 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2107 // EngineTestCase.assertLength(0, entry.allErrors); | |
| 2108 // entry.setValue(DartEntry.SCAN_ERRORS, <AnalysisError> [new AnalysisError.
con1(source, ScannerErrorCode.UNTERMINATED_STRING_LITERAL, [])]); | |
| 2109 // entry.setValue(DartEntry.PARSE_ERRORS, <AnalysisError> [new AnalysisError
.con1(source, ParserErrorCode.ABSTRACT_CLASS_MEMBER, [])]); | |
| 2110 // entry.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, source, <AnalysisErr
or> [new AnalysisError.con1(source, CompileTimeErrorCode.CONST_CONSTRUCTOR_THROW
S_EXCEPTION, [])]); | |
| 2111 // entry.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, source, <AnalysisE
rror> [new AnalysisError.con1(source, StaticWarningCode.CASE_BLOCK_NOT_TERMINATE
D, [])]); | |
| 2112 // entry.setValueInLibrary(DartEntry.HINTS, source, <AnalysisError> [new Ana
lysisError.con1(source, HintCode.DEAD_CODE, [])]); | |
| 2113 // EngineTestCase.assertLength(5, entry.allErrors); | |
| 2114 // } | |
| 2115 // void test_getResolvableCompilationUnit_none() { | |
| 2116 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2117 // JUnitTestCase.assertNull(entry.resolvableCompilationUnit); | |
| 2118 // } | |
| 2119 // void test_getResolvableCompilationUnit_parsed_accessed() { | |
| 2120 // String importUri = "f1.dart"; | |
| 2121 // Source importSource = new TestSource.con1(FileUtilities2.createFile(impor
tUri), ""); | |
| 2122 // ImportDirective importDirective = AstFactory.importDirective3(importUri,
null, []); | |
| 2123 // importDirective.source = importSource; | |
| 2124 // importDirective.uriContent = importUri; | |
| 2125 // String exportUri = "f2.dart"; | |
| 2126 // Source exportSource = new TestSource.con1(FileUtilities2.createFile(expor
tUri), ""); | |
| 2127 // ExportDirective exportDirective = AstFactory.exportDirective2(exportUri,
[]); | |
| 2128 // exportDirective.source = exportSource; | |
| 2129 // exportDirective.uriContent = exportUri; | |
| 2130 // String partUri = "f3.dart"; | |
| 2131 // Source partSource = new TestSource.con1(FileUtilities2.createFile(partUri
), ""); | |
| 2132 // PartDirective partDirective = AstFactory.partDirective2(partUri); | |
| 2133 // partDirective.source = partSource; | |
| 2134 // partDirective.uriContent = partUri; | |
| 2135 // CompilationUnit unit = AstFactory.compilationUnit3([importDirective, expo
rtDirective, partDirective]); | |
| 2136 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2137 // entry.setValue(DartEntry.PARSED_UNIT, unit); | |
| 2138 // entry.getValue(DartEntry.PARSED_UNIT); | |
| 2139 // CompilationUnit result = entry.resolvableCompilationUnit; | |
| 2140 // JUnitTestCase.assertNotSame(unit, result); | |
| 2141 // NodeList<Directive> directives = result.directives; | |
| 2142 // ImportDirective resultImportDirective = directives[0] as ImportDirective; | |
| 2143 // JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); | |
| 2144 // JUnitTestCase.assertSame(importSource, resultImportDirective.source); | |
| 2145 // ExportDirective resultExportDirective = directives[1] as ExportDirective; | |
| 2146 // JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); | |
| 2147 // JUnitTestCase.assertSame(exportSource, resultExportDirective.source); | |
| 2148 // PartDirective resultPartDirective = directives[2] as PartDirective; | |
| 2149 // JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); | |
| 2150 // JUnitTestCase.assertSame(partSource, resultPartDirective.source); | |
| 2151 // } | |
| 2152 // void test_getResolvableCompilationUnit_parsed_notAccessed() { | |
| 2153 // CompilationUnit unit = AstFactory.compilationUnit(); | |
| 2154 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2155 // entry.setValue(DartEntry.PARSED_UNIT, unit); | |
| 2156 // JUnitTestCase.assertSame(unit, entry.resolvableCompilationUnit); | |
| 2157 // } | |
| 2158 // void test_getResolvableCompilationUnit_resolved() { | |
| 2159 // String importUri = "f1.dart"; | |
| 2160 // Source importSource = new TestSource.con1(FileUtilities2.createFile(impor
tUri), ""); | |
| 2161 // ImportDirective importDirective = AstFactory.importDirective3(importUri,
null, []); | |
| 2162 // importDirective.source = importSource; | |
| 2163 // importDirective.uriContent = importUri; | |
| 2164 // String exportUri = "f2.dart"; | |
| 2165 // Source exportSource = new TestSource.con1(FileUtilities2.createFile(expor
tUri), ""); | |
| 2166 // ExportDirective exportDirective = AstFactory.exportDirective2(exportUri,
[]); | |
| 2167 // exportDirective.source = exportSource; | |
| 2168 // exportDirective.uriContent = exportUri; | |
| 2169 // String partUri = "f3.dart"; | |
| 2170 // Source partSource = new TestSource.con1(FileUtilities2.createFile(partUri
), ""); | |
| 2171 // PartDirective partDirective = AstFactory.partDirective2(partUri); | |
| 2172 // partDirective.source = partSource; | |
| 2173 // partDirective.uriContent = partUri; | |
| 2174 // CompilationUnit unit = AstFactory.compilationUnit3([importDirective, expo
rtDirective, partDirective]); | |
| 2175 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2176 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, new TestSource.con1(File
Utilities2.createFile("lib.dart"), ""), unit); | |
| 2177 // CompilationUnit result = entry.resolvableCompilationUnit; | |
| 2178 // JUnitTestCase.assertNotSame(unit, result); | |
| 2179 // NodeList<Directive> directives = result.directives; | |
| 2180 // ImportDirective resultImportDirective = directives[0] as ImportDirective; | |
| 2181 // JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); | |
| 2182 // JUnitTestCase.assertSame(importSource, resultImportDirective.source); | |
| 2183 // ExportDirective resultExportDirective = directives[1] as ExportDirective; | |
| 2184 // JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); | |
| 2185 // JUnitTestCase.assertSame(exportSource, resultExportDirective.source); | |
| 2186 // PartDirective resultPartDirective = directives[2] as PartDirective; | |
| 2187 // JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); | |
| 2188 // JUnitTestCase.assertSame(partSource, resultPartDirective.source); | |
| 2189 // } | |
| 2190 // void test_getState_invalid_resolutionErrors() { | |
| 2191 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2192 // try { | |
| 2193 // entry.getState(DartEntry.RESOLUTION_ERRORS); | |
| 2194 // JUnitTestCase.fail("Expected IllegalArgumentException for RESOLUTION_ER
RORS"); | |
| 2195 // } on IllegalArgumentException catch (exception) { | |
| 2196 // } | |
| 2197 // } | |
| 2198 // void test_getState_invalid_verificationErrors() { | |
| 2199 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2200 // try { | |
| 2201 // entry.getState(DartEntry.VERIFICATION_ERRORS); | |
| 2202 // JUnitTestCase.fail("Expected IllegalArgumentException for VERIFICATION_
ERRORS"); | |
| 2203 // } on IllegalArgumentException catch (exception) { | |
| 2204 // } | |
| 2205 // } | |
| 2206 // void test_getStateInLibrary_invalid_element() { | |
| 2207 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2208 // try { | |
| 2209 // entry.getStateInLibrary(DartEntry.ELEMENT, new TestSource()); | |
| 2210 // JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); | |
| 2211 // } on IllegalArgumentException catch (exception) { | |
| 2212 // } | |
| 2213 // } | |
| 2214 // void test_getValue_containingLibraries() { | |
| 2215 // Source testSource = new TestSource(); | |
| 2216 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2217 // List<Source> value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); | |
| 2218 // EngineTestCase.assertLength(0, value); | |
| 2219 // entry.addContainingLibrary(testSource); | |
| 2220 // value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); | |
| 2221 // EngineTestCase.assertLength(1, value); | |
| 2222 // JUnitTestCase.assertEquals(testSource, value[0]); | |
| 2223 // entry.removeContainingLibrary(testSource); | |
| 2224 // value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); | |
| 2225 // EngineTestCase.assertLength(0, value); | |
| 2226 // } | |
| 2227 // void test_getValue_invalid_resolutionErrors() { | |
| 2228 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2229 // try { | |
| 2230 // entry.getValue(DartEntry.RESOLUTION_ERRORS); | |
| 2231 // JUnitTestCase.fail("Expected IllegalArgumentException for RESOLUTION_ER
RORS"); | |
| 2232 // } on IllegalArgumentException catch (exception) { | |
| 2233 // } | |
| 2234 // } | |
| 2235 // void test_getValue_invalid_verificationErrors() { | |
| 2236 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2237 // try { | |
| 2238 // entry.getValue(DartEntry.VERIFICATION_ERRORS); | |
| 2239 // JUnitTestCase.fail("Expected IllegalArgumentException for VERIFICATION_
ERRORS"); | |
| 2240 // } on IllegalArgumentException catch (exception) { | |
| 2241 // } | |
| 2242 // } | |
| 2243 // void test_getValueInLibrary_invalid_element() { | |
| 2244 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2245 // try { | |
| 2246 // entry.getValueInLibrary(DartEntry.ELEMENT, new TestSource()); | |
| 2247 // JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); | |
| 2248 // } on IllegalArgumentException catch (exception) { | |
| 2249 // } | |
| 2250 // } | |
| 2251 // void test_getValueInLibrary_invalid_resolutionErrors_multiple() { | |
| 2252 // Source source1 = new TestSource(); | |
| 2253 // Source source2 = new TestSource(); | |
| 2254 // Source source3 = new TestSource(); | |
| 2255 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2256 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.comp
ilationUnit()); | |
| 2257 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source2, AstFactory.comp
ilationUnit()); | |
| 2258 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source3, AstFactory.comp
ilationUnit()); | |
| 2259 // try { | |
| 2260 // entry.getValueInLibrary(DartEntry.ELEMENT, source3); | |
| 2261 // JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); | |
| 2262 // } on IllegalArgumentException catch (exception) { | |
| 2263 // } | |
| 2264 // } | |
| 2265 // void test_getWritableCopy() { | |
| 2266 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2267 // DartEntryImpl copy = entry.writableCopy; | |
| 2268 // JUnitTestCase.assertNotNull(copy); | |
| 2269 // JUnitTestCase.assertNotSame(entry, copy); | |
| 2270 // } | |
| 2271 // void test_hasInvalidData_false() { | |
| 2272 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2273 // entry.recordScanError(new CaughtException(new AnalysisException(), null))
; | |
| 2274 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.ELEMENT)); | |
| 2275 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.EXPORTED_LIBRARI
ES)); | |
| 2276 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.HINTS)); | |
| 2277 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IMPORTED_LIBRARI
ES)); | |
| 2278 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.INCLUDED_PARTS))
; | |
| 2279 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IS_CLIENT)); | |
| 2280 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IS_LAUNCHABLE)); | |
| 2281 // JUnitTestCase.assertFalse(entry.hasInvalidData(SourceEntry.LINE_INFO)); | |
| 2282 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PARSE_ERRORS)); | |
| 2283 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PARSED_UNIT)); | |
| 2284 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PUBLIC_NAMESPACE
)); | |
| 2285 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.SOURCE_KIND)); | |
| 2286 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.RESOLUTION_ERROR
S)); | |
| 2287 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.RESOLVED_UNIT)); | |
| 2288 // JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.VERIFICATION_ERR
ORS)); | |
| 2289 // } | |
| 2290 // void test_hasInvalidData_true() { | |
| 2291 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2292 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.ELEMENT)); | |
| 2293 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIE
S)); | |
| 2294 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.HINTS)); | |
| 2295 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IMPORTED_LIBRARIE
S)); | |
| 2296 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.INCLUDED_PARTS)); | |
| 2297 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IS_CLIENT)); | |
| 2298 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IS_LAUNCHABLE)); | |
| 2299 // JUnitTestCase.assertTrue(entry.hasInvalidData(SourceEntry.LINE_INFO)); | |
| 2300 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PARSE_ERRORS)); | |
| 2301 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PARSED_UNIT)); | |
| 2302 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PUBLIC_NAMESPACE)
); | |
| 2303 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.SOURCE_KIND)); | |
| 2304 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.RESOLUTION_ERRORS
)); | |
| 2305 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.RESOLVED_UNIT)); | |
| 2306 // JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.VERIFICATION_ERRO
RS)); | |
| 2307 // } | |
| 2308 // void test_invalidateAllInformation() { | |
| 2309 // DartEntryImpl entry = _entryWithValidState(); | |
| 2310 // entry.invalidateAllInformation(); | |
| 2311 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELE
MENT)); | |
| 2312 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXP
ORTED_LIBRARIES)); | |
| 2313 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMP
ORTED_LIBRARIES)); | |
| 2314 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INC
LUDED_PARTS)); | |
| 2315 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
CLIENT)); | |
| 2316 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
LAUNCHABLE)); | |
| 2317 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.L
INE_INFO)); | |
| 2318 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SE_ERRORS)); | |
| 2319 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SED_UNIT)); | |
| 2320 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUB
LIC_NAMESPACE)); | |
| 2321 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCA
N_ERRORS)); | |
| 2322 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOK
EN_STREAM)); | |
| 2323 // } | |
| 2324 // void test_invalidateAllResolutionInformation() { | |
| 2325 // DartEntryImpl entry = _entryWithValidState(); | |
| 2326 // entry.invalidateAllResolutionInformation(false); | |
| 2327 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELE
MENT)); | |
| 2328 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
CLIENT)); | |
| 2329 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
LAUNCHABLE)); | |
| 2330 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LIN
E_INFO)); | |
| 2331 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE
_ERRORS)); | |
| 2332 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE
D_UNIT)); | |
| 2333 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUB
LIC_NAMESPACE)); | |
| 2334 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.EXPOR
TED_LIBRARIES)); | |
| 2335 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IMPOR
TED_LIBRARIES)); | |
| 2336 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.INCLU
DED_PARTS)); | |
| 2337 // } | |
| 2338 // void test_invalidateAllResolutionInformation_includingUris() { | |
| 2339 // DartEntryImpl entry = _entryWithValidState(); | |
| 2340 // entry.invalidateAllResolutionInformation(true); | |
| 2341 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELE
MENT)); | |
| 2342 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
CLIENT)); | |
| 2343 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
LAUNCHABLE)); | |
| 2344 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LIN
E_INFO)); | |
| 2345 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE
_ERRORS)); | |
| 2346 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE
D_UNIT)); | |
| 2347 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUB
LIC_NAMESPACE)); | |
| 2348 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXP
ORTED_LIBRARIES)); | |
| 2349 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMP
ORTED_LIBRARIES)); | |
| 2350 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INC
LUDED_PARTS)); | |
| 2351 // } | |
| 2352 // void test_isClient() { | |
| 2353 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2354 // // true | |
| 2355 // entry.setValue(DartEntry.IS_CLIENT, true); | |
| 2356 // JUnitTestCase.assertTrue(entry.getValue(DartEntry.IS_CLIENT)); | |
| 2357 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2358 // // invalidate | |
| 2359 // entry.setState(DartEntry.IS_CLIENT, CacheState.INVALID); | |
| 2360 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
CLIENT)); | |
| 2361 // // false | |
| 2362 // entry.setValue(DartEntry.IS_CLIENT, false); | |
| 2363 // JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_CLIENT)); | |
| 2364 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2365 // } | |
| 2366 // void test_isLaunchable() { | |
| 2367 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2368 // // true | |
| 2369 // entry.setValue(DartEntry.IS_LAUNCHABLE, true); | |
| 2370 // JUnitTestCase.assertTrue(entry.getValue(DartEntry.IS_LAUNCHABLE)); | |
| 2371 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2372 // // invalidate | |
| 2373 // entry.setState(DartEntry.IS_LAUNCHABLE, CacheState.INVALID); | |
| 2374 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
LAUNCHABLE)); | |
| 2375 // // false | |
| 2376 // entry.setValue(DartEntry.IS_LAUNCHABLE, false); | |
| 2377 // JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_LAUNCHABLE)); | |
| 2378 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2379 // } | |
| 2380 // void test_recordBuildElementErrorInLibrary() { | |
| 2381 // // TODO(brianwilkerson) This test should set the state for two libraries,
record an error in one | |
| 2382 // // library, then verify that the data for the other library is still vali
d. | |
| 2383 // Source source = new TestSource(); | |
| 2384 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2385 // entry.recordBuildElementErrorInLibrary(source, new CaughtException(new An
alysisException(), null)); | |
| 2386 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.C
ONTENT)); | |
| 2387 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEME
NT)); | |
| 2388 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXP
ORTED_LIBRARIES)); | |
| 2389 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMP
ORTED_LIBRARIES)); | |
| 2390 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INC
LUDED_PARTS)); | |
| 2391 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2392 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2393 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.L
INE_INFO)); | |
| 2394 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SE_ERRORS)); | |
| 2395 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SED_UNIT)); | |
| 2396 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUB
LIC_NAMESPACE)); | |
| 2397 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCA
N_ERRORS)); | |
| 2398 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOU
RCE_KIND)); | |
| 2399 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOK
EN_STREAM)); | |
| 2400 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.HINTS, source)); | |
| 2401 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.RESOLUTION_ERRORS, source)); | |
| 2402 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.RESOLVED_UNIT, source)); | |
| 2403 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.VERIFICATION_ERRORS, source)); | |
| 2404 // } | |
| 2405 // void test_recordContentError() { | |
| 2406 // // Source source = new TestSource(); | |
| 2407 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2408 // entry.recordContentError(new CaughtException(new AnalysisException(), nul
l)); | |
| 2409 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(SourceEntry.CON
TENT)); | |
| 2410 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEME
NT)); | |
| 2411 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.EXPOR
TED_LIBRARIES)); | |
| 2412 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IMPOR
TED_LIBRARIES)); | |
| 2413 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.INCLU
DED_PARTS)); | |
| 2414 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2415 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2416 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(SourceEntry.LIN
E_INFO)); | |
| 2417 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE
_ERRORS)); | |
| 2418 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE
D_UNIT)); | |
| 2419 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLI
C_NAMESPACE)); | |
| 2420 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SCAN_
ERRORS)); | |
| 2421 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SOURC
E_KIND)); | |
| 2422 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.TOKEN
_STREAM)); | |
| 2423 // } | |
| 2424 // void test_recordHintErrorInLibrary() { | |
| 2425 // // TODO(brianwilkerson) This test should set the state for two libraries,
record an error in one | |
| 2426 // // library, then verify that the data for the other library is still vali
d. | |
| 2427 // Source source = new TestSource(); | |
| 2428 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2429 // entry.recordHintErrorInLibrary(source, new CaughtException(new AnalysisEx
ception(), null)); | |
| 2430 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.C
ONTENT)); | |
| 2431 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELE
MENT)); | |
| 2432 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXP
ORTED_LIBRARIES)); | |
| 2433 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMP
ORTED_LIBRARIES)); | |
| 2434 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INC
LUDED_PARTS)); | |
| 2435 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
CLIENT)); | |
| 2436 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
LAUNCHABLE)); | |
| 2437 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.L
INE_INFO)); | |
| 2438 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SE_ERRORS)); | |
| 2439 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SED_UNIT)); | |
| 2440 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUB
LIC_NAMESPACE)); | |
| 2441 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCA
N_ERRORS)); | |
| 2442 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOU
RCE_KIND)); | |
| 2443 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOK
EN_STREAM)); | |
| 2444 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.HINTS, source)); | |
| 2445 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.RESOLUTION_ERRORS, source)); | |
| 2446 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.RESOLVED_UNIT, source)); | |
| 2447 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.VERIFICATION_ERRORS, source)); | |
| 2448 // } | |
| 2449 // void test_recordParseError() { | |
| 2450 // // Source source = new TestSource(); | |
| 2451 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2452 // entry.recordParseError(new CaughtException(new AnalysisException(), null)
); | |
| 2453 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.C
ONTENT)); | |
| 2454 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEME
NT)); | |
| 2455 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.EXPOR
TED_LIBRARIES)); | |
| 2456 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IMPOR
TED_LIBRARIES)); | |
| 2457 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.INCLU
DED_PARTS)); | |
| 2458 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2459 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2460 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.L
INE_INFO)); | |
| 2461 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE
_ERRORS)); | |
| 2462 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE
D_UNIT)); | |
| 2463 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLI
C_NAMESPACE)); | |
| 2464 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCA
N_ERRORS)); | |
| 2465 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SOURC
E_KIND)); | |
| 2466 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOK
EN_STREAM)); | |
| 2467 // } | |
| 2468 // void test_recordParseInProcess() { | |
| 2469 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2470 // entry.recordParseInProcess(); | |
| 2471 // JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.
PARSE_ERRORS)); | |
| 2472 // JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.
PARSED_UNIT)); | |
| 2473 // JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.
SOURCE_KIND)); | |
| 2474 // } | |
| 2475 // void test_recordResolutionError() { | |
| 2476 // // Source source = new TestSource(); | |
| 2477 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2478 // entry.recordResolutionError(new CaughtException(new AnalysisException(),
null)); | |
| 2479 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.C
ONTENT)); | |
| 2480 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEME
NT)); | |
| 2481 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXP
ORTED_LIBRARIES)); | |
| 2482 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMP
ORTED_LIBRARIES)); | |
| 2483 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INC
LUDED_PARTS)); | |
| 2484 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2485 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2486 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.L
INE_INFO)); | |
| 2487 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SE_ERRORS)); | |
| 2488 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SED_UNIT)); | |
| 2489 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLI
C_NAMESPACE)); | |
| 2490 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCA
N_ERRORS)); | |
| 2491 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOU
RCE_KIND)); | |
| 2492 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOK
EN_STREAM)); | |
| 2493 // } | |
| 2494 // void test_recordResolutionErrorInLibrary() { | |
| 2495 // // TODO(brianwilkerson) This test should set the state for two libraries,
record an error in one | |
| 2496 // // library, then verify that the data for the other library is still vali
d. | |
| 2497 // Source source = new TestSource(); | |
| 2498 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2499 // entry.recordResolutionErrorInLibrary(source, new CaughtException(new Anal
ysisException(), null)); | |
| 2500 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.C
ONTENT)); | |
| 2501 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEME
NT)); | |
| 2502 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXP
ORTED_LIBRARIES)); | |
| 2503 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMP
ORTED_LIBRARIES)); | |
| 2504 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INC
LUDED_PARTS)); | |
| 2505 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2506 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2507 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.L
INE_INFO)); | |
| 2508 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SE_ERRORS)); | |
| 2509 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SED_UNIT)); | |
| 2510 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLI
C_NAMESPACE)); | |
| 2511 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCA
N_ERRORS)); | |
| 2512 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOU
RCE_KIND)); | |
| 2513 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOK
EN_STREAM)); | |
| 2514 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.HINTS, source)); | |
| 2515 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.RESOLUTION_ERRORS, source)); | |
| 2516 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.RESOLVED_UNIT, source)); | |
| 2517 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.VERIFICATION_ERRORS, source)); | |
| 2518 // } | |
| 2519 // void test_recordScanError() { | |
| 2520 // // Source source = new TestSource(); | |
| 2521 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2522 // entry.recordScanError(new CaughtException(new AnalysisException(), null))
; | |
| 2523 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.C
ONTENT)); | |
| 2524 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEME
NT)); | |
| 2525 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.EXPOR
TED_LIBRARIES)); | |
| 2526 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IMPOR
TED_LIBRARIES)); | |
| 2527 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.INCLU
DED_PARTS)); | |
| 2528 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2529 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2530 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(SourceEntry.LIN
E_INFO)); | |
| 2531 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE
_ERRORS)); | |
| 2532 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE
D_UNIT)); | |
| 2533 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLI
C_NAMESPACE)); | |
| 2534 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SCAN_
ERRORS)); | |
| 2535 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SOURC
E_KIND)); | |
| 2536 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.TOKEN
_STREAM)); | |
| 2537 // } | |
| 2538 // void test_recordScanInProcess() { | |
| 2539 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2540 // entry.recordScanInProcess(); | |
| 2541 // JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(SourceEntr
y.LINE_INFO)); | |
| 2542 // JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.
SCAN_ERRORS)); | |
| 2543 // JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.
TOKEN_STREAM)); | |
| 2544 // } | |
| 2545 // void test_recordVerificationErrorInLibrary() { | |
| 2546 // // TODO(brianwilkerson) This test should set the state for two libraries,
record an error in one | |
| 2547 // // library, then verify that the data for the other library is still vali
d. | |
| 2548 // Source source = new TestSource(); | |
| 2549 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2550 // entry.recordVerificationErrorInLibrary(source, new CaughtException(new An
alysisException(), null)); | |
| 2551 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.C
ONTENT)); | |
| 2552 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELE
MENT)); | |
| 2553 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXP
ORTED_LIBRARIES)); | |
| 2554 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMP
ORTED_LIBRARIES)); | |
| 2555 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INC
LUDED_PARTS)); | |
| 2556 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
CLIENT)); | |
| 2557 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_
LAUNCHABLE)); | |
| 2558 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.L
INE_INFO)); | |
| 2559 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SE_ERRORS)); | |
| 2560 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PAR
SED_UNIT)); | |
| 2561 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUB
LIC_NAMESPACE)); | |
| 2562 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCA
N_ERRORS)); | |
| 2563 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOU
RCE_KIND)); | |
| 2564 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOK
EN_STREAM)); | |
| 2565 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.HINTS, source)); | |
| 2566 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.RESOLUTION_ERRORS, source)); | |
| 2567 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(Dart
Entry.RESOLVED_UNIT, source)); | |
| 2568 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEn
try.VERIFICATION_ERRORS, source)); | |
| 2569 // } | |
| 2570 // void test_removeResolution_multiple_first() { | |
| 2571 // Source source1 = new TestSource(); | |
| 2572 // Source source2 = new TestSource(); | |
| 2573 // Source source3 = new TestSource(); | |
| 2574 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2575 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.comp
ilationUnit()); | |
| 2576 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source2, AstFactory.comp
ilationUnit()); | |
| 2577 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source3, AstFactory.comp
ilationUnit()); | |
| 2578 // entry.removeResolution(source1); | |
| 2579 // } | |
| 2580 // void test_removeResolution_multiple_last() { | |
| 2581 // Source source1 = new TestSource(); | |
| 2582 // Source source2 = new TestSource(); | |
| 2583 // Source source3 = new TestSource(); | |
| 2584 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2585 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.comp
ilationUnit()); | |
| 2586 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source2, AstFactory.comp
ilationUnit()); | |
| 2587 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source3, AstFactory.comp
ilationUnit()); | |
| 2588 // entry.removeResolution(source3); | |
| 2589 // } | |
| 2590 // void test_removeResolution_multiple_middle() { | |
| 2591 // Source source1 = new TestSource(); | |
| 2592 // Source source2 = new TestSource(); | |
| 2593 // Source source3 = new TestSource(); | |
| 2594 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2595 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.comp
ilationUnit()); | |
| 2596 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source2, AstFactory.comp
ilationUnit()); | |
| 2597 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source3, AstFactory.comp
ilationUnit()); | |
| 2598 // entry.removeResolution(source2); | |
| 2599 // } | |
| 2600 // void test_removeResolution_single() { | |
| 2601 // Source source1 = new TestSource(); | |
| 2602 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2603 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.comp
ilationUnit()); | |
| 2604 // entry.removeResolution(source1); | |
| 2605 // } | |
| 2606 // void test_resolutionState() { | |
| 2607 // DartEntryImpl entry1 = new DartEntryImpl(); | |
| 2608 // Source libSrc1 = new TestSource.con1(FileUtilities2.createFile("/test1.da
rt"), ""); | |
| 2609 // Source libSrc2 = new TestSource.con1(FileUtilities2.createFile("/test2.da
rt"), ""); | |
| 2610 // ParserErrorCode errCode = ParserErrorCode.DIRECTIVE_AFTER_DECLARATION; | |
| 2611 // List<AnalysisError> errors1 = <AnalysisError> [new AnalysisError.con2(lib
Src1, 0, 10, errCode, [])]; | |
| 2612 // List<AnalysisError> errors2 = <AnalysisError> [new AnalysisError.con2(lib
Src2, 0, 20, errCode, [])]; | |
| 2613 // entry1.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, libSrc1, errors1); | |
| 2614 // entry1.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, libSrc2, errors2); | |
| 2615 // TestDartEntryImpl entry2 = new TestDartEntryImpl(); | |
| 2616 // entry2.copyFrom(entry1); | |
| 2617 // EngineTestCase.assertExactElementsInArray(entry2.allErrors, [errors1[0],
errors2[0]]); | |
| 2618 // entry1.removeResolution(libSrc2); | |
| 2619 // EngineTestCase.assertExactElementsInArray(entry1.allErrors, [errors1[0]])
; | |
| 2620 // entry2.removeResolution(libSrc1); | |
| 2621 // EngineTestCase.assertExactElementsInArray(entry2.allErrors, [errors2[0]])
; | |
| 2622 // entry2.removeResolution(libSrc2); | |
| 2623 // EngineTestCase.assertExactElementsInArray(entry2.allErrors, []); | |
| 2624 // } | |
| 2625 // void test_setState_element() { | |
| 2626 // state2 = DartEntry.ELEMENT; | |
| 2627 // } | |
| 2628 // void test_setState_exportedLibraries() { | |
| 2629 // state2 = DartEntry.EXPORTED_LIBRARIES; | |
| 2630 // } | |
| 2631 // void test_setState_hints() { | |
| 2632 // state3 = DartEntry.HINTS; | |
| 2633 // } | |
| 2634 // void test_setState_importedLibraries() { | |
| 2635 // state2 = DartEntry.IMPORTED_LIBRARIES; | |
| 2636 // } | |
| 2637 // void test_setState_includedParts() { | |
| 2638 // state2 = DartEntry.INCLUDED_PARTS; | |
| 2639 // } | |
| 2640 // void test_setState_invalid_element() { | |
| 2641 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2642 // try { | |
| 2643 // entry.setStateInLibrary(DartEntry.ELEMENT, null, CacheState.FLUSHED); | |
| 2644 // JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); | |
| 2645 // } on IllegalArgumentException catch (exception) { | |
| 2646 // } | |
| 2647 // } | |
| 2648 // void test_setState_invalid_resolutionErrors() { | |
| 2649 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2650 // try { | |
| 2651 // entry.setState(DartEntry.RESOLUTION_ERRORS, CacheState.FLUSHED); | |
| 2652 // JUnitTestCase.fail("Expected IllegalArgumentException for RESOLUTION_ER
RORS"); | |
| 2653 // } on IllegalArgumentException catch (exception) { | |
| 2654 // } | |
| 2655 // } | |
| 2656 // void test_setState_invalid_validState() { | |
| 2657 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2658 // try { | |
| 2659 // entry.setState(DartEntry.LINE_INFO, CacheState.VALID); | |
| 2660 // JUnitTestCase.fail("Expected IllegalArgumentException for a state of VA
LID"); | |
| 2661 // } on IllegalArgumentException catch (exception) { | |
| 2662 // } | |
| 2663 // } | |
| 2664 // void test_setState_invalid_verificationErrors() { | |
| 2665 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2666 // try { | |
| 2667 // entry.setState(DartEntry.VERIFICATION_ERRORS, CacheState.FLUSHED); | |
| 2668 // JUnitTestCase.fail("Expected IllegalArgumentException for VERIFICATION_
ERRORS"); | |
| 2669 // } on IllegalArgumentException catch (exception) { | |
| 2670 // } | |
| 2671 // } | |
| 2672 // void test_setState_isClient() { | |
| 2673 // state2 = DartEntry.IS_CLIENT; | |
| 2674 // } | |
| 2675 // void test_setState_isLaunchable() { | |
| 2676 // state2 = DartEntry.IS_LAUNCHABLE; | |
| 2677 // } | |
| 2678 // void test_setState_lineInfo() { | |
| 2679 // state2 = SourceEntry.LINE_INFO; | |
| 2680 // } | |
| 2681 // void test_setState_parsedUnit() { | |
| 2682 // state2 = DartEntry.PARSED_UNIT; | |
| 2683 // } | |
| 2684 // void test_setState_parseErrors() { | |
| 2685 // state2 = DartEntry.PARSE_ERRORS; | |
| 2686 // } | |
| 2687 // void test_setState_publicNamespace() { | |
| 2688 // state2 = DartEntry.PUBLIC_NAMESPACE; | |
| 2689 // } | |
| 2690 // void test_setState_resolutionErrors() { | |
| 2691 // state3 = DartEntry.RESOLUTION_ERRORS; | |
| 2692 // } | |
| 2693 // void test_setState_resolvedUnit() { | |
| 2694 // state3 = DartEntry.RESOLVED_UNIT; | |
| 2695 // } | |
| 2696 // void test_setState_scanErrors() { | |
| 2697 // state2 = DartEntry.SCAN_ERRORS; | |
| 2698 // } | |
| 2699 // void test_setState_sourceKind() { | |
| 2700 // state2 = DartEntry.SOURCE_KIND; | |
| 2701 // } | |
| 2702 // void test_setState_tokenStream() { | |
| 2703 // state2 = DartEntry.TOKEN_STREAM; | |
| 2704 // } | |
| 2705 // void test_setState_verificationErrors() { | |
| 2706 // state3 = DartEntry.VERIFICATION_ERRORS; | |
| 2707 // } | |
| 2708 // void test_setValue_element() { | |
| 2709 // _setValue2(DartEntry.ELEMENT, new LibraryElementImpl.forNode(null, AstFac
tory.libraryIdentifier2(["lib"]))); | |
| 2710 // } | |
| 2711 // void test_setValue_exportedLibraries() { | |
| 2712 // _setValue2(DartEntry.EXPORTED_LIBRARIES, <Source> [new TestSource()]); | |
| 2713 // } | |
| 2714 // void test_setValue_hints() { | |
| 2715 // _setValue3(DartEntry.HINTS, <AnalysisError> [new AnalysisError.con1(null,
HintCode.DEAD_CODE, [])]); | |
| 2716 // } | |
| 2717 // void test_setValue_importedLibraries() { | |
| 2718 // _setValue2(DartEntry.IMPORTED_LIBRARIES, <Source> [new TestSource()]); | |
| 2719 // } | |
| 2720 // void test_setValue_includedParts() { | |
| 2721 // _setValue2(DartEntry.INCLUDED_PARTS, <Source> [new TestSource()]); | |
| 2722 // } | |
| 2723 // void test_setValue_isClient() { | |
| 2724 // _setValue2(DartEntry.IS_CLIENT, true); | |
| 2725 // } | |
| 2726 // void test_setValue_isLaunchable() { | |
| 2727 // _setValue2(DartEntry.IS_LAUNCHABLE, true); | |
| 2728 // } | |
| 2729 // void test_setValue_lineInfo() { | |
| 2730 // _setValue2(SourceEntry.LINE_INFO, new LineInfo(<int> [0])); | |
| 2731 // } | |
| 2732 // void test_setValue_parsedUnit() { | |
| 2733 // _setValue2(DartEntry.PARSED_UNIT, AstFactory.compilationUnit()); | |
| 2734 // } | |
| 2735 // void test_setValue_parseErrors() { | |
| 2736 // _setValue2(DartEntry.PARSE_ERRORS, <AnalysisError> [new AnalysisError.con
1(null, ParserErrorCode.ABSTRACT_CLASS_MEMBER, [])]); | |
| 2737 // } | |
| 2738 // void test_setValue_publicNamespace() { | |
| 2739 // _setValue2(DartEntry.PUBLIC_NAMESPACE, new Namespace(new HashMap<String,
Element>())); | |
| 2740 // } | |
| 2741 // void test_setValue_resolutionErrors() { | |
| 2742 // _setValue3(DartEntry.RESOLUTION_ERRORS, <AnalysisError> [new AnalysisErro
r.con1(null, CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION, [])]); | |
| 2743 // } | |
| 2744 // void test_setValue_resolvedUnit() { | |
| 2745 // _setValue3(DartEntry.RESOLVED_UNIT, AstFactory.compilationUnit()); | |
| 2746 // } | |
| 2747 // void test_setValue_scanErrors() { | |
| 2748 // _setValue2(DartEntry.SCAN_ERRORS, <AnalysisError> [new AnalysisError.con1
(null, ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT, [])]); | |
| 2749 // } | |
| 2750 // void test_setValue_sourceKind() { | |
| 2751 // _setValue2(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); | |
| 2752 // } | |
| 2753 // void test_setValue_tokenStream() { | |
| 2754 // _setValue2(DartEntry.TOKEN_STREAM, new Token(TokenType.LT, 5)); | |
| 2755 // } | |
| 2756 // void test_setValue_verificationErrors() { | |
| 2757 // _setValue3(DartEntry.VERIFICATION_ERRORS, <AnalysisError> [new AnalysisEr
ror.con1(null, StaticWarningCode.CASE_BLOCK_NOT_TERMINATED, [])]); | |
| 2758 // } | |
| 2759 // DartEntryImpl _entryWithValidState() { | |
| 2760 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2761 // entry.setValue(DartEntry.ELEMENT, null); | |
| 2762 // entry.setValue(DartEntry.EXPORTED_LIBRARIES, null); | |
| 2763 // entry.setValue(DartEntry.IMPORTED_LIBRARIES, null); | |
| 2764 // entry.setValue(DartEntry.INCLUDED_PARTS, null); | |
| 2765 // entry.setValue(DartEntry.IS_CLIENT, true); | |
| 2766 // entry.setValue(DartEntry.IS_LAUNCHABLE, true); | |
| 2767 // entry.setValue(SourceEntry.LINE_INFO, null); | |
| 2768 // entry.setValue(DartEntry.PARSE_ERRORS, null); | |
| 2769 // entry.setValue(DartEntry.PARSED_UNIT, null); | |
| 2770 // entry.setValue(DartEntry.PUBLIC_NAMESPACE, null); | |
| 2771 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.ELEME
NT)); | |
| 2772 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.EXPOR
TED_LIBRARIES)); | |
| 2773 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IMPOR
TED_LIBRARIES)); | |
| 2774 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.INCLU
DED_PARTS)); | |
| 2775 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_CL
IENT)); | |
| 2776 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_LA
UNCHABLE)); | |
| 2777 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LIN
E_INFO)); | |
| 2778 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE
_ERRORS)); | |
| 2779 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE
D_UNIT)); | |
| 2780 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PUBLI
C_NAMESPACE)); | |
| 2781 // return entry; | |
| 2782 // } | |
| 2783 // void set state2(DataDescriptor descriptor) { | |
| 2784 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2785 // JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getState(descriptor
)); | |
| 2786 // entry.setState(descriptor, CacheState.FLUSHED); | |
| 2787 // JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getState(descriptor)); | |
| 2788 // } | |
| 2789 // void set state3(DataDescriptor descriptor) { | |
| 2790 // Source source = new TestSource(); | |
| 2791 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2792 // JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getStateInLibrary(d
escriptor, source)); | |
| 2793 // entry.setStateInLibrary(descriptor, source, CacheState.FLUSHED); | |
| 2794 // JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getStateInLibrary(desc
riptor, source)); | |
| 2795 // } | |
| 2796 // void _setValue2(DataDescriptor descriptor, Object newValue) { | |
| 2797 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2798 // Object value = entry.getValue(descriptor); | |
| 2799 // JUnitTestCase.assertNotSame(value, newValue); | |
| 2800 // entry.setValue(descriptor, newValue); | |
| 2801 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(descriptor)); | |
| 2802 // JUnitTestCase.assertSame(newValue, entry.getValue(descriptor)); | |
| 2803 // } | |
| 2804 // void _setValue3(DataDescriptor descriptor, Object newValue) { | |
| 2805 // Source source = new TestSource(); | |
| 2806 // DartEntryImpl entry = new DartEntryImpl(); | |
| 2807 // Object value = entry.getValueInLibrary(descriptor, source); | |
| 2808 // JUnitTestCase.assertNotSame(value, newValue); | |
| 2809 // entry.setValueInLibrary(descriptor, source, newValue); | |
| 2810 // JUnitTestCase.assertSame(CacheState.VALID, entry.getStateInLibrary(descri
ptor, source)); | |
| 2811 // JUnitTestCase.assertSame(newValue, entry.getValueInLibrary(descriptor, so
urce)); | |
| 2812 // } | |
| 2813 // static dartSuite() { | |
| 2814 // _ut.group('DartEntryImplTest', () { | |
| 2815 // _ut.test('test_creation', () { | |
| 2816 // final __test = new DartEntryImplTest(); | |
| 2817 // runJUnitTest(__test, __test.test_creation); | |
| 2818 // }); | |
| 2819 // _ut.test('test_getAllErrors', () { | |
| 2820 // final __test = new DartEntryImplTest(); | |
| 2821 // runJUnitTest(__test, __test.test_getAllErrors); | |
| 2822 // }); | |
| 2823 // _ut.test('test_getResolvableCompilationUnit_none', () { | |
| 2824 // final __test = new DartEntryImplTest(); | |
| 2825 // runJUnitTest(__test, __test.test_getResolvableCompilationUnit_none); | |
| 2826 // }); | |
| 2827 // _ut.test('test_getResolvableCompilationUnit_parsed_accessed', () { | |
| 2828 // final __test = new DartEntryImplTest(); | |
| 2829 // runJUnitTest(__test, __test.test_getResolvableCompilationUnit_parsed_
accessed); | |
| 2830 // }); | |
| 2831 // _ut.test('test_getResolvableCompilationUnit_parsed_notAccessed', () { | |
| 2832 // final __test = new DartEntryImplTest(); | |
| 2833 // runJUnitTest(__test, __test.test_getResolvableCompilationUnit_parsed_
notAccessed); | |
| 2834 // }); | |
| 2835 // _ut.test('test_getResolvableCompilationUnit_resolved', () { | |
| 2836 // final __test = new DartEntryImplTest(); | |
| 2837 // runJUnitTest(__test, __test.test_getResolvableCompilationUnit_resolve
d); | |
| 2838 // }); | |
| 2839 // _ut.test('test_getStateInLibrary_invalid_element', () { | |
| 2840 // final __test = new DartEntryImplTest(); | |
| 2841 // runJUnitTest(__test, __test.test_getStateInLibrary_invalid_element); | |
| 2842 // }); | |
| 2843 // _ut.test('test_getState_invalid_resolutionErrors', () { | |
| 2844 // final __test = new DartEntryImplTest(); | |
| 2845 // runJUnitTest(__test, __test.test_getState_invalid_resolutionErrors); | |
| 2846 // }); | |
| 2847 // _ut.test('test_getState_invalid_verificationErrors', () { | |
| 2848 // final __test = new DartEntryImplTest(); | |
| 2849 // runJUnitTest(__test, __test.test_getState_invalid_verificationErrors)
; | |
| 2850 // }); | |
| 2851 // _ut.test('test_getValueInLibrary_invalid_element', () { | |
| 2852 // final __test = new DartEntryImplTest(); | |
| 2853 // runJUnitTest(__test, __test.test_getValueInLibrary_invalid_element); | |
| 2854 // }); | |
| 2855 // _ut.test('test_getValueInLibrary_invalid_resolutionErrors_multiple', ()
{ | |
| 2856 // final __test = new DartEntryImplTest(); | |
| 2857 // runJUnitTest(__test, __test.test_getValueInLibrary_invalid_resolution
Errors_multiple); | |
| 2858 // }); | |
| 2859 // _ut.test('test_getValue_containingLibraries', () { | |
| 2860 // final __test = new DartEntryImplTest(); | |
| 2861 // runJUnitTest(__test, __test.test_getValue_containingLibraries); | |
| 2862 // }); | |
| 2863 // _ut.test('test_getValue_invalid_resolutionErrors', () { | |
| 2864 // final __test = new DartEntryImplTest(); | |
| 2865 // runJUnitTest(__test, __test.test_getValue_invalid_resolutionErrors); | |
| 2866 // }); | |
| 2867 // _ut.test('test_getValue_invalid_verificationErrors', () { | |
| 2868 // final __test = new DartEntryImplTest(); | |
| 2869 // runJUnitTest(__test, __test.test_getValue_invalid_verificationErrors)
; | |
| 2870 // }); | |
| 2871 // _ut.test('test_getWritableCopy', () { | |
| 2872 // final __test = new DartEntryImplTest(); | |
| 2873 // runJUnitTest(__test, __test.test_getWritableCopy); | |
| 2874 // }); | |
| 2875 // _ut.test('test_hasInvalidData_false', () { | |
| 2876 // final __test = new DartEntryImplTest(); | |
| 2877 // runJUnitTest(__test, __test.test_hasInvalidData_false); | |
| 2878 // }); | |
| 2879 // _ut.test('test_hasInvalidData_true', () { | |
| 2880 // final __test = new DartEntryImplTest(); | |
| 2881 // runJUnitTest(__test, __test.test_hasInvalidData_true); | |
| 2882 // }); | |
| 2883 // _ut.test('test_invalidateAllInformation', () { | |
| 2884 // final __test = new DartEntryImplTest(); | |
| 2885 // runJUnitTest(__test, __test.test_invalidateAllInformation); | |
| 2886 // }); | |
| 2887 // _ut.test('test_invalidateAllResolutionInformation', () { | |
| 2888 // final __test = new DartEntryImplTest(); | |
| 2889 // runJUnitTest(__test, __test.test_invalidateAllResolutionInformation); | |
| 2890 // }); | |
| 2891 // _ut.test('test_invalidateAllResolutionInformation_includingUris', () { | |
| 2892 // final __test = new DartEntryImplTest(); | |
| 2893 // runJUnitTest(__test, __test.test_invalidateAllResolutionInformation_i
ncludingUris); | |
| 2894 // }); | |
| 2895 // _ut.test('test_isClient', () { | |
| 2896 // final __test = new DartEntryImplTest(); | |
| 2897 // runJUnitTest(__test, __test.test_isClient); | |
| 2898 // }); | |
| 2899 // _ut.test('test_isLaunchable', () { | |
| 2900 // final __test = new DartEntryImplTest(); | |
| 2901 // runJUnitTest(__test, __test.test_isLaunchable); | |
| 2902 // }); | |
| 2903 // _ut.test('test_recordBuildElementErrorInLibrary', () { | |
| 2904 // final __test = new DartEntryImplTest(); | |
| 2905 // runJUnitTest(__test, __test.test_recordBuildElementErrorInLibrary); | |
| 2906 // }); | |
| 2907 // _ut.test('test_recordContentError', () { | |
| 2908 // final __test = new DartEntryImplTest(); | |
| 2909 // runJUnitTest(__test, __test.test_recordContentError); | |
| 2910 // }); | |
| 2911 // _ut.test('test_recordHintErrorInLibrary', () { | |
| 2912 // final __test = new DartEntryImplTest(); | |
| 2913 // runJUnitTest(__test, __test.test_recordHintErrorInLibrary); | |
| 2914 // }); | |
| 2915 // _ut.test('test_recordParseError', () { | |
| 2916 // final __test = new DartEntryImplTest(); | |
| 2917 // runJUnitTest(__test, __test.test_recordParseError); | |
| 2918 // }); | |
| 2919 // _ut.test('test_recordParseInProcess', () { | |
| 2920 // final __test = new DartEntryImplTest(); | |
| 2921 // runJUnitTest(__test, __test.test_recordParseInProcess); | |
| 2922 // }); | |
| 2923 // _ut.test('test_recordResolutionError', () { | |
| 2924 // final __test = new DartEntryImplTest(); | |
| 2925 // runJUnitTest(__test, __test.test_recordResolutionError); | |
| 2926 // }); | |
| 2927 // _ut.test('test_recordResolutionErrorInLibrary', () { | |
| 2928 // final __test = new DartEntryImplTest(); | |
| 2929 // runJUnitTest(__test, __test.test_recordResolutionErrorInLibrary); | |
| 2930 // }); | |
| 2931 // _ut.test('test_recordScanError', () { | |
| 2932 // final __test = new DartEntryImplTest(); | |
| 2933 // runJUnitTest(__test, __test.test_recordScanError); | |
| 2934 // }); | |
| 2935 // _ut.test('test_recordScanInProcess', () { | |
| 2936 // final __test = new DartEntryImplTest(); | |
| 2937 // runJUnitTest(__test, __test.test_recordScanInProcess); | |
| 2938 // }); | |
| 2939 // _ut.test('test_recordVerificationErrorInLibrary', () { | |
| 2940 // final __test = new DartEntryImplTest(); | |
| 2941 // runJUnitTest(__test, __test.test_recordVerificationErrorInLibrary); | |
| 2942 // }); | |
| 2943 // _ut.test('test_removeResolution_multiple_first', () { | |
| 2944 // final __test = new DartEntryImplTest(); | |
| 2945 // runJUnitTest(__test, __test.test_removeResolution_multiple_first); | |
| 2946 // }); | |
| 2947 // _ut.test('test_removeResolution_multiple_last', () { | |
| 2948 // final __test = new DartEntryImplTest(); | |
| 2949 // runJUnitTest(__test, __test.test_removeResolution_multiple_last); | |
| 2950 // }); | |
| 2951 // _ut.test('test_removeResolution_multiple_middle', () { | |
| 2952 // final __test = new DartEntryImplTest(); | |
| 2953 // runJUnitTest(__test, __test.test_removeResolution_multiple_middle); | |
| 2954 // }); | |
| 2955 // _ut.test('test_removeResolution_single', () { | |
| 2956 // final __test = new DartEntryImplTest(); | |
| 2957 // runJUnitTest(__test, __test.test_removeResolution_single); | |
| 2958 // }); | |
| 2959 // _ut.test('test_resolutionState', () { | |
| 2960 // final __test = new DartEntryImplTest(); | |
| 2961 // runJUnitTest(__test, __test.test_resolutionState); | |
| 2962 // }); | |
| 2963 // _ut.test('test_setState_element', () { | |
| 2964 // final __test = new DartEntryImplTest(); | |
| 2965 // runJUnitTest(__test, __test.test_setState_element); | |
| 2966 // }); | |
| 2967 // _ut.test('test_setState_exportedLibraries', () { | |
| 2968 // final __test = new DartEntryImplTest(); | |
| 2969 // runJUnitTest(__test, __test.test_setState_exportedLibraries); | |
| 2970 // }); | |
| 2971 // _ut.test('test_setState_hints', () { | |
| 2972 // final __test = new DartEntryImplTest(); | |
| 2973 // runJUnitTest(__test, __test.test_setState_hints); | |
| 2974 // }); | |
| 2975 // _ut.test('test_setState_importedLibraries', () { | |
| 2976 // final __test = new DartEntryImplTest(); | |
| 2977 // runJUnitTest(__test, __test.test_setState_importedLibraries); | |
| 2978 // }); | |
| 2979 // _ut.test('test_setState_includedParts', () { | |
| 2980 // final __test = new DartEntryImplTest(); | |
| 2981 // runJUnitTest(__test, __test.test_setState_includedParts); | |
| 2982 // }); | |
| 2983 // _ut.test('test_setState_invalid_element', () { | |
| 2984 // final __test = new DartEntryImplTest(); | |
| 2985 // runJUnitTest(__test, __test.test_setState_invalid_element); | |
| 2986 // }); | |
| 2987 // _ut.test('test_setState_invalid_resolutionErrors', () { | |
| 2988 // final __test = new DartEntryImplTest(); | |
| 2989 // runJUnitTest(__test, __test.test_setState_invalid_resolutionErrors); | |
| 2990 // }); | |
| 2991 // _ut.test('test_setState_invalid_validState', () { | |
| 2992 // final __test = new DartEntryImplTest(); | |
| 2993 // runJUnitTest(__test, __test.test_setState_invalid_validState); | |
| 2994 // }); | |
| 2995 // _ut.test('test_setState_invalid_verificationErrors', () { | |
| 2996 // final __test = new DartEntryImplTest(); | |
| 2997 // runJUnitTest(__test, __test.test_setState_invalid_verificationErrors)
; | |
| 2998 // }); | |
| 2999 // _ut.test('test_setState_isClient', () { | |
| 3000 // final __test = new DartEntryImplTest(); | |
| 3001 // runJUnitTest(__test, __test.test_setState_isClient); | |
| 3002 // }); | |
| 3003 // _ut.test('test_setState_isLaunchable', () { | |
| 3004 // final __test = new DartEntryImplTest(); | |
| 3005 // runJUnitTest(__test, __test.test_setState_isLaunchable); | |
| 3006 // }); | |
| 3007 // _ut.test('test_setState_lineInfo', () { | |
| 3008 // final __test = new DartEntryImplTest(); | |
| 3009 // runJUnitTest(__test, __test.test_setState_lineInfo); | |
| 3010 // }); | |
| 3011 // _ut.test('test_setState_parseErrors', () { | |
| 3012 // final __test = new DartEntryImplTest(); | |
| 3013 // runJUnitTest(__test, __test.test_setState_parseErrors); | |
| 3014 // }); | |
| 3015 // _ut.test('test_setState_parsedUnit', () { | |
| 3016 // final __test = new DartEntryImplTest(); | |
| 3017 // runJUnitTest(__test, __test.test_setState_parsedUnit); | |
| 3018 // }); | |
| 3019 // _ut.test('test_setState_publicNamespace', () { | |
| 3020 // final __test = new DartEntryImplTest(); | |
| 3021 // runJUnitTest(__test, __test.test_setState_publicNamespace); | |
| 3022 // }); | |
| 3023 // _ut.test('test_setState_resolutionErrors', () { | |
| 3024 // final __test = new DartEntryImplTest(); | |
| 3025 // runJUnitTest(__test, __test.test_setState_resolutionErrors); | |
| 3026 // }); | |
| 3027 // _ut.test('test_setState_resolvedUnit', () { | |
| 3028 // final __test = new DartEntryImplTest(); | |
| 3029 // runJUnitTest(__test, __test.test_setState_resolvedUnit); | |
| 3030 // }); | |
| 3031 // _ut.test('test_setState_scanErrors', () { | |
| 3032 // final __test = new DartEntryImplTest(); | |
| 3033 // runJUnitTest(__test, __test.test_setState_scanErrors); | |
| 3034 // }); | |
| 3035 // _ut.test('test_setState_sourceKind', () { | |
| 3036 // final __test = new DartEntryImplTest(); | |
| 3037 // runJUnitTest(__test, __test.test_setState_sourceKind); | |
| 3038 // }); | |
| 3039 // _ut.test('test_setState_tokenStream', () { | |
| 3040 // final __test = new DartEntryImplTest(); | |
| 3041 // runJUnitTest(__test, __test.test_setState_tokenStream); | |
| 3042 // }); | |
| 3043 // _ut.test('test_setState_verificationErrors', () { | |
| 3044 // final __test = new DartEntryImplTest(); | |
| 3045 // runJUnitTest(__test, __test.test_setState_verificationErrors); | |
| 3046 // }); | |
| 3047 // _ut.test('test_setValue_element', () { | |
| 3048 // final __test = new DartEntryImplTest(); | |
| 3049 // runJUnitTest(__test, __test.test_setValue_element); | |
| 3050 // }); | |
| 3051 // _ut.test('test_setValue_exportedLibraries', () { | |
| 3052 // final __test = new DartEntryImplTest(); | |
| 3053 // runJUnitTest(__test, __test.test_setValue_exportedLibraries); | |
| 3054 // }); | |
| 3055 // _ut.test('test_setValue_hints', () { | |
| 3056 // final __test = new DartEntryImplTest(); | |
| 3057 // runJUnitTest(__test, __test.test_setValue_hints); | |
| 3058 // }); | |
| 3059 // _ut.test('test_setValue_importedLibraries', () { | |
| 3060 // final __test = new DartEntryImplTest(); | |
| 3061 // runJUnitTest(__test, __test.test_setValue_importedLibraries); | |
| 3062 // }); | |
| 3063 // _ut.test('test_setValue_includedParts', () { | |
| 3064 // final __test = new DartEntryImplTest(); | |
| 3065 // runJUnitTest(__test, __test.test_setValue_includedParts); | |
| 3066 // }); | |
| 3067 // _ut.test('test_setValue_isClient', () { | |
| 3068 // final __test = new DartEntryImplTest(); | |
| 3069 // runJUnitTest(__test, __test.test_setValue_isClient); | |
| 3070 // }); | |
| 3071 // _ut.test('test_setValue_isLaunchable', () { | |
| 3072 // final __test = new DartEntryImplTest(); | |
| 3073 // runJUnitTest(__test, __test.test_setValue_isLaunchable); | |
| 3074 // }); | |
| 3075 // _ut.test('test_setValue_lineInfo', () { | |
| 3076 // final __test = new DartEntryImplTest(); | |
| 3077 // runJUnitTest(__test, __test.test_setValue_lineInfo); | |
| 3078 // }); | |
| 3079 // _ut.test('test_setValue_parseErrors', () { | |
| 3080 // final __test = new DartEntryImplTest(); | |
| 3081 // runJUnitTest(__test, __test.test_setValue_parseErrors); | |
| 3082 // }); | |
| 3083 // _ut.test('test_setValue_parsedUnit', () { | |
| 3084 // final __test = new DartEntryImplTest(); | |
| 3085 // runJUnitTest(__test, __test.test_setValue_parsedUnit); | |
| 3086 // }); | |
| 3087 // _ut.test('test_setValue_publicNamespace', () { | |
| 3088 // final __test = new DartEntryImplTest(); | |
| 3089 // runJUnitTest(__test, __test.test_setValue_publicNamespace); | |
| 3090 // }); | |
| 3091 // _ut.test('test_setValue_resolutionErrors', () { | |
| 3092 // final __test = new DartEntryImplTest(); | |
| 3093 // runJUnitTest(__test, __test.test_setValue_resolutionErrors); | |
| 3094 // }); | |
| 3095 // _ut.test('test_setValue_resolvedUnit', () { | |
| 3096 // final __test = new DartEntryImplTest(); | |
| 3097 // runJUnitTest(__test, __test.test_setValue_resolvedUnit); | |
| 3098 // }); | |
| 3099 // _ut.test('test_setValue_scanErrors', () { | |
| 3100 // final __test = new DartEntryImplTest(); | |
| 3101 // runJUnitTest(__test, __test.test_setValue_scanErrors); | |
| 3102 // }); | |
| 3103 // _ut.test('test_setValue_sourceKind', () { | |
| 3104 // final __test = new DartEntryImplTest(); | |
| 3105 // runJUnitTest(__test, __test.test_setValue_sourceKind); | |
| 3106 // }); | |
| 3107 // _ut.test('test_setValue_tokenStream', () { | |
| 3108 // final __test = new DartEntryImplTest(); | |
| 3109 // runJUnitTest(__test, __test.test_setValue_tokenStream); | |
| 3110 // }); | |
| 3111 // _ut.test('test_setValue_verificationErrors', () { | |
| 3112 // final __test = new DartEntryImplTest(); | |
| 3113 // runJUnitTest(__test, __test.test_setValue_verificationErrors); | |
| 3114 // }); | |
| 3115 // }); | |
| 3116 // } | |
| 3117 // } | |
| 3118 // class GenerateDartErrorsTaskTest extends EngineTestCase { | |
| 3119 // void test_accept() { | |
| 3120 // GenerateDartErrorsTask task = new GenerateDartErrorsTask(null, null, 0, n
ull, null); | |
| 3121 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_GenerateDartErro
rsTaskTest_test_accept())); | |
| 3122 // } | |
| 3123 // void test_getException() { | |
| 3124 // GenerateDartErrorsTask task = new GenerateDartErrorsTask(null, null, 0, n
ull, null); | |
| 3125 // JUnitTestCase.assertNull(task.exception); | |
| 3126 // } | |
| 3127 // void test_getLibraryElement() { | |
| 3128 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 3129 // LibraryElement element = ElementFactory.library(context, "lib"); | |
| 3130 // GenerateDartErrorsTask task = new GenerateDartErrorsTask(context, null, 0
, null, element); | |
| 3131 // JUnitTestCase.assertSame(element, task.libraryElement); | |
| 3132 // } | |
| 3133 // void test_getSource() { | |
| 3134 // Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test
.dart")); | |
| 3135 // GenerateDartErrorsTask task = new GenerateDartErrorsTask(null, source, 0,
null, null); | |
| 3136 // JUnitTestCase.assertSame(source, task.source); | |
| 3137 // } | |
| 3138 // void test_perform() { | |
| 3139 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 3140 // Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test
.dart")); | |
| 3141 // ChangeSet changeSet = new ChangeSet(); | |
| 3142 // changeSet.addedSource(source); | |
| 3143 // context.applyChanges(changeSet); | |
| 3144 // context.setContents(source, EngineTestCase.createSource(["library lib;",
"class A {", " int f = new A();", "}"])); | |
| 3145 // LibraryElement libraryElement = context.computeLibraryElement(source); | |
| 3146 // CompilationUnit unit = context.getResolvedCompilationUnit(source, library
Element); | |
| 3147 // GenerateDartErrorsTask task = new GenerateDartErrorsTask(context, source,
context.getModificationStamp(source), unit, libraryElement); | |
| 3148 // task.perform(new TestTaskVisitor_GenerateDartErrorsTaskTest_test_perform(
libraryElement, source)); | |
| 3149 // } | |
| 3150 // void test_perform_validateDirectives() { | |
| 3151 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 3152 // Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test
.dart")); | |
| 3153 // ChangeSet changeSet = new ChangeSet(); | |
| 3154 // changeSet.addedSource(source); | |
| 3155 // context.applyChanges(changeSet); | |
| 3156 // context.setContents(source, EngineTestCase.createSource([ | |
| 3157 // "library lib;", | |
| 3158 // "import 'invaliduri^.dart';", | |
| 3159 // "export '\${a}lib3.dart';", | |
| 3160 // "part '/does/not/exist.dart';", | |
| 3161 // "class A {}"])); | |
| 3162 // LibraryElement libraryElement = context.computeLibraryElement(source); | |
| 3163 // CompilationUnit unit = context.getResolvedCompilationUnit(source, library
Element); | |
| 3164 // GenerateDartErrorsTask task = new GenerateDartErrorsTask(context, source,
context.getModificationStamp(source), unit, libraryElement); | |
| 3165 // task.perform(new TestTaskVisitor_GenerateDartErrorsTaskTest_test_perform_
validateDirectives(libraryElement, source)); | |
| 3166 // } | |
| 3167 // static dartSuite() { | |
| 3168 // _ut.group('GenerateDartErrorsTaskTest', () { | |
| 3169 // _ut.test('test_accept', () { | |
| 3170 // final __test = new GenerateDartErrorsTaskTest(); | |
| 3171 // runJUnitTest(__test, __test.test_accept); | |
| 3172 // }); | |
| 3173 // _ut.test('test_getException', () { | |
| 3174 // final __test = new GenerateDartErrorsTaskTest(); | |
| 3175 // runJUnitTest(__test, __test.test_getException); | |
| 3176 // }); | |
| 3177 // _ut.test('test_getLibraryElement', () { | |
| 3178 // final __test = new GenerateDartErrorsTaskTest(); | |
| 3179 // runJUnitTest(__test, __test.test_getLibraryElement); | |
| 3180 // }); | |
| 3181 // _ut.test('test_getSource', () { | |
| 3182 // final __test = new GenerateDartErrorsTaskTest(); | |
| 3183 // runJUnitTest(__test, __test.test_getSource); | |
| 3184 // }); | |
| 3185 // _ut.test('test_perform', () { | |
| 3186 // final __test = new GenerateDartErrorsTaskTest(); | |
| 3187 // runJUnitTest(__test, __test.test_perform); | |
| 3188 // }); | |
| 3189 // _ut.test('test_perform_validateDirectives', () { | |
| 3190 // final __test = new GenerateDartErrorsTaskTest(); | |
| 3191 // runJUnitTest(__test, __test.test_perform_validateDirectives); | |
| 3192 // }); | |
| 3193 // }); | |
| 3194 // } | |
| 3195 // } | |
| 3196 // class GenerateDartHintsTaskTest extends EngineTestCase { | |
| 3197 // void test_accept() { | |
| 3198 // GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); | |
| 3199 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_GenerateDartHint
sTaskTest_test_accept())); | |
| 3200 // } | |
| 3201 // void test_getException() { | |
| 3202 // GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); | |
| 3203 // JUnitTestCase.assertNull(task.exception); | |
| 3204 // } | |
| 3205 // void test_getHintMap() { | |
| 3206 // GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); | |
| 3207 // JUnitTestCase.assertNull(task.hintMap); | |
| 3208 // } | |
| 3209 // void test_getLibraryElement() { | |
| 3210 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 3211 // LibraryElement element = ElementFactory.library(context, "lib"); | |
| 3212 // GenerateDartHintsTask task = new GenerateDartHintsTask(context, null, ele
ment); | |
| 3213 // JUnitTestCase.assertSame(element, task.libraryElement); | |
| 3214 // } | |
| 3215 // void test_perform() { | |
| 3216 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 3217 // ChangeSet changeSet = new ChangeSet(); | |
| 3218 // Source librarySource = new FileBasedSource.con1(FileUtilities2.createFile
("/test.dart")); | |
| 3219 // changeSet.addedSource(librarySource); | |
| 3220 // Source unusedSource = new FileBasedSource.con1(FileUtilities2.createFile(
"/unused.dart")); | |
| 3221 // changeSet.addedSource(unusedSource); | |
| 3222 // Source partSource = new FileBasedSource.con1(FileUtilities2.createFile("/
part.dart")); | |
| 3223 // changeSet.addedSource(partSource); | |
| 3224 // context.applyChanges(changeSet); | |
| 3225 // context.setContents(librarySource, EngineTestCase.createSource([ | |
| 3226 // "library lib;", | |
| 3227 // "import 'unused.dart';", | |
| 3228 // "part 'part.dart';"])); | |
| 3229 // context.setContents(unusedSource, EngineTestCase.createSource(["library u
nused;"])); | |
| 3230 // context.setContents(partSource, EngineTestCase.createSource(["part of lib
;"])); | |
| 3231 // List<TimestampedData<CompilationUnit>> units = new List<TimestampedData>(
2); | |
| 3232 // units[0] = new TimestampedData<CompilationUnit>(context.getModificationSt
amp(librarySource), context.resolveCompilationUnit2(librarySource, librarySource
)); | |
| 3233 // units[1] = new TimestampedData<CompilationUnit>(context.getModificationSt
amp(partSource), context.resolveCompilationUnit2(partSource, librarySource)); | |
| 3234 // GenerateDartHintsTask task = new GenerateDartHintsTask(context, units, co
ntext.computeLibraryElement(librarySource)); | |
| 3235 // task.perform(new TestTaskVisitor_GenerateDartHintsTaskTest_test_perform(l
ibrarySource, partSource)); | |
| 3236 // } | |
| 3237 // static dartSuite() { | |
| 3238 // _ut.group('GenerateDartHintsTaskTest', () { | |
| 3239 // _ut.test('test_accept', () { | |
| 3240 // final __test = new GenerateDartHintsTaskTest(); | |
| 3241 // runJUnitTest(__test, __test.test_accept); | |
| 3242 // }); | |
| 3243 // _ut.test('test_getException', () { | |
| 3244 // final __test = new GenerateDartHintsTaskTest(); | |
| 3245 // runJUnitTest(__test, __test.test_getException); | |
| 3246 // }); | |
| 3247 // _ut.test('test_getHintMap', () { | |
| 3248 // final __test = new GenerateDartHintsTaskTest(); | |
| 3249 // runJUnitTest(__test, __test.test_getHintMap); | |
| 3250 // }); | |
| 3251 // _ut.test('test_getLibraryElement', () { | |
| 3252 // final __test = new GenerateDartHintsTaskTest(); | |
| 3253 // runJUnitTest(__test, __test.test_getLibraryElement); | |
| 3254 // }); | |
| 3255 // _ut.test('test_perform', () { | |
| 3256 // final __test = new GenerateDartHintsTaskTest(); | |
| 3257 // runJUnitTest(__test, __test.test_perform); | |
| 3258 // }); | |
| 3259 // }); | |
| 3260 // } | |
| 3261 // } | |
| 3262 // class GetContentTaskTest extends EngineTestCase { | |
| 3263 // void test_accept() { | |
| 3264 // Source source = new TestSource.con2(""); | |
| 3265 // GetContentTask task = new GetContentTask(null, source); | |
| 3266 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_GetContentTaskTe
st_test_accept())); | |
| 3267 // } | |
| 3268 // void test_getException() { | |
| 3269 // Source source = new TestSource.con2(""); | |
| 3270 // GetContentTask task = new GetContentTask(null, source); | |
| 3271 // JUnitTestCase.assertNull(task.exception); | |
| 3272 // } | |
| 3273 // void test_getModificationTime() { | |
| 3274 // Source source = new TestSource.con2(""); | |
| 3275 // GetContentTask task = new GetContentTask(null, source); | |
| 3276 // JUnitTestCase.assertEquals(-1, task.modificationTime); | |
| 3277 // } | |
| 3278 // void test_getSource() { | |
| 3279 // Source source = new TestSource.con2(""); | |
| 3280 // GetContentTask task = new GetContentTask(null, source); | |
| 3281 // JUnitTestCase.assertSame(source, task.source); | |
| 3282 // } | |
| 3283 // void test_perform_exception() { | |
| 3284 // TestSource source = new TestSource(); | |
| 3285 // source.generateExceptionOnRead = true; | |
| 3286 // // final InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 3287 // // context.setSourceFactory(new SourceFactory(new FileUriResolver())); | |
| 3288 // GetContentTask task = new GetContentTask(null, source); | |
| 3289 // task.perform(new TestTaskVisitor_GetContentTaskTest_test_perform_exceptio
n()); | |
| 3290 // } | |
| 3291 // void test_perform_valid() { | |
| 3292 // String content = EngineTestCase.createSource(["class A {}"]); | |
| 3293 // Source source = new TestSource.con2(content); | |
| 3294 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 3295 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 3296 // GetContentTask task = new GetContentTask(context, source); | |
| 3297 // task.perform(new TestTaskVisitor_GetContentTaskTest_test_perform_valid(co
ntext, source)); | |
| 3298 // } | |
| 3299 // static dartSuite() { | |
| 3300 // _ut.group('GetContentTaskTest', () { | |
| 3301 // _ut.test('test_accept', () { | |
| 3302 // final __test = new GetContentTaskTest(); | |
| 3303 // runJUnitTest(__test, __test.test_accept); | |
| 3304 // }); | |
| 3305 // _ut.test('test_getException', () { | |
| 3306 // final __test = new GetContentTaskTest(); | |
| 3307 // runJUnitTest(__test, __test.test_getException); | |
| 3308 // }); | |
| 3309 // _ut.test('test_getModificationTime', () { | |
| 3310 // final __test = new GetContentTaskTest(); | |
| 3311 // runJUnitTest(__test, __test.test_getModificationTime); | |
| 3312 // }); | |
| 3313 // _ut.test('test_getSource', () { | |
| 3314 // final __test = new GetContentTaskTest(); | |
| 3315 // runJUnitTest(__test, __test.test_getSource); | |
| 3316 // }); | |
| 3317 // _ut.test('test_perform_exception', () { | |
| 3318 // final __test = new GetContentTaskTest(); | |
| 3319 // runJUnitTest(__test, __test.test_perform_exception); | |
| 3320 // }); | |
| 3321 // _ut.test('test_perform_valid', () { | |
| 3322 // final __test = new GetContentTaskTest(); | |
| 3323 // runJUnitTest(__test, __test.test_perform_valid); | |
| 3324 // }); | |
| 3325 // }); | |
| 3326 // } | |
| 3327 // } | |
| 3328 // class HtmlEntryImplTest extends EngineTestCase { | |
| 3329 // void test_creation() { | |
| 3330 // HtmlEntryImpl entry = new HtmlEntryImpl(); | |
| 3331 // JUnitTestCase.assertNotNull(entry); | |
| 3332 // } | |
| 3333 // void test_getAllErrors() { | |
| 3334 // Source source = new TestSource(); | |
| 3335 // HtmlEntryImpl entry = new HtmlEntryImpl(); | |
| 3336 // EngineTestCase.assertLength(0, entry.allErrors); | |
| 3337 // entry.setValue(HtmlEntry.PARSE_ERRORS, <AnalysisError> [new AnalysisError
.con1(source, ParserErrorCode.EXPECTED_TOKEN, [";"])]); | |
| 3338 // entry.setValue(HtmlEntry.RESOLUTION_ERRORS, <AnalysisError> [new Analysis
Error.con1(source, HtmlWarningCode.INVALID_URI, ["-"])]); | |
| 3339 // entry.setValue(HtmlEntry.ANGULAR_ERRORS, <AnalysisError> [new AnalysisErr
or.con1(source, AngularCode.INVALID_REPEAT_SYNTAX, ["-"])]); | |
| 3340 // entry.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, <AnalysisError> [new Analy
sisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, ["-"])]); | |
| 3341 // entry.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, <AnalysisError> [new
AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, ["-"])]); | |
| 3342 // entry.setValue(HtmlEntry.HINTS, <AnalysisError> [new AnalysisError.con1(s
ource, HintCode.DEAD_CODE, [])]); | |
| 3343 // EngineTestCase.assertLength(6, entry.allErrors); | |
| 3344 // } | |
| 3345 // void test_getWritableCopy() { | |
| 3346 // HtmlEntryImpl entry = new HtmlEntryImpl(); | |
| 3347 // HtmlEntryImpl copy = entry.writableCopy; | |
| 3348 // JUnitTestCase.assertNotNull(copy); | |
| 3349 // JUnitTestCase.assertNotSame(entry, copy); | |
| 3350 // } | |
| 3351 // void test_invalidateAllResolutionInformation() { | |
| 3352 // HtmlEntryImpl entry = _entryWithValidState(); | |
| 3353 // entry.invalidateAllResolutionInformation(false); | |
| 3354 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGUL
AR_APPLICATION)); | |
| 3355 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGUL
AR_COMPONENT)); | |
| 3356 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ANG
ULAR_ENTRY)); | |
| 3357 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ANG
ULAR_ERRORS)); | |
| 3358 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.POL
YMER_BUILD_ERRORS)); | |
| 3359 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.POL
YMER_RESOLUTION_ERRORS)); | |
| 3360 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ELE
MENT)); | |
| 3361 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.HIN
TS)); | |
| 3362 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LIN
E_INFO)); | |
| 3363 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE
_ERRORS)); | |
| 3364 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE
D_UNIT)); | |
| 3365 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.REFER
ENCED_LIBRARIES)); | |
| 3366 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.RES
OLUTION_ERRORS)); | |
| 3367 // } | |
| 3368 // void test_invalidateAllResolutionInformation_includingUris() { | |
| 3369 // HtmlEntryImpl entry = _entryWithValidState(); | |
| 3370 // entry.invalidateAllResolutionInformation(true); | |
| 3371 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGUL
AR_APPLICATION)); | |
| 3372 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGUL
AR_COMPONENT)); | |
| 3373 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ANG
ULAR_ENTRY)); | |
| 3374 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ANG
ULAR_ERRORS)); | |
| 3375 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.POL
YMER_BUILD_ERRORS)); | |
| 3376 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.POL
YMER_RESOLUTION_ERRORS)); | |
| 3377 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ELE
MENT)); | |
| 3378 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.HIN
TS)); | |
| 3379 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LIN
E_INFO)); | |
| 3380 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE
_ERRORS)); | |
| 3381 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE
D_UNIT)); | |
| 3382 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.REF
ERENCED_LIBRARIES)); | |
| 3383 // JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.RES
OLUTION_ERRORS)); | |
| 3384 // } | |
| 3385 // void test_setState_angularErrors() { | |
| 3386 // state = HtmlEntry.ANGULAR_ERRORS; | |
| 3387 // } | |
| 3388 // void test_setState_element() { | |
| 3389 // state = HtmlEntry.ELEMENT; | |
| 3390 // } | |
| 3391 // void test_setState_hints() { | |
| 3392 // state = HtmlEntry.HINTS; | |
| 3393 // } | |
| 3394 // void test_setState_lineInfo() { | |
| 3395 // state = SourceEntry.LINE_INFO; | |
| 3396 // } | |
| 3397 // void test_setState_parsedUnit() { | |
| 3398 // state = HtmlEntry.PARSED_UNIT; | |
| 3399 // } | |
| 3400 // void test_setState_parseErrors() { | |
| 3401 // state = HtmlEntry.PARSE_ERRORS; | |
| 3402 // } | |
| 3403 // void test_setState_polymerBuildErrors() { | |
| 3404 // state = HtmlEntry.POLYMER_BUILD_ERRORS; | |
| 3405 // } | |
| 3406 // void test_setState_polymerResolutionErrors() { | |
| 3407 // state = HtmlEntry.POLYMER_RESOLUTION_ERRORS; | |
| 3408 // } | |
| 3409 // void test_setState_referencedLibraries() { | |
| 3410 // state = HtmlEntry.REFERENCED_LIBRARIES; | |
| 3411 // } | |
| 3412 // void test_setState_resolutionErrors() { | |
| 3413 // state = HtmlEntry.RESOLUTION_ERRORS; | |
| 3414 // } | |
| 3415 // void test_setValue_angularErrors() { | |
| 3416 // _setValue(HtmlEntry.ANGULAR_ERRORS, <AnalysisError> [new AnalysisError.co
n1(null, AngularCode.INVALID_REPEAT_SYNTAX, ["-"])]); | |
| 3417 // } | |
| 3418 // void test_setValue_element() { | |
| 3419 // _setValue(HtmlEntry.ELEMENT, new HtmlElementImpl(null, "test.html")); | |
| 3420 // } | |
| 3421 // void test_setValue_hints() { | |
| 3422 // _setValue(HtmlEntry.HINTS, <AnalysisError> [new AnalysisError.con1(null,
HintCode.DEAD_CODE, [])]); | |
| 3423 // } | |
| 3424 // void test_setValue_illegal() { | |
| 3425 // HtmlEntryImpl entry = new HtmlEntryImpl(); | |
| 3426 // try { | |
| 3427 // entry.setValue(DartEntry.ELEMENT, null); | |
| 3428 // JUnitTestCase.fail("Expected IllegalArgumentException for DartEntry.ELE
MENT"); | |
| 3429 // } on IllegalArgumentException catch (exception) { | |
| 3430 // } | |
| 3431 // } | |
| 3432 // void test_setValue_lineInfo() { | |
| 3433 // _setValue(SourceEntry.LINE_INFO, new LineInfo(<int> [0])); | |
| 3434 // } | |
| 3435 // void test_setValue_parsedUnit() { | |
| 3436 // _setValue(HtmlEntry.PARSED_UNIT, new HtmlUnit(null, null, null)); | |
| 3437 // } | |
| 3438 // void test_setValue_parseErrors() { | |
| 3439 // _setValue(HtmlEntry.PARSE_ERRORS, <AnalysisError> [new AnalysisError.con1
(null, HtmlWarningCode.INVALID_URI, ["-"])]); | |
| 3440 // } | |
| 3441 // void test_setValue_polymerBuildErrors() { | |
| 3442 // _setValue(HtmlEntry.POLYMER_BUILD_ERRORS, <AnalysisError> [new AnalysisEr
ror.con1(null, PolymerCode.INVALID_ATTRIBUTE_NAME, ["-"])]); | |
| 3443 // } | |
| 3444 // void test_setValue_polymerResolutionErrors() { | |
| 3445 // _setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, <AnalysisError> [new Analy
sisError.con1(null, PolymerCode.INVALID_ATTRIBUTE_NAME, ["-"])]); | |
| 3446 // } | |
| 3447 // void test_setValue_referencedLibraries() { | |
| 3448 // _setValue(HtmlEntry.REFERENCED_LIBRARIES, <Source> [new TestSource()]); | |
| 3449 // } | |
| 3450 // void test_setValue_resolutionErrors() { | |
| 3451 // _setValue(HtmlEntry.RESOLUTION_ERRORS, <AnalysisError> [new AnalysisError
.con1(null, HtmlWarningCode.INVALID_URI, ["-"])]); | |
| 3452 // } | |
| 3453 // HtmlEntryImpl _entryWithValidState() { | |
| 3454 // HtmlEntryImpl entry = new HtmlEntryImpl(); | |
| 3455 // entry.setValue(HtmlEntry.ANGULAR_ERRORS, null); | |
| 3456 // entry.setValue(HtmlEntry.ELEMENT, null); | |
| 3457 // entry.setValue(HtmlEntry.HINTS, null); | |
| 3458 // entry.setValue(SourceEntry.LINE_INFO, null); | |
| 3459 // entry.setValue(HtmlEntry.PARSE_ERRORS, null); | |
| 3460 // entry.setValue(HtmlEntry.PARSED_UNIT, null); | |
| 3461 // entry.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, null); | |
| 3462 // entry.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, null); | |
| 3463 // entry.setValue(HtmlEntry.REFERENCED_LIBRARIES, null); | |
| 3464 // entry.setValue(HtmlEntry.RESOLUTION_ERRORS, null); | |
| 3465 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGUL
AR_ERRORS)); | |
| 3466 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ELEME
NT)); | |
| 3467 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.HINTS
)); | |
| 3468 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LIN
E_INFO)); | |
| 3469 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE
_ERRORS)); | |
| 3470 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE
D_UNIT)); | |
| 3471 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.POLYM
ER_BUILD_ERRORS)); | |
| 3472 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.POLYM
ER_RESOLUTION_ERRORS)); | |
| 3473 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.REFER
ENCED_LIBRARIES)); | |
| 3474 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.RESOL
UTION_ERRORS)); | |
| 3475 // return entry; | |
| 3476 // } | |
| 3477 // void set state(DataDescriptor descriptor) { | |
| 3478 // HtmlEntryImpl entry = new HtmlEntryImpl(); | |
| 3479 // JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getState(descriptor
)); | |
| 3480 // entry.setState(descriptor, CacheState.FLUSHED); | |
| 3481 // JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getState(descriptor)); | |
| 3482 // } | |
| 3483 // void _setValue(DataDescriptor descriptor, Object newValue) { | |
| 3484 // HtmlEntryImpl entry = new HtmlEntryImpl(); | |
| 3485 // Object value = entry.getValue(descriptor); | |
| 3486 // JUnitTestCase.assertNotSame(value, newValue); | |
| 3487 // entry.setValue(descriptor, newValue); | |
| 3488 // JUnitTestCase.assertSame(CacheState.VALID, entry.getState(descriptor)); | |
| 3489 // JUnitTestCase.assertSame(newValue, entry.getValue(descriptor)); | |
| 3490 // } | |
| 3491 // static dartSuite() { | |
| 3492 // _ut.group('HtmlEntryImplTest', () { | |
| 3493 // _ut.test('test_creation', () { | |
| 3494 // final __test = new HtmlEntryImplTest(); | |
| 3495 // runJUnitTest(__test, __test.test_creation); | |
| 3496 // }); | |
| 3497 // _ut.test('test_getAllErrors', () { | |
| 3498 // final __test = new HtmlEntryImplTest(); | |
| 3499 // runJUnitTest(__test, __test.test_getAllErrors); | |
| 3500 // }); | |
| 3501 // _ut.test('test_getWritableCopy', () { | |
| 3502 // final __test = new HtmlEntryImplTest(); | |
| 3503 // runJUnitTest(__test, __test.test_getWritableCopy); | |
| 3504 // }); | |
| 3505 // _ut.test('test_invalidateAllResolutionInformation', () { | |
| 3506 // final __test = new HtmlEntryImplTest(); | |
| 3507 // runJUnitTest(__test, __test.test_invalidateAllResolutionInformation); | |
| 3508 // }); | |
| 3509 // _ut.test('test_invalidateAllResolutionInformation_includingUris', () { | |
| 3510 // final __test = new HtmlEntryImplTest(); | |
| 3511 // runJUnitTest(__test, __test.test_invalidateAllResolutionInformation_i
ncludingUris); | |
| 3512 // }); | |
| 3513 // _ut.test('test_setState_angularErrors', () { | |
| 3514 // final __test = new HtmlEntryImplTest(); | |
| 3515 // runJUnitTest(__test, __test.test_setState_angularErrors); | |
| 3516 // }); | |
| 3517 // _ut.test('test_setState_element', () { | |
| 3518 // final __test = new HtmlEntryImplTest(); | |
| 3519 // runJUnitTest(__test, __test.test_setState_element); | |
| 3520 // }); | |
| 3521 // _ut.test('test_setState_hints', () { | |
| 3522 // final __test = new HtmlEntryImplTest(); | |
| 3523 // runJUnitTest(__test, __test.test_setState_hints); | |
| 3524 // }); | |
| 3525 // _ut.test('test_setState_lineInfo', () { | |
| 3526 // final __test = new HtmlEntryImplTest(); | |
| 3527 // runJUnitTest(__test, __test.test_setState_lineInfo); | |
| 3528 // }); | |
| 3529 // _ut.test('test_setState_parseErrors', () { | |
| 3530 // final __test = new HtmlEntryImplTest(); | |
| 3531 // runJUnitTest(__test, __test.test_setState_parseErrors); | |
| 3532 // }); | |
| 3533 // _ut.test('test_setState_parsedUnit', () { | |
| 3534 // final __test = new HtmlEntryImplTest(); | |
| 3535 // runJUnitTest(__test, __test.test_setState_parsedUnit); | |
| 3536 // }); | |
| 3537 // _ut.test('test_setState_polymerBuildErrors', () { | |
| 3538 // final __test = new HtmlEntryImplTest(); | |
| 3539 // runJUnitTest(__test, __test.test_setState_polymerBuildErrors); | |
| 3540 // }); | |
| 3541 // _ut.test('test_setState_polymerResolutionErrors', () { | |
| 3542 // final __test = new HtmlEntryImplTest(); | |
| 3543 // runJUnitTest(__test, __test.test_setState_polymerResolutionErrors); | |
| 3544 // }); | |
| 3545 // _ut.test('test_setState_referencedLibraries', () { | |
| 3546 // final __test = new HtmlEntryImplTest(); | |
| 3547 // runJUnitTest(__test, __test.test_setState_referencedLibraries); | |
| 3548 // }); | |
| 3549 // _ut.test('test_setState_resolutionErrors', () { | |
| 3550 // final __test = new HtmlEntryImplTest(); | |
| 3551 // runJUnitTest(__test, __test.test_setState_resolutionErrors); | |
| 3552 // }); | |
| 3553 // _ut.test('test_setValue_angularErrors', () { | |
| 3554 // final __test = new HtmlEntryImplTest(); | |
| 3555 // runJUnitTest(__test, __test.test_setValue_angularErrors); | |
| 3556 // }); | |
| 3557 // _ut.test('test_setValue_element', () { | |
| 3558 // final __test = new HtmlEntryImplTest(); | |
| 3559 // runJUnitTest(__test, __test.test_setValue_element); | |
| 3560 // }); | |
| 3561 // _ut.test('test_setValue_hints', () { | |
| 3562 // final __test = new HtmlEntryImplTest(); | |
| 3563 // runJUnitTest(__test, __test.test_setValue_hints); | |
| 3564 // }); | |
| 3565 // _ut.test('test_setValue_illegal', () { | |
| 3566 // final __test = new HtmlEntryImplTest(); | |
| 3567 // runJUnitTest(__test, __test.test_setValue_illegal); | |
| 3568 // }); | |
| 3569 // _ut.test('test_setValue_lineInfo', () { | |
| 3570 // final __test = new HtmlEntryImplTest(); | |
| 3571 // runJUnitTest(__test, __test.test_setValue_lineInfo); | |
| 3572 // }); | |
| 3573 // _ut.test('test_setValue_parseErrors', () { | |
| 3574 // final __test = new HtmlEntryImplTest(); | |
| 3575 // runJUnitTest(__test, __test.test_setValue_parseErrors); | |
| 3576 // }); | |
| 3577 // _ut.test('test_setValue_parsedUnit', () { | |
| 3578 // final __test = new HtmlEntryImplTest(); | |
| 3579 // runJUnitTest(__test, __test.test_setValue_parsedUnit); | |
| 3580 // }); | |
| 3581 // _ut.test('test_setValue_polymerBuildErrors', () { | |
| 3582 // final __test = new HtmlEntryImplTest(); | |
| 3583 // runJUnitTest(__test, __test.test_setValue_polymerBuildErrors); | |
| 3584 // }); | |
| 3585 // _ut.test('test_setValue_polymerResolutionErrors', () { | |
| 3586 // final __test = new HtmlEntryImplTest(); | |
| 3587 // runJUnitTest(__test, __test.test_setValue_polymerResolutionErrors); | |
| 3588 // }); | |
| 3589 // _ut.test('test_setValue_referencedLibraries', () { | |
| 3590 // final __test = new HtmlEntryImplTest(); | |
| 3591 // runJUnitTest(__test, __test.test_setValue_referencedLibraries); | |
| 3592 // }); | |
| 3593 // _ut.test('test_setValue_resolutionErrors', () { | |
| 3594 // final __test = new HtmlEntryImplTest(); | |
| 3595 // runJUnitTest(__test, __test.test_setValue_resolutionErrors); | |
| 3596 // }); | |
| 3597 // }); | |
| 3598 // } | |
| 3599 // } | |
| 3600 // class IncrementalAnalysisCacheTest extends JUnitTestCase { | |
| 3601 // Source _source = new TestSource(); | |
| 3602 // DartEntryImpl _entry = new DartEntryImpl(); | |
| 3603 // CompilationUnit _unit = mock(CompilationUnit); | |
| 3604 // IncrementalAnalysisCache _result; | |
| 3605 // void test_cacheResult() { | |
| 3606 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3607 // CompilationUnit newUnit = mock(CompilationUnit); | |
| 3608 // _result = IncrementalAnalysisCache.cacheResult(cache, newUnit); | |
| 3609 // JUnitTestCase.assertNotNull(_result); | |
| 3610 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3611 // JUnitTestCase.assertSame(newUnit, _result.resolvedUnit); | |
| 3612 // JUnitTestCase.assertEquals("hbazlo", _result.oldContents); | |
| 3613 // JUnitTestCase.assertEquals("hbazlo", _result.newContents); | |
| 3614 // JUnitTestCase.assertEquals(0, _result.offset); | |
| 3615 // JUnitTestCase.assertEquals(0, _result.oldLength); | |
| 3616 // JUnitTestCase.assertEquals(0, _result.newLength); | |
| 3617 // } | |
| 3618 // void test_cacheResult_noCache() { | |
| 3619 // IncrementalAnalysisCache cache = null; | |
| 3620 // CompilationUnit newUnit = mock(CompilationUnit); | |
| 3621 // _result = IncrementalAnalysisCache.cacheResult(cache, newUnit); | |
| 3622 // JUnitTestCase.assertNull(_result); | |
| 3623 // } | |
| 3624 // void test_cacheResult_noCacheNoResult() { | |
| 3625 // IncrementalAnalysisCache cache = null; | |
| 3626 // CompilationUnit newUnit = null; | |
| 3627 // _result = IncrementalAnalysisCache.cacheResult(cache, newUnit); | |
| 3628 // JUnitTestCase.assertNull(_result); | |
| 3629 // } | |
| 3630 // void test_cacheResult_noResult() { | |
| 3631 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3632 // CompilationUnit newUnit = null; | |
| 3633 // _result = IncrementalAnalysisCache.cacheResult(cache, newUnit); | |
| 3634 // JUnitTestCase.assertNull(_result); | |
| 3635 // } | |
| 3636 // void test_clear_differentSource() { | |
| 3637 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3638 // Source otherSource = new TestSource.con1(new JavaFile("blat.dart"), "blat
"); | |
| 3639 // _result = IncrementalAnalysisCache.clear(cache, otherSource); | |
| 3640 // JUnitTestCase.assertSame(cache, _result); | |
| 3641 // } | |
| 3642 // void test_clear_nullCache() { | |
| 3643 // IncrementalAnalysisCache cache = null; | |
| 3644 // _result = IncrementalAnalysisCache.clear(cache, _source); | |
| 3645 // JUnitTestCase.assertNull(_result); | |
| 3646 // } | |
| 3647 // void test_clear_sameSource() { | |
| 3648 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3649 // _result = IncrementalAnalysisCache.clear(cache, _source); | |
| 3650 // JUnitTestCase.assertNull(_result); | |
| 3651 // } | |
| 3652 // void test_update_append() { | |
| 3653 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3654 // DartEntryImpl newEntry = new DartEntryImpl(); | |
| 3655 // _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbaz
xlo", 4, 0, 1, newEntry); | |
| 3656 // JUnitTestCase.assertNotNull(_result); | |
| 3657 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3658 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3659 // JUnitTestCase.assertEquals("hello", _result.oldContents); | |
| 3660 // JUnitTestCase.assertEquals("hbazxlo", _result.newContents); | |
| 3661 // JUnitTestCase.assertEquals(1, _result.offset); | |
| 3662 // JUnitTestCase.assertEquals(2, _result.oldLength); | |
| 3663 // JUnitTestCase.assertEquals(4, _result.newLength); | |
| 3664 // } | |
| 3665 // void test_update_appendToCachedResult() { | |
| 3666 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3667 // CompilationUnit newUnit = mock(CompilationUnit); | |
| 3668 // cache = IncrementalAnalysisCache.cacheResult(cache, newUnit); | |
| 3669 // JUnitTestCase.assertNotNull(cache); | |
| 3670 // DartEntryImpl newEntry = new DartEntryImpl(); | |
| 3671 // _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbaz
xlo", 4, 0, 1, newEntry); | |
| 3672 // JUnitTestCase.assertNotNull(_result); | |
| 3673 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3674 // JUnitTestCase.assertSame(newUnit, _result.resolvedUnit); | |
| 3675 // JUnitTestCase.assertEquals("hbazlo", _result.oldContents); | |
| 3676 // JUnitTestCase.assertEquals("hbazxlo", _result.newContents); | |
| 3677 // JUnitTestCase.assertEquals(4, _result.offset); | |
| 3678 // JUnitTestCase.assertEquals(0, _result.oldLength); | |
| 3679 // JUnitTestCase.assertEquals(1, _result.newLength); | |
| 3680 // } | |
| 3681 // void test_update_appendWithNewResolvedUnit() { | |
| 3682 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3683 // DartEntryImpl newEntry = new DartEntryImpl(); | |
| 3684 // CompilationUnit newUnit = mock(CompilationUnit); | |
| 3685 // newEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, newUnit); | |
| 3686 // _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbaz
xlo", 4, 0, 1, newEntry); | |
| 3687 // JUnitTestCase.assertNotNull(_result); | |
| 3688 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3689 // JUnitTestCase.assertSame(newUnit, _result.resolvedUnit); | |
| 3690 // JUnitTestCase.assertEquals("hbazlo", _result.oldContents); | |
| 3691 // JUnitTestCase.assertEquals("hbazxlo", _result.newContents); | |
| 3692 // JUnitTestCase.assertEquals(4, _result.offset); | |
| 3693 // JUnitTestCase.assertEquals(0, _result.oldLength); | |
| 3694 // JUnitTestCase.assertEquals(1, _result.newLength); | |
| 3695 // } | |
| 3696 // void test_update_appendWithNoNewResolvedUnit() { | |
| 3697 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3698 // DartEntryImpl newEntry = new DartEntryImpl(); | |
| 3699 // _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbaz
xlo", 4, 0, 1, newEntry); | |
| 3700 // JUnitTestCase.assertNotNull(_result); | |
| 3701 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3702 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3703 // JUnitTestCase.assertEquals("hello", _result.oldContents); | |
| 3704 // JUnitTestCase.assertEquals("hbazxlo", _result.newContents); | |
| 3705 // JUnitTestCase.assertEquals(1, _result.offset); | |
| 3706 // JUnitTestCase.assertEquals(2, _result.oldLength); | |
| 3707 // JUnitTestCase.assertEquals(4, _result.newLength); | |
| 3708 // } | |
| 3709 // void test_update_delete() { | |
| 3710 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3711 // DartEntryImpl newEntry = new DartEntryImpl(); | |
| 3712 // _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hzlo
", 1, 2, 0, newEntry); | |
| 3713 // JUnitTestCase.assertNotNull(_result); | |
| 3714 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3715 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3716 // JUnitTestCase.assertEquals("hello", _result.oldContents); | |
| 3717 // JUnitTestCase.assertEquals("hzlo", _result.newContents); | |
| 3718 // JUnitTestCase.assertEquals(1, _result.offset); | |
| 3719 // JUnitTestCase.assertEquals(2, _result.oldLength); | |
| 3720 // JUnitTestCase.assertEquals(1, _result.newLength); | |
| 3721 // } | |
| 3722 // void test_update_insert_nonContiguous_after() { | |
| 3723 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3724 // DartEntryImpl newEntry = new DartEntryImpl(); | |
| 3725 // _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbaz
lox", 6, 0, 1, newEntry); | |
| 3726 // JUnitTestCase.assertNull(_result); | |
| 3727 // } | |
| 3728 // void test_update_insert_nonContiguous_before() { | |
| 3729 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3730 // DartEntryImpl newEntry = new DartEntryImpl(); | |
| 3731 // _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "xhba
zlo", 0, 0, 1, newEntry); | |
| 3732 // JUnitTestCase.assertNull(_result); | |
| 3733 // } | |
| 3734 // void test_update_newSource_entry() { | |
| 3735 // Source oldSource = new TestSource.con1(new JavaFile("blat.dart"), "blat")
; | |
| 3736 // DartEntryImpl oldEntry = new DartEntryImpl(); | |
| 3737 // CompilationUnit oldUnit = mock(CompilationUnit); | |
| 3738 // oldEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, oldUnit); | |
| 3739 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, ol
dSource, "hello", "hbazlo", 1, 2, 3, oldEntry); | |
| 3740 // JUnitTestCase.assertSame(oldSource, cache.source); | |
| 3741 // JUnitTestCase.assertSame(oldUnit, cache.resolvedUnit); | |
| 3742 // _result = IncrementalAnalysisCache.update(cache, _source, "foo", "foobz",
3, 0, 2, _entry); | |
| 3743 // JUnitTestCase.assertNotNull(_result); | |
| 3744 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3745 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3746 // JUnitTestCase.assertEquals("foo", _result.oldContents); | |
| 3747 // JUnitTestCase.assertEquals("foobz", _result.newContents); | |
| 3748 // JUnitTestCase.assertEquals(3, _result.offset); | |
| 3749 // JUnitTestCase.assertEquals(0, _result.oldLength); | |
| 3750 // JUnitTestCase.assertEquals(2, _result.newLength); | |
| 3751 // } | |
| 3752 // void test_update_newSource_noEntry() { | |
| 3753 // Source oldSource = new TestSource.con1(new JavaFile("blat.dart"), "blat")
; | |
| 3754 // DartEntryImpl oldEntry = new DartEntryImpl(); | |
| 3755 // CompilationUnit oldUnit = mock(CompilationUnit); | |
| 3756 // oldEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, oldUnit); | |
| 3757 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, ol
dSource, "hello", "hbazlo", 1, 2, 3, oldEntry); | |
| 3758 // JUnitTestCase.assertSame(oldSource, cache.source); | |
| 3759 // JUnitTestCase.assertSame(oldUnit, cache.resolvedUnit); | |
| 3760 // _result = IncrementalAnalysisCache.update(cache, _source, "foo", "foobar"
, 3, 0, 3, null); | |
| 3761 // JUnitTestCase.assertNull(_result); | |
| 3762 // } | |
| 3763 // void test_update_noCache_entry() { | |
| 3764 // _result = IncrementalAnalysisCache.update(null, _source, "hello", "hbazlo
", 1, 2, 3, _entry); | |
| 3765 // JUnitTestCase.assertNotNull(_result); | |
| 3766 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3767 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3768 // JUnitTestCase.assertEquals("hello", _result.oldContents); | |
| 3769 // JUnitTestCase.assertEquals("hbazlo", _result.newContents); | |
| 3770 // JUnitTestCase.assertEquals(1, _result.offset); | |
| 3771 // JUnitTestCase.assertEquals(2, _result.oldLength); | |
| 3772 // JUnitTestCase.assertEquals(3, _result.newLength); | |
| 3773 // JUnitTestCase.assertTrue(_result.hasWork); | |
| 3774 // } | |
| 3775 // void test_update_noCache_entry_noOldSource_append() { | |
| 3776 // _result = IncrementalAnalysisCache.update(null, _source, null, "hellxo",
4, 0, 1, _entry); | |
| 3777 // JUnitTestCase.assertNotNull(_result); | |
| 3778 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3779 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3780 // JUnitTestCase.assertEquals("hello", _result.oldContents); | |
| 3781 // JUnitTestCase.assertEquals("hellxo", _result.newContents); | |
| 3782 // JUnitTestCase.assertEquals(4, _result.offset); | |
| 3783 // JUnitTestCase.assertEquals(0, _result.oldLength); | |
| 3784 // JUnitTestCase.assertEquals(1, _result.newLength); | |
| 3785 // JUnitTestCase.assertTrue(_result.hasWork); | |
| 3786 // } | |
| 3787 // void test_update_noCache_entry_noOldSource_delete() { | |
| 3788 // _result = IncrementalAnalysisCache.update(null, _source, null, "helo", 4,
1, 0, _entry); | |
| 3789 // JUnitTestCase.assertNull(_result); | |
| 3790 // } | |
| 3791 // void test_update_noCache_entry_noOldSource_replace() { | |
| 3792 // _result = IncrementalAnalysisCache.update(null, _source, null, "helxo", 4
, 1, 1, _entry); | |
| 3793 // JUnitTestCase.assertNull(_result); | |
| 3794 // } | |
| 3795 // void test_update_noCache_noEntry() { | |
| 3796 // _result = IncrementalAnalysisCache.update(null, _source, "hello", "hbazlo
", 1, 2, 3, null); | |
| 3797 // JUnitTestCase.assertNull(_result); | |
| 3798 // } | |
| 3799 // void test_update_replace() { | |
| 3800 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3801 // _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbar
rlo", 3, 1, 2, null); | |
| 3802 // JUnitTestCase.assertNotNull(_result); | |
| 3803 // JUnitTestCase.assertSame(_source, _result.source); | |
| 3804 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3805 // JUnitTestCase.assertEquals("hello", _result.oldContents); | |
| 3806 // JUnitTestCase.assertEquals("hbarrlo", _result.newContents); | |
| 3807 // JUnitTestCase.assertEquals(1, _result.offset); | |
| 3808 // JUnitTestCase.assertEquals(2, _result.oldLength); | |
| 3809 // JUnitTestCase.assertEquals(4, _result.newLength); | |
| 3810 // } | |
| 3811 // void test_verifyStructure_invalidUnit() { | |
| 3812 // String oldCode = "main() {foo;}"; | |
| 3813 // String newCode = "main() {boo;}"; | |
| 3814 // CompilationUnit badUnit = _parse("main() {bad;}"); | |
| 3815 // _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, badUnit); | |
| 3816 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, oldCode, newCode, 8, 1, 1, _entry); | |
| 3817 // CompilationUnit newUnit = _parse(newCode); | |
| 3818 // _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUni
t); | |
| 3819 // JUnitTestCase.assertNull(_result); | |
| 3820 // } | |
| 3821 // void test_verifyStructure_noCache() { | |
| 3822 // IncrementalAnalysisCache cache = null; | |
| 3823 // CompilationUnit newUnit = mock(CompilationUnit); | |
| 3824 // _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUni
t); | |
| 3825 // JUnitTestCase.assertNull(_result); | |
| 3826 // } | |
| 3827 // void test_verifyStructure_noCacheNoUnit() { | |
| 3828 // IncrementalAnalysisCache cache = null; | |
| 3829 // CompilationUnit newUnit = null; | |
| 3830 // _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUni
t); | |
| 3831 // JUnitTestCase.assertNull(_result); | |
| 3832 // } | |
| 3833 // void test_verifyStructure_noUnit() { | |
| 3834 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3835 // CompilationUnit newUnit = null; | |
| 3836 // _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUni
t); | |
| 3837 // JUnitTestCase.assertSame(cache, _result); | |
| 3838 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3839 // } | |
| 3840 // void test_verifyStructure_otherSource() { | |
| 3841 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, "hello", "hbazlo", 1, 2, 3, _entry); | |
| 3842 // CompilationUnit newUnit = mock(CompilationUnit); | |
| 3843 // Source otherSource = new TestSource.con1(new JavaFile("blat.dart"), "blat
"); | |
| 3844 // _result = IncrementalAnalysisCache.verifyStructure(cache, otherSource, ne
wUnit); | |
| 3845 // JUnitTestCase.assertSame(cache, _result); | |
| 3846 // JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | |
| 3847 // } | |
| 3848 // void test_verifyStructure_validUnit() { | |
| 3849 // String oldCode = "main() {foo;}"; | |
| 3850 // String newCode = "main() {boo;}"; | |
| 3851 // CompilationUnit goodUnit = _parse(newCode); | |
| 3852 // _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, goodUnit); | |
| 3853 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _s
ource, oldCode, newCode, 1, 2, 3, _entry); | |
| 3854 // CompilationUnit newUnit = _parse(newCode); | |
| 3855 // _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUni
t); | |
| 3856 // JUnitTestCase.assertSame(cache, _result); | |
| 3857 // JUnitTestCase.assertSame(goodUnit, _result.resolvedUnit); | |
| 3858 // } | |
| 3859 // @override | |
| 3860 // void setUp() { | |
| 3861 // _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, _unit); | |
| 3862 // } | |
| 3863 // CompilationUnit _parse(String code) { | |
| 3864 // Scanner scanner = new Scanner(_source, new CharSequenceReader(code), Anal
ysisErrorListener.NULL_LISTENER); | |
| 3865 // Parser parser = new Parser(_source, AnalysisErrorListener.NULL_LISTENER); | |
| 3866 // return parser.parseCompilationUnit(scanner.tokenize()); | |
| 3867 // } | |
| 3868 // static dartSuite() { | |
| 3869 // _ut.group('IncrementalAnalysisCacheTest', () { | |
| 3870 // _ut.test('test_cacheResult', () { | |
| 3871 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3872 // runJUnitTest(__test, __test.test_cacheResult); | |
| 3873 // }); | |
| 3874 // _ut.test('test_cacheResult_noCache', () { | |
| 3875 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3876 // runJUnitTest(__test, __test.test_cacheResult_noCache); | |
| 3877 // }); | |
| 3878 // _ut.test('test_cacheResult_noCacheNoResult', () { | |
| 3879 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3880 // runJUnitTest(__test, __test.test_cacheResult_noCacheNoResult); | |
| 3881 // }); | |
| 3882 // _ut.test('test_cacheResult_noResult', () { | |
| 3883 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3884 // runJUnitTest(__test, __test.test_cacheResult_noResult); | |
| 3885 // }); | |
| 3886 // _ut.test('test_clear_differentSource', () { | |
| 3887 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3888 // runJUnitTest(__test, __test.test_clear_differentSource); | |
| 3889 // }); | |
| 3890 // _ut.test('test_clear_nullCache', () { | |
| 3891 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3892 // runJUnitTest(__test, __test.test_clear_nullCache); | |
| 3893 // }); | |
| 3894 // _ut.test('test_clear_sameSource', () { | |
| 3895 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3896 // runJUnitTest(__test, __test.test_clear_sameSource); | |
| 3897 // }); | |
| 3898 // _ut.test('test_update_append', () { | |
| 3899 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3900 // runJUnitTest(__test, __test.test_update_append); | |
| 3901 // }); | |
| 3902 // _ut.test('test_update_appendToCachedResult', () { | |
| 3903 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3904 // runJUnitTest(__test, __test.test_update_appendToCachedResult); | |
| 3905 // }); | |
| 3906 // _ut.test('test_update_appendWithNewResolvedUnit', () { | |
| 3907 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3908 // runJUnitTest(__test, __test.test_update_appendWithNewResolvedUnit); | |
| 3909 // }); | |
| 3910 // _ut.test('test_update_appendWithNoNewResolvedUnit', () { | |
| 3911 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3912 // runJUnitTest(__test, __test.test_update_appendWithNoNewResolvedUnit); | |
| 3913 // }); | |
| 3914 // _ut.test('test_update_delete', () { | |
| 3915 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3916 // runJUnitTest(__test, __test.test_update_delete); | |
| 3917 // }); | |
| 3918 // _ut.test('test_update_insert_nonContiguous_after', () { | |
| 3919 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3920 // runJUnitTest(__test, __test.test_update_insert_nonContiguous_after); | |
| 3921 // }); | |
| 3922 // _ut.test('test_update_insert_nonContiguous_before', () { | |
| 3923 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3924 // runJUnitTest(__test, __test.test_update_insert_nonContiguous_before); | |
| 3925 // }); | |
| 3926 // _ut.test('test_update_newSource_entry', () { | |
| 3927 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3928 // runJUnitTest(__test, __test.test_update_newSource_entry); | |
| 3929 // }); | |
| 3930 // _ut.test('test_update_newSource_noEntry', () { | |
| 3931 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3932 // runJUnitTest(__test, __test.test_update_newSource_noEntry); | |
| 3933 // }); | |
| 3934 // _ut.test('test_update_noCache_entry', () { | |
| 3935 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3936 // runJUnitTest(__test, __test.test_update_noCache_entry); | |
| 3937 // }); | |
| 3938 // _ut.test('test_update_noCache_entry_noOldSource_append', () { | |
| 3939 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3940 // runJUnitTest(__test, __test.test_update_noCache_entry_noOldSource_app
end); | |
| 3941 // }); | |
| 3942 // _ut.test('test_update_noCache_entry_noOldSource_delete', () { | |
| 3943 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3944 // runJUnitTest(__test, __test.test_update_noCache_entry_noOldSource_del
ete); | |
| 3945 // }); | |
| 3946 // _ut.test('test_update_noCache_entry_noOldSource_replace', () { | |
| 3947 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3948 // runJUnitTest(__test, __test.test_update_noCache_entry_noOldSource_rep
lace); | |
| 3949 // }); | |
| 3950 // _ut.test('test_update_noCache_noEntry', () { | |
| 3951 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3952 // runJUnitTest(__test, __test.test_update_noCache_noEntry); | |
| 3953 // }); | |
| 3954 // _ut.test('test_update_replace', () { | |
| 3955 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3956 // runJUnitTest(__test, __test.test_update_replace); | |
| 3957 // }); | |
| 3958 // _ut.test('test_verifyStructure_invalidUnit', () { | |
| 3959 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3960 // runJUnitTest(__test, __test.test_verifyStructure_invalidUnit); | |
| 3961 // }); | |
| 3962 // _ut.test('test_verifyStructure_noCache', () { | |
| 3963 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3964 // runJUnitTest(__test, __test.test_verifyStructure_noCache); | |
| 3965 // }); | |
| 3966 // _ut.test('test_verifyStructure_noCacheNoUnit', () { | |
| 3967 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3968 // runJUnitTest(__test, __test.test_verifyStructure_noCacheNoUnit); | |
| 3969 // }); | |
| 3970 // _ut.test('test_verifyStructure_noUnit', () { | |
| 3971 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3972 // runJUnitTest(__test, __test.test_verifyStructure_noUnit); | |
| 3973 // }); | |
| 3974 // _ut.test('test_verifyStructure_otherSource', () { | |
| 3975 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3976 // runJUnitTest(__test, __test.test_verifyStructure_otherSource); | |
| 3977 // }); | |
| 3978 // _ut.test('test_verifyStructure_validUnit', () { | |
| 3979 // final __test = new IncrementalAnalysisCacheTest(); | |
| 3980 // runJUnitTest(__test, __test.test_verifyStructure_validUnit); | |
| 3981 // }); | |
| 3982 // }); | |
| 3983 // } | |
| 3984 // } | |
| 3985 // class IncrementalAnalysisTaskTest extends EngineTestCase { | |
| 3986 // void test_accept() { | |
| 3987 // IncrementalAnalysisTask task = new IncrementalAnalysisTask(null, null); | |
| 3988 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_IncrementalAnaly
sisTaskTest_test_accept())); | |
| 3989 // } | |
| 3990 // void test_perform() { | |
| 3991 // // main() {} String foo; | |
| 3992 // // main() {String} String foo; | |
| 3993 // CompilationUnit newUnit = _assertTask("main() {", "", "String", "} String
foo;"); | |
| 3994 // NodeList<CompilationUnitMember> declarations = newUnit.declarations; | |
| 3995 // FunctionDeclaration main = declarations[0] as FunctionDeclaration; | |
| 3996 // JUnitTestCase.assertEquals("main", main.name.name); | |
| 3997 // BlockFunctionBody body = main.functionExpression.body as BlockFunctionBod
y; | |
| 3998 // ExpressionStatement statement = body.block.statements[0] as ExpressionSta
tement; | |
| 3999 // JUnitTestCase.assertEquals("String;", statement.toSource()); | |
| 4000 // SimpleIdentifier identifier = statement.expression as SimpleIdentifier; | |
| 4001 // JUnitTestCase.assertEquals("String", identifier.name); | |
| 4002 // JUnitTestCase.assertNotNull(identifier.staticElement); | |
| 4003 // TopLevelVariableDeclaration fooDecl = declarations[1] as TopLevelVariable
Declaration; | |
| 4004 // SimpleIdentifier fooName = fooDecl.variables.variables[0].name; | |
| 4005 // JUnitTestCase.assertEquals("foo", fooName.name); | |
| 4006 // JUnitTestCase.assertNotNull(fooName.staticElement); | |
| 4007 // } | |
| 4008 // CompilationUnit _assertTask(String prefix, String removed, String added, St
ring suffix) { | |
| 4009 // String oldCode = EngineTestCase.createSource(["${prefix}${removed}${suffi
x}"]); | |
| 4010 // String newCode = EngineTestCase.createSource(["${prefix}${added}${suffix}
"]); | |
| 4011 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 4012 // Source source = new TestSource.con1(new JavaFile("/test.dart"), oldCode); | |
| 4013 // DartEntryImpl entry = new DartEntryImpl(); | |
| 4014 // CompilationUnit oldUnit = context.resolveCompilationUnit2(source, source)
; | |
| 4015 // JUnitTestCase.assertNotNull(oldUnit); | |
| 4016 // entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source, oldUnit); | |
| 4017 // IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, so
urce, oldCode, newCode, prefix.length, removed.length, added.length, entry); | |
| 4018 // JUnitTestCase.assertNotNull(cache); | |
| 4019 // IncrementalAnalysisTask task = new IncrementalAnalysisTask(context, cache
); | |
| 4020 // CompilationUnit newUnit = task.perform(new TestTaskVisitor_IncrementalAna
lysisTaskTest_assertTask(task)); | |
| 4021 // JUnitTestCase.assertNotNull(newUnit); | |
| 4022 // return newUnit; | |
| 4023 // } | |
| 4024 // static dartSuite() { | |
| 4025 // _ut.group('IncrementalAnalysisTaskTest', () { | |
| 4026 // _ut.test('test_accept', () { | |
| 4027 // final __test = new IncrementalAnalysisTaskTest(); | |
| 4028 // runJUnitTest(__test, __test.test_accept); | |
| 4029 // }); | |
| 4030 // _ut.test('test_perform', () { | |
| 4031 // final __test = new IncrementalAnalysisTaskTest(); | |
| 4032 // runJUnitTest(__test, __test.test_perform); | |
| 4033 // }); | |
| 4034 // }); | |
| 4035 // } | |
| 4036 // } | |
| 4037 // class InstrumentedAnalysisContextImplTest extends EngineTestCase { | |
| 4038 // void test_addSourceInfo() { | |
| 4039 // List<bool> invoked = [false]; | |
| 4040 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_addSo
urceInfo(invoked)); | |
| 4041 // context.addSourceInfo(null, null); | |
| 4042 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4043 // } | |
| 4044 // void test_applyChanges() { | |
| 4045 // List<bool> invoked = [false]; | |
| 4046 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_apply
Changes(invoked)); | |
| 4047 // context.applyChanges(null); | |
| 4048 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4049 // } | |
| 4050 // void test_computeDocumentationComment() { | |
| 4051 // List<bool> invoked = [false]; | |
| 4052 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teDocumentationComment(invoked)); | |
| 4053 // context.computeDocumentationComment(null); | |
| 4054 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4055 // } | |
| 4056 // void test_computeErrors() { | |
| 4057 // List<bool> invoked = [false]; | |
| 4058 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teErrors(invoked)); | |
| 4059 // context.computeErrors(null); | |
| 4060 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4061 // } | |
| 4062 // void test_computeExportedLibraries() { | |
| 4063 // List<bool> invoked = [false]; | |
| 4064 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teExportedLibraries(invoked)); | |
| 4065 // context.computeExportedLibraries(null); | |
| 4066 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4067 // } | |
| 4068 // void test_computeHtmlElement() { | |
| 4069 // List<bool> invoked = [false]; | |
| 4070 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teHtmlElement(invoked)); | |
| 4071 // context.computeHtmlElement(null); | |
| 4072 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4073 // } | |
| 4074 // void test_computeImportedLibraries() { | |
| 4075 // List<bool> invoked = [false]; | |
| 4076 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teImportedLibraries(invoked)); | |
| 4077 // context.computeImportedLibraries(null); | |
| 4078 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4079 // } | |
| 4080 // void test_computeKindOf() { | |
| 4081 // List<bool> invoked = [false]; | |
| 4082 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teKindOf(invoked)); | |
| 4083 // context.computeKindOf(null); | |
| 4084 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4085 // } | |
| 4086 // void test_computeLibraryElement() { | |
| 4087 // List<bool> invoked = [false]; | |
| 4088 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teLibraryElement(invoked)); | |
| 4089 // context.computeLibraryElement(null); | |
| 4090 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4091 // } | |
| 4092 // void test_computeLineInfo() { | |
| 4093 // List<bool> invoked = [false]; | |
| 4094 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teLineInfo(invoked)); | |
| 4095 // context.computeLineInfo(null); | |
| 4096 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4097 // } | |
| 4098 // void test_computeResolvableCompilationUnit() { | |
| 4099 // List<bool> invoked = [false]; | |
| 4100 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_compu
teResolvableCompilationUnit(invoked)); | |
| 4101 // context.computeResolvableCompilationUnit(null); | |
| 4102 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4103 // } | |
| 4104 // void test_creation() { | |
| 4105 // JUnitTestCase.assertNotNull(new InstrumentedAnalysisContextImpl()); | |
| 4106 // } | |
| 4107 // void test_dispose() { | |
| 4108 // List<bool> invoked = [false]; | |
| 4109 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_dispo
se(invoked)); | |
| 4110 // context.dispose(); | |
| 4111 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4112 // } | |
| 4113 // void test_exists() { | |
| 4114 // List<bool> invoked = [false]; | |
| 4115 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_exist
s(invoked)); | |
| 4116 // context.exists(null); | |
| 4117 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4118 // } | |
| 4119 // void test_extractContext() { | |
| 4120 // List<bool> invoked = [false]; | |
| 4121 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_extra
ctContext(invoked)); | |
| 4122 // context.extractContext(null); | |
| 4123 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4124 // } | |
| 4125 // void test_extractContextInto() { | |
| 4126 // List<bool> invoked = [false]; | |
| 4127 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_extra
ctContextInto(invoked)); | |
| 4128 // context.extractContextInto(null, null); | |
| 4129 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4130 // } | |
| 4131 // void test_getAnalysisOptions() { | |
| 4132 // List<bool> invoked = [false]; | |
| 4133 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getAn
alysisOptions(invoked)); | |
| 4134 // context.analysisOptions; | |
| 4135 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4136 // } | |
| 4137 // void test_getAngularApplicationWithHtml() { | |
| 4138 // List<bool> invoked = [false]; | |
| 4139 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getAn
gularApplicationWithHtml(invoked)); | |
| 4140 // context.getAngularApplicationWithHtml(null); | |
| 4141 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4142 // } | |
| 4143 // void test_getCompilationUnitElement() { | |
| 4144 // List<bool> invoked = [false]; | |
| 4145 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getCo
mpilationUnitElement(invoked)); | |
| 4146 // context.getCompilationUnitElement(null, null); | |
| 4147 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4148 // } | |
| 4149 // void test_getContents() { | |
| 4150 // List<bool> invoked = [false]; | |
| 4151 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getCo
ntents(invoked)); | |
| 4152 // context.getContents(null); | |
| 4153 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4154 // } | |
| 4155 // void test_getContentsToReceiver() { | |
| 4156 // List<bool> invoked = [false]; | |
| 4157 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getCo
ntentsToReceiver(invoked)); | |
| 4158 // context.getContentsToReceiver(null, null); | |
| 4159 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4160 // } | |
| 4161 // void test_getElement() { | |
| 4162 // List<bool> invoked = [false]; | |
| 4163 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getEl
ement(invoked)); | |
| 4164 // context.getElement(null); | |
| 4165 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4166 // } | |
| 4167 // void test_getErrors() { | |
| 4168 // List<bool> invoked = [false]; | |
| 4169 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getEr
rors(invoked)); | |
| 4170 // context.getErrors(null); | |
| 4171 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4172 // } | |
| 4173 // void test_getHtmlElement() { | |
| 4174 // List<bool> invoked = [false]; | |
| 4175 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHt
mlElement(invoked)); | |
| 4176 // context.getHtmlElement(null); | |
| 4177 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4178 // } | |
| 4179 // void test_getHtmlFilesReferencing() { | |
| 4180 // List<bool> invoked = [false]; | |
| 4181 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHt
mlFilesReferencing(invoked)); | |
| 4182 // context.getHtmlFilesReferencing(null); | |
| 4183 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4184 // } | |
| 4185 // void test_getHtmlSources() { | |
| 4186 // List<bool> invoked = [false]; | |
| 4187 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHt
mlSources(invoked)); | |
| 4188 // context.htmlSources; | |
| 4189 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4190 // } | |
| 4191 // void test_getKindOf() { | |
| 4192 // List<bool> invoked = [false]; | |
| 4193 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getKi
ndOf(invoked)); | |
| 4194 // context.getKindOf(null); | |
| 4195 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4196 // } | |
| 4197 // void test_getLaunchableClientLibrarySources() { | |
| 4198 // List<bool> invoked = [false]; | |
| 4199 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLa
unchableClientLibrarySources(invoked)); | |
| 4200 // context.launchableClientLibrarySources; | |
| 4201 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4202 // } | |
| 4203 // void test_getLaunchableServerLibrarySources() { | |
| 4204 // List<bool> invoked = [false]; | |
| 4205 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLa
unchableServerLibrarySources(invoked)); | |
| 4206 // context.launchableServerLibrarySources; | |
| 4207 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4208 // } | |
| 4209 // void test_getLibrariesContaining() { | |
| 4210 // List<bool> invoked = [false]; | |
| 4211 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLi
brariesContaining(invoked)); | |
| 4212 // context.getLibrariesContaining(null); | |
| 4213 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4214 // } | |
| 4215 // void test_getLibrariesDependingOn() { | |
| 4216 // List<bool> invoked = [false]; | |
| 4217 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLi
brariesDependingOn(invoked)); | |
| 4218 // context.getLibrariesDependingOn(null); | |
| 4219 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4220 // } | |
| 4221 // void test_getLibrariesReferencedFromHtml() { | |
| 4222 // List<bool> invoked = [false]; | |
| 4223 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLi
brariesReferencedFromHtml(invoked)); | |
| 4224 // context.getLibrariesReferencedFromHtml(null); | |
| 4225 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4226 // } | |
| 4227 // void test_getLibraryElement() { | |
| 4228 // List<bool> invoked = [false]; | |
| 4229 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLi
braryElement(invoked)); | |
| 4230 // context.getLibraryElement(null); | |
| 4231 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4232 // } | |
| 4233 // void test_getLibrarySources() { | |
| 4234 // List<bool> invoked = [false]; | |
| 4235 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLi
brarySources(invoked)); | |
| 4236 // context.librarySources; | |
| 4237 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4238 // } | |
| 4239 // void test_getLineInfo() { | |
| 4240 // List<bool> invoked = [false]; | |
| 4241 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLi
neInfo(invoked)); | |
| 4242 // context.getLineInfo(null); | |
| 4243 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4244 // } | |
| 4245 // void test_getModificationStamp() { | |
| 4246 // List<bool> invoked = [false]; | |
| 4247 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getMo
dificationStamp(invoked)); | |
| 4248 // context.getModificationStamp(null); | |
| 4249 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4250 // } | |
| 4251 // void test_getPublicNamespace() { | |
| 4252 // List<bool> invoked = [false]; | |
| 4253 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getPu
blicNamespace(invoked)); | |
| 4254 // context.getPublicNamespace(null); | |
| 4255 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4256 // } | |
| 4257 // void test_getRefactoringUnsafeSources() { | |
| 4258 // List<bool> invoked = [false]; | |
| 4259 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getRe
factoringUnsafeSources(invoked)); | |
| 4260 // context.refactoringUnsafeSources; | |
| 4261 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4262 // } | |
| 4263 // void test_getResolvedCompilationUnit_element() { | |
| 4264 // List<bool> invoked = [false]; | |
| 4265 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getRe
solvedCompilationUnit_element(invoked)); | |
| 4266 // context.getResolvedCompilationUnit(null, null as LibraryElement); | |
| 4267 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4268 // } | |
| 4269 // void test_getResolvedCompilationUnit_source() { | |
| 4270 // List<bool> invoked = [false]; | |
| 4271 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getRe
solvedCompilationUnit_source(invoked)); | |
| 4272 // context.getResolvedCompilationUnit2(null, null as Source); | |
| 4273 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4274 // } | |
| 4275 // void test_getResolvedHtmlUnit() { | |
| 4276 // List<bool> invoked = [false]; | |
| 4277 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getRe
solvedHtmlUnit(invoked)); | |
| 4278 // context.getResolvedHtmlUnit(null); | |
| 4279 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4280 // } | |
| 4281 // void test_getSourceFactory() { | |
| 4282 // List<bool> invoked = [false]; | |
| 4283 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getSo
urceFactory(invoked)); | |
| 4284 // context.sourceFactory; | |
| 4285 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4286 // } | |
| 4287 // void test_getStatistics() { | |
| 4288 // List<bool> invoked = [false]; | |
| 4289 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getSt
atistics(invoked)); | |
| 4290 // context.statistics; | |
| 4291 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4292 // } | |
| 4293 // void test_getTypeProvider() { | |
| 4294 // List<bool> invoked = [false]; | |
| 4295 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getTy
peProvider(invoked)); | |
| 4296 // context.typeProvider; | |
| 4297 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4298 // } | |
| 4299 // void test_isClientLibrary() { | |
| 4300 // List<bool> invoked = [false]; | |
| 4301 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isCli
entLibrary(invoked)); | |
| 4302 // context.isClientLibrary(null); | |
| 4303 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4304 // } | |
| 4305 // void test_isDisposed() { | |
| 4306 // List<bool> invoked = [false]; | |
| 4307 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isDis
posed(invoked)); | |
| 4308 // context.isDisposed; | |
| 4309 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4310 // } | |
| 4311 // void test_isServerLibrary() { | |
| 4312 // List<bool> invoked = [false]; | |
| 4313 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isSer
verLibrary(invoked)); | |
| 4314 // context.isServerLibrary(null); | |
| 4315 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4316 // } | |
| 4317 // void test_mergeContext() { | |
| 4318 // List<bool> invoked = [false]; | |
| 4319 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_merge
Context(invoked)); | |
| 4320 // context.mergeContext(new InstrumentedAnalysisContextImpl.con1(new TestAna
lysisContext())); | |
| 4321 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4322 // } | |
| 4323 // void test_parseCompilationUnit() { | |
| 4324 // List<bool> invoked = [false]; | |
| 4325 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_parse
CompilationUnit(invoked)); | |
| 4326 // context.parseCompilationUnit(null); | |
| 4327 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4328 // } | |
| 4329 // void test_parseHtmlUnit() { | |
| 4330 // List<bool> invoked = [false]; | |
| 4331 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_parse
HtmlUnit(invoked)); | |
| 4332 // context.parseHtmlUnit(null); | |
| 4333 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4334 // } | |
| 4335 // void test_performAnalysisTask() { | |
| 4336 // List<bool> invoked = [false]; | |
| 4337 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_perfo
rmAnalysisTask(invoked)); | |
| 4338 // context.performAnalysisTask(); | |
| 4339 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4340 // } | |
| 4341 // void test_recordLibraryElements() { | |
| 4342 // List<bool> invoked = [false]; | |
| 4343 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_recor
dLibraryElements(invoked)); | |
| 4344 // context.recordLibraryElements(null); | |
| 4345 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4346 // } | |
| 4347 // void test_resolveCompilationUnit() { | |
| 4348 // List<bool> invoked = [false]; | |
| 4349 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resol
veCompilationUnit(invoked)); | |
| 4350 // context.resolveCompilationUnit2(null, null as Source); | |
| 4351 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4352 // } | |
| 4353 // void test_resolveCompilationUnit_element() { | |
| 4354 // List<bool> invoked = [false]; | |
| 4355 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resol
veCompilationUnit_element(invoked)); | |
| 4356 // context.resolveCompilationUnit(null, null as LibraryElement); | |
| 4357 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4358 // } | |
| 4359 // void test_resolveHtmlUnit() { | |
| 4360 // List<bool> invoked = [false]; | |
| 4361 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resol
veHtmlUnit(invoked)); | |
| 4362 // context.resolveHtmlUnit(null); | |
| 4363 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4364 // } | |
| 4365 // void test_setAnalysisOptions() { | |
| 4366 // List<bool> invoked = [false]; | |
| 4367 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setAn
alysisOptions(invoked)); | |
| 4368 // context.analysisOptions = null; | |
| 4369 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4370 // } | |
| 4371 // void test_setAnalysisPriorityOrder() { | |
| 4372 // List<bool> invoked = [false]; | |
| 4373 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setAn
alysisPriorityOrder(invoked)); | |
| 4374 // context.analysisPriorityOrder = null; | |
| 4375 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4376 // } | |
| 4377 // void test_setChangedContents() { | |
| 4378 // List<bool> invoked = [false]; | |
| 4379 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setCh
angedContents(invoked)); | |
| 4380 // context.setChangedContents(null, null, 0, 0, 0); | |
| 4381 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4382 // } | |
| 4383 // void test_setContents() { | |
| 4384 // List<bool> invoked = [false]; | |
| 4385 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setCo
ntents(invoked)); | |
| 4386 // context.setContents(null, null); | |
| 4387 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4388 // } | |
| 4389 // void test_setSourceFactory() { | |
| 4390 // List<bool> invoked = [false]; | |
| 4391 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContext
Impl.con1(new TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setSo
urceFactory(invoked)); | |
| 4392 // context.sourceFactory = null; | |
| 4393 // JUnitTestCase.assertTrue(invoked[0]); | |
| 4394 // } | |
| 4395 // static dartSuite() { | |
| 4396 // _ut.group('InstrumentedAnalysisContextImplTest', () { | |
| 4397 // _ut.test('test_addSourceInfo', () { | |
| 4398 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4399 // runJUnitTest(__test, __test.test_addSourceInfo); | |
| 4400 // }); | |
| 4401 // _ut.test('test_applyChanges', () { | |
| 4402 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4403 // runJUnitTest(__test, __test.test_applyChanges); | |
| 4404 // }); | |
| 4405 // _ut.test('test_computeDocumentationComment', () { | |
| 4406 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4407 // runJUnitTest(__test, __test.test_computeDocumentationComment); | |
| 4408 // }); | |
| 4409 // _ut.test('test_computeErrors', () { | |
| 4410 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4411 // runJUnitTest(__test, __test.test_computeErrors); | |
| 4412 // }); | |
| 4413 // _ut.test('test_computeExportedLibraries', () { | |
| 4414 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4415 // runJUnitTest(__test, __test.test_computeExportedLibraries); | |
| 4416 // }); | |
| 4417 // _ut.test('test_computeHtmlElement', () { | |
| 4418 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4419 // runJUnitTest(__test, __test.test_computeHtmlElement); | |
| 4420 // }); | |
| 4421 // _ut.test('test_computeImportedLibraries', () { | |
| 4422 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4423 // runJUnitTest(__test, __test.test_computeImportedLibraries); | |
| 4424 // }); | |
| 4425 // _ut.test('test_computeKindOf', () { | |
| 4426 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4427 // runJUnitTest(__test, __test.test_computeKindOf); | |
| 4428 // }); | |
| 4429 // _ut.test('test_computeLibraryElement', () { | |
| 4430 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4431 // runJUnitTest(__test, __test.test_computeLibraryElement); | |
| 4432 // }); | |
| 4433 // _ut.test('test_computeLineInfo', () { | |
| 4434 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4435 // runJUnitTest(__test, __test.test_computeLineInfo); | |
| 4436 // }); | |
| 4437 // _ut.test('test_computeResolvableCompilationUnit', () { | |
| 4438 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4439 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit); | |
| 4440 // }); | |
| 4441 // _ut.test('test_creation', () { | |
| 4442 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4443 // runJUnitTest(__test, __test.test_creation); | |
| 4444 // }); | |
| 4445 // _ut.test('test_dispose', () { | |
| 4446 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4447 // runJUnitTest(__test, __test.test_dispose); | |
| 4448 // }); | |
| 4449 // _ut.test('test_exists', () { | |
| 4450 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4451 // runJUnitTest(__test, __test.test_exists); | |
| 4452 // }); | |
| 4453 // _ut.test('test_extractContext', () { | |
| 4454 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4455 // runJUnitTest(__test, __test.test_extractContext); | |
| 4456 // }); | |
| 4457 // _ut.test('test_extractContextInto', () { | |
| 4458 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4459 // runJUnitTest(__test, __test.test_extractContextInto); | |
| 4460 // }); | |
| 4461 // _ut.test('test_getAnalysisOptions', () { | |
| 4462 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4463 // runJUnitTest(__test, __test.test_getAnalysisOptions); | |
| 4464 // }); | |
| 4465 // _ut.test('test_getAngularApplicationWithHtml', () { | |
| 4466 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4467 // runJUnitTest(__test, __test.test_getAngularApplicationWithHtml); | |
| 4468 // }); | |
| 4469 // _ut.test('test_getCompilationUnitElement', () { | |
| 4470 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4471 // runJUnitTest(__test, __test.test_getCompilationUnitElement); | |
| 4472 // }); | |
| 4473 // _ut.test('test_getContents', () { | |
| 4474 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4475 // runJUnitTest(__test, __test.test_getContents); | |
| 4476 // }); | |
| 4477 // _ut.test('test_getContentsToReceiver', () { | |
| 4478 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4479 // runJUnitTest(__test, __test.test_getContentsToReceiver); | |
| 4480 // }); | |
| 4481 // _ut.test('test_getElement', () { | |
| 4482 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4483 // runJUnitTest(__test, __test.test_getElement); | |
| 4484 // }); | |
| 4485 // _ut.test('test_getErrors', () { | |
| 4486 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4487 // runJUnitTest(__test, __test.test_getErrors); | |
| 4488 // }); | |
| 4489 // _ut.test('test_getHtmlElement', () { | |
| 4490 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4491 // runJUnitTest(__test, __test.test_getHtmlElement); | |
| 4492 // }); | |
| 4493 // _ut.test('test_getHtmlFilesReferencing', () { | |
| 4494 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4495 // runJUnitTest(__test, __test.test_getHtmlFilesReferencing); | |
| 4496 // }); | |
| 4497 // _ut.test('test_getHtmlSources', () { | |
| 4498 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4499 // runJUnitTest(__test, __test.test_getHtmlSources); | |
| 4500 // }); | |
| 4501 // _ut.test('test_getKindOf', () { | |
| 4502 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4503 // runJUnitTest(__test, __test.test_getKindOf); | |
| 4504 // }); | |
| 4505 // _ut.test('test_getLaunchableClientLibrarySources', () { | |
| 4506 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4507 // runJUnitTest(__test, __test.test_getLaunchableClientLibrarySources); | |
| 4508 // }); | |
| 4509 // _ut.test('test_getLaunchableServerLibrarySources', () { | |
| 4510 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4511 // runJUnitTest(__test, __test.test_getLaunchableServerLibrarySources); | |
| 4512 // }); | |
| 4513 // _ut.test('test_getLibrariesContaining', () { | |
| 4514 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4515 // runJUnitTest(__test, __test.test_getLibrariesContaining); | |
| 4516 // }); | |
| 4517 // _ut.test('test_getLibrariesDependingOn', () { | |
| 4518 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4519 // runJUnitTest(__test, __test.test_getLibrariesDependingOn); | |
| 4520 // }); | |
| 4521 // _ut.test('test_getLibrariesReferencedFromHtml', () { | |
| 4522 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4523 // runJUnitTest(__test, __test.test_getLibrariesReferencedFromHtml); | |
| 4524 // }); | |
| 4525 // _ut.test('test_getLibraryElement', () { | |
| 4526 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4527 // runJUnitTest(__test, __test.test_getLibraryElement); | |
| 4528 // }); | |
| 4529 // _ut.test('test_getLibrarySources', () { | |
| 4530 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4531 // runJUnitTest(__test, __test.test_getLibrarySources); | |
| 4532 // }); | |
| 4533 // _ut.test('test_getLineInfo', () { | |
| 4534 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4535 // runJUnitTest(__test, __test.test_getLineInfo); | |
| 4536 // }); | |
| 4537 // _ut.test('test_getModificationStamp', () { | |
| 4538 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4539 // runJUnitTest(__test, __test.test_getModificationStamp); | |
| 4540 // }); | |
| 4541 // _ut.test('test_getPublicNamespace', () { | |
| 4542 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4543 // runJUnitTest(__test, __test.test_getPublicNamespace); | |
| 4544 // }); | |
| 4545 // _ut.test('test_getRefactoringUnsafeSources', () { | |
| 4546 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4547 // runJUnitTest(__test, __test.test_getRefactoringUnsafeSources); | |
| 4548 // }); | |
| 4549 // _ut.test('test_getResolvedCompilationUnit_element', () { | |
| 4550 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4551 // runJUnitTest(__test, __test.test_getResolvedCompilationUnit_element); | |
| 4552 // }); | |
| 4553 // _ut.test('test_getResolvedCompilationUnit_source', () { | |
| 4554 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4555 // runJUnitTest(__test, __test.test_getResolvedCompilationUnit_source); | |
| 4556 // }); | |
| 4557 // _ut.test('test_getResolvedHtmlUnit', () { | |
| 4558 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4559 // runJUnitTest(__test, __test.test_getResolvedHtmlUnit); | |
| 4560 // }); | |
| 4561 // _ut.test('test_getSourceFactory', () { | |
| 4562 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4563 // runJUnitTest(__test, __test.test_getSourceFactory); | |
| 4564 // }); | |
| 4565 // _ut.test('test_getStatistics', () { | |
| 4566 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4567 // runJUnitTest(__test, __test.test_getStatistics); | |
| 4568 // }); | |
| 4569 // _ut.test('test_getTypeProvider', () { | |
| 4570 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4571 // runJUnitTest(__test, __test.test_getTypeProvider); | |
| 4572 // }); | |
| 4573 // _ut.test('test_isClientLibrary', () { | |
| 4574 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4575 // runJUnitTest(__test, __test.test_isClientLibrary); | |
| 4576 // }); | |
| 4577 // _ut.test('test_isDisposed', () { | |
| 4578 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4579 // runJUnitTest(__test, __test.test_isDisposed); | |
| 4580 // }); | |
| 4581 // _ut.test('test_isServerLibrary', () { | |
| 4582 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4583 // runJUnitTest(__test, __test.test_isServerLibrary); | |
| 4584 // }); | |
| 4585 // _ut.test('test_mergeContext', () { | |
| 4586 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4587 // runJUnitTest(__test, __test.test_mergeContext); | |
| 4588 // }); | |
| 4589 // _ut.test('test_parseCompilationUnit', () { | |
| 4590 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4591 // runJUnitTest(__test, __test.test_parseCompilationUnit); | |
| 4592 // }); | |
| 4593 // _ut.test('test_parseHtmlUnit', () { | |
| 4594 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4595 // runJUnitTest(__test, __test.test_parseHtmlUnit); | |
| 4596 // }); | |
| 4597 // _ut.test('test_performAnalysisTask', () { | |
| 4598 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4599 // runJUnitTest(__test, __test.test_performAnalysisTask); | |
| 4600 // }); | |
| 4601 // _ut.test('test_recordLibraryElements', () { | |
| 4602 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4603 // runJUnitTest(__test, __test.test_recordLibraryElements); | |
| 4604 // }); | |
| 4605 // _ut.test('test_resolveCompilationUnit', () { | |
| 4606 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4607 // runJUnitTest(__test, __test.test_resolveCompilationUnit); | |
| 4608 // }); | |
| 4609 // _ut.test('test_resolveCompilationUnit_element', () { | |
| 4610 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4611 // runJUnitTest(__test, __test.test_resolveCompilationUnit_element); | |
| 4612 // }); | |
| 4613 // _ut.test('test_resolveHtmlUnit', () { | |
| 4614 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4615 // runJUnitTest(__test, __test.test_resolveHtmlUnit); | |
| 4616 // }); | |
| 4617 // _ut.test('test_setAnalysisOptions', () { | |
| 4618 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4619 // runJUnitTest(__test, __test.test_setAnalysisOptions); | |
| 4620 // }); | |
| 4621 // _ut.test('test_setAnalysisPriorityOrder', () { | |
| 4622 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4623 // runJUnitTest(__test, __test.test_setAnalysisPriorityOrder); | |
| 4624 // }); | |
| 4625 // _ut.test('test_setChangedContents', () { | |
| 4626 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4627 // runJUnitTest(__test, __test.test_setChangedContents); | |
| 4628 // }); | |
| 4629 // _ut.test('test_setContents', () { | |
| 4630 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4631 // runJUnitTest(__test, __test.test_setContents); | |
| 4632 // }); | |
| 4633 // _ut.test('test_setSourceFactory', () { | |
| 4634 // final __test = new InstrumentedAnalysisContextImplTest(); | |
| 4635 // runJUnitTest(__test, __test.test_setSourceFactory); | |
| 4636 // }); | |
| 4637 // }); | |
| 4638 // } | |
| 4639 // } | |
| 4640 // class ParseDartTaskTest extends EngineTestCase { | |
| 4641 // void test_accept() { | |
| 4642 // ParseDartTask task = new ParseDartTask(null, null, 0, null, null); | |
| 4643 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_ParseDartTaskTes
t_test_accept())); | |
| 4644 // } | |
| 4645 // void test_getCompilationUnit() { | |
| 4646 // ParseDartTask task = new ParseDartTask(null, null, 0, null, null); | |
| 4647 // JUnitTestCase.assertNull(task.compilationUnit); | |
| 4648 // } | |
| 4649 // void test_getErrors() { | |
| 4650 // ParseDartTask task = new ParseDartTask(null, null, 0, null, null); | |
| 4651 // EngineTestCase.assertLength(0, task.errors); | |
| 4652 // } | |
| 4653 // void test_getException() { | |
| 4654 // ParseDartTask task = new ParseDartTask(null, null, 0, null, null); | |
| 4655 // JUnitTestCase.assertNull(task.exception); | |
| 4656 // } | |
| 4657 // void test_getModificationTime() { | |
| 4658 // int modificationTime = 26; | |
| 4659 // ParseDartTask task = new ParseDartTask(null, null, modificationTime, null
, null); | |
| 4660 // JUnitTestCase.assertEquals(modificationTime, task.modificationTime); | |
| 4661 // } | |
| 4662 // void test_getSource() { | |
| 4663 // Source source = new TestSource.con2(""); | |
| 4664 // ParseDartTask task = new ParseDartTask(null, source, 0, null, null); | |
| 4665 // JUnitTestCase.assertSame(source, task.source); | |
| 4666 // } | |
| 4667 // void test_hasNonPartOfDirective() { | |
| 4668 // ParseDartTask task = new ParseDartTask(null, null, 0, null, null); | |
| 4669 // JUnitTestCase.assertFalse(task.hasNonPartOfDirective); | |
| 4670 // } | |
| 4671 // void test_hasPartOfDirective() { | |
| 4672 // ParseDartTask task = new ParseDartTask(null, null, 0, null, null); | |
| 4673 // JUnitTestCase.assertFalse(task.hasPartOfDirective); | |
| 4674 // } | |
| 4675 // void test_perform_exception() { | |
| 4676 // TestSource source = new TestSource(); | |
| 4677 // source.generateExceptionOnRead = true; | |
| 4678 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 4679 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 4680 // ParseDartTask task = new ParseDartTask(context, source, 0, null, null); | |
| 4681 // task.perform(new TestTaskVisitor_ParseDartTaskTest_test_perform_exception
()); | |
| 4682 // } | |
| 4683 // void test_perform_library() { | |
| 4684 // String content = EngineTestCase.createSource([ | |
| 4685 // "library lib;", | |
| 4686 // "import 'lib2.dart';", | |
| 4687 // "export 'lib3.dart';", | |
| 4688 // "part 'part.dart';", | |
| 4689 // "class A {"]); | |
| 4690 // Source source = new TestSource.con2(content); | |
| 4691 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 4692 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 4693 // ParseDartTask task = _createParseTask(context, source, content); | |
| 4694 // task.perform(new TestTaskVisitor_ParseDartTaskTest_test_perform_library(c
ontext, source)); | |
| 4695 // } | |
| 4696 // void test_perform_part() { | |
| 4697 // String content = EngineTestCase.createSource(["part of lib;", "class B {}
"]); | |
| 4698 // Source source = new TestSource.con2(content); | |
| 4699 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 4700 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 4701 // ParseDartTask task = _createParseTask(context, source, content); | |
| 4702 // task.perform(new TestTaskVisitor_ParseDartTaskTest_test_perform_part(cont
ext, source)); | |
| 4703 // } | |
| 4704 // void test_perform_validateDirectives() { | |
| 4705 // String content = EngineTestCase.createSource([ | |
| 4706 // "library lib;", | |
| 4707 // "import '/does/not/exist.dart';", | |
| 4708 // "import 'invaliduri^.dart';", | |
| 4709 // "export '\${a}lib3.dart';", | |
| 4710 // "part 'part.dart';", | |
| 4711 // "class A {}"]); | |
| 4712 // Source source = new TestSource.con2(content); | |
| 4713 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 4714 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 4715 // ParseDartTask task = _createParseTask(context, source, content); | |
| 4716 // task.perform(new TestTaskVisitor_ParseDartTaskTest_test_perform_validateD
irectives(context, source)); | |
| 4717 // } | |
| 4718 // /** | |
| 4719 // * Create and return a task that will parse the given content from the give
n source in the given | |
| 4720 // * context. | |
| 4721 // * | |
| 4722 // * @param context the context to be passed to the task | |
| 4723 // * @param source the source to be parsed | |
| 4724 // * @param content the content of the source to be parsed | |
| 4725 // * @return the task that was created | |
| 4726 // * @throws AnalysisException if the task could not be created | |
| 4727 // */ | |
| 4728 // ParseDartTask _createParseTask(InternalAnalysisContext context, Source sour
ce, String content) { | |
| 4729 // ScanDartTask scanTask = new ScanDartTask(context, source, context.getModi
ficationStamp(source), content); | |
| 4730 // scanTask.perform(new TestTaskVisitor_ParseDartTaskTest_createParseTask())
; | |
| 4731 // return new ParseDartTask(context, source, scanTask.modificationTime, scan
Task.tokenStream, scanTask.lineInfo); | |
| 4732 // } | |
| 4733 // static dartSuite() { | |
| 4734 // _ut.group('ParseDartTaskTest', () { | |
| 4735 // _ut.test('test_accept', () { | |
| 4736 // final __test = new ParseDartTaskTest(); | |
| 4737 // runJUnitTest(__test, __test.test_accept); | |
| 4738 // }); | |
| 4739 // _ut.test('test_getCompilationUnit', () { | |
| 4740 // final __test = new ParseDartTaskTest(); | |
| 4741 // runJUnitTest(__test, __test.test_getCompilationUnit); | |
| 4742 // }); | |
| 4743 // _ut.test('test_getErrors', () { | |
| 4744 // final __test = new ParseDartTaskTest(); | |
| 4745 // runJUnitTest(__test, __test.test_getErrors); | |
| 4746 // }); | |
| 4747 // _ut.test('test_getException', () { | |
| 4748 // final __test = new ParseDartTaskTest(); | |
| 4749 // runJUnitTest(__test, __test.test_getException); | |
| 4750 // }); | |
| 4751 // _ut.test('test_getModificationTime', () { | |
| 4752 // final __test = new ParseDartTaskTest(); | |
| 4753 // runJUnitTest(__test, __test.test_getModificationTime); | |
| 4754 // }); | |
| 4755 // _ut.test('test_getSource', () { | |
| 4756 // final __test = new ParseDartTaskTest(); | |
| 4757 // runJUnitTest(__test, __test.test_getSource); | |
| 4758 // }); | |
| 4759 // _ut.test('test_hasNonPartOfDirective', () { | |
| 4760 // final __test = new ParseDartTaskTest(); | |
| 4761 // runJUnitTest(__test, __test.test_hasNonPartOfDirective); | |
| 4762 // }); | |
| 4763 // _ut.test('test_hasPartOfDirective', () { | |
| 4764 // final __test = new ParseDartTaskTest(); | |
| 4765 // runJUnitTest(__test, __test.test_hasPartOfDirective); | |
| 4766 // }); | |
| 4767 // _ut.test('test_perform_exception', () { | |
| 4768 // final __test = new ParseDartTaskTest(); | |
| 4769 // runJUnitTest(__test, __test.test_perform_exception); | |
| 4770 // }); | |
| 4771 // _ut.test('test_perform_library', () { | |
| 4772 // final __test = new ParseDartTaskTest(); | |
| 4773 // runJUnitTest(__test, __test.test_perform_library); | |
| 4774 // }); | |
| 4775 // _ut.test('test_perform_part', () { | |
| 4776 // final __test = new ParseDartTaskTest(); | |
| 4777 // runJUnitTest(__test, __test.test_perform_part); | |
| 4778 // }); | |
| 4779 // _ut.test('test_perform_validateDirectives', () { | |
| 4780 // final __test = new ParseDartTaskTest(); | |
| 4781 // runJUnitTest(__test, __test.test_perform_validateDirectives); | |
| 4782 // }); | |
| 4783 // }); | |
| 4784 // } | |
| 4785 // } | |
| 4786 // class ParseHtmlTaskTest extends EngineTestCase { | |
| 4787 // void test_accept() { | |
| 4788 // ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); | |
| 4789 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_ParseHtmlTaskTes
t_test_accept())); | |
| 4790 // } | |
| 4791 // void test_getException() { | |
| 4792 // ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); | |
| 4793 // JUnitTestCase.assertNull(task.exception); | |
| 4794 // } | |
| 4795 // void test_getHtmlUnit() { | |
| 4796 // ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); | |
| 4797 // JUnitTestCase.assertNull(task.htmlUnit); | |
| 4798 // } | |
| 4799 // void test_getLineInfo() { | |
| 4800 // ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); | |
| 4801 // JUnitTestCase.assertNull(task.lineInfo); | |
| 4802 // } | |
| 4803 // void test_getReferencedLibraries() { | |
| 4804 // ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); | |
| 4805 // EngineTestCase.assertLength(0, task.referencedLibraries); | |
| 4806 // } | |
| 4807 // void test_getSource() { | |
| 4808 // Source source = new TestSource.con2(""); | |
| 4809 // ParseHtmlTask task = new ParseHtmlTask(null, source, 0, ""); | |
| 4810 // JUnitTestCase.assertSame(source, task.source); | |
| 4811 // } | |
| 4812 // void test_perform_embedded_source() { | |
| 4813 // String contents = EngineTestCase.createSource([ | |
| 4814 // "<html>", | |
| 4815 // "<head>", | |
| 4816 // " <script type='application/dart'>", | |
| 4817 // " void buttonPressed() {}", | |
| 4818 // " </script>", | |
| 4819 // "</head>", | |
| 4820 // "<body>", | |
| 4821 // "</body>", | |
| 4822 // "</html>"]); | |
| 4823 // TestLogger testLogger = new TestLogger(); | |
| 4824 // ParseHtmlTask task = parseContents(contents, testLogger); | |
| 4825 // EngineTestCase.assertLength(0, task.referencedLibraries); | |
| 4826 // JUnitTestCase.assertEquals(0, testLogger.getErrorCount()); | |
| 4827 // JUnitTestCase.assertEquals(0, testLogger.getInfoCount()); | |
| 4828 // } | |
| 4829 // void test_perform_empty_source_reference() { | |
| 4830 // String contents = EngineTestCase.createSource([ | |
| 4831 // "<html>", | |
| 4832 // "<head>", | |
| 4833 // " <script type='application/dart' src=''/>", | |
| 4834 // "</head>", | |
| 4835 // "<body>", | |
| 4836 // "</body>", | |
| 4837 // "</html>"]); | |
| 4838 // TestLogger testLogger = new TestLogger(); | |
| 4839 // ParseHtmlTask task = parseContents(contents, testLogger); | |
| 4840 // EngineTestCase.assertLength(0, task.referencedLibraries); | |
| 4841 // JUnitTestCase.assertEquals(0, testLogger.getErrorCount()); | |
| 4842 // JUnitTestCase.assertEquals(0, testLogger.getInfoCount()); | |
| 4843 // } | |
| 4844 // void test_perform_invalid_source_reference() { | |
| 4845 // String contents = EngineTestCase.createSource([ | |
| 4846 // "<html>", | |
| 4847 // "<head>", | |
| 4848 // " <script type='application/dart' src='an;invalid:[]uri'/>", | |
| 4849 // "</head>", | |
| 4850 // "<body>", | |
| 4851 // "</body>", | |
| 4852 // "</html>"]); | |
| 4853 // TestLogger testLogger = new TestLogger(); | |
| 4854 // ParseHtmlTask task = parseContents(contents, testLogger); | |
| 4855 // EngineTestCase.assertLength(0, task.referencedLibraries); | |
| 4856 // JUnitTestCase.assertEquals(0, testLogger.getErrorCount()); | |
| 4857 // JUnitTestCase.assertEquals(0, testLogger.getInfoCount()); | |
| 4858 // } | |
| 4859 // void test_perform_non_existing_source_reference() { | |
| 4860 // String contents = EngineTestCase.createSource([ | |
| 4861 // "<html>", | |
| 4862 // "<head>", | |
| 4863 // " <script type='application/dart' src='does/not/exist.dart'/>", | |
| 4864 // "</head>", | |
| 4865 // "<body>", | |
| 4866 // "</body>", | |
| 4867 // "</html>"]); | |
| 4868 // TestLogger testLogger = new TestLogger(); | |
| 4869 // ParseHtmlTask task = parseSource(new TestSource_ParseHtmlTaskTest_test_pe
rform_non_existing_source_reference(contents), contents, testLogger); | |
| 4870 // EngineTestCase.assertLength(0, task.referencedLibraries); | |
| 4871 // JUnitTestCase.assertEquals(0, testLogger.getErrorCount()); | |
| 4872 // JUnitTestCase.assertEquals(0, testLogger.getInfoCount()); | |
| 4873 // } | |
| 4874 // void test_perform_referenced_source() { | |
| 4875 // String contents = EngineTestCase.createSource([ | |
| 4876 // "<html>", | |
| 4877 // "<head>", | |
| 4878 // " <script type='application/dart' src='test.dart'/>", | |
| 4879 // "</head>", | |
| 4880 // "<body>", | |
| 4881 // "</body>", | |
| 4882 // "</html>"]); | |
| 4883 // TestLogger testLogger = new TestLogger(); | |
| 4884 // ParseHtmlTask task = parseContents(contents, testLogger); | |
| 4885 // EngineTestCase.assertLength(1, task.referencedLibraries); | |
| 4886 // JUnitTestCase.assertEquals(0, testLogger.getErrorCount()); | |
| 4887 // JUnitTestCase.assertEquals(0, testLogger.getInfoCount()); | |
| 4888 // } | |
| 4889 // ParseHtmlTask parseContents(String contents, TestLogger testLogger) => pars
eSource(new TestSource.con2(contents), contents, testLogger); | |
| 4890 // ParseHtmlTask parseSource(Source source, String contents, TestLogger testLo
gger) { | |
| 4891 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 4892 // context.setContents(source, contents); | |
| 4893 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 4894 // ParseHtmlTask task = new ParseHtmlTask(context, source, context.getModifi
cationStamp(source), contents); | |
| 4895 // Logger oldLogger = AnalysisEngine.instance.logger; | |
| 4896 // try { | |
| 4897 // AnalysisEngine.instance.logger = testLogger; | |
| 4898 // task.perform(new TestTaskVisitor_ParseHtmlTaskTest_parseSource(context,
source)); | |
| 4899 // } finally { | |
| 4900 // AnalysisEngine.instance.logger = oldLogger; | |
| 4901 // } | |
| 4902 // return task; | |
| 4903 // } | |
| 4904 // static dartSuite() { | |
| 4905 // _ut.group('ParseHtmlTaskTest', () { | |
| 4906 // _ut.test('test_accept', () { | |
| 4907 // final __test = new ParseHtmlTaskTest(); | |
| 4908 // runJUnitTest(__test, __test.test_accept); | |
| 4909 // }); | |
| 4910 // _ut.test('test_getException', () { | |
| 4911 // final __test = new ParseHtmlTaskTest(); | |
| 4912 // runJUnitTest(__test, __test.test_getException); | |
| 4913 // }); | |
| 4914 // _ut.test('test_getHtmlUnit', () { | |
| 4915 // final __test = new ParseHtmlTaskTest(); | |
| 4916 // runJUnitTest(__test, __test.test_getHtmlUnit); | |
| 4917 // }); | |
| 4918 // _ut.test('test_getLineInfo', () { | |
| 4919 // final __test = new ParseHtmlTaskTest(); | |
| 4920 // runJUnitTest(__test, __test.test_getLineInfo); | |
| 4921 // }); | |
| 4922 // _ut.test('test_getReferencedLibraries', () { | |
| 4923 // final __test = new ParseHtmlTaskTest(); | |
| 4924 // runJUnitTest(__test, __test.test_getReferencedLibraries); | |
| 4925 // }); | |
| 4926 // _ut.test('test_getSource', () { | |
| 4927 // final __test = new ParseHtmlTaskTest(); | |
| 4928 // runJUnitTest(__test, __test.test_getSource); | |
| 4929 // }); | |
| 4930 // _ut.test('test_perform_embedded_source', () { | |
| 4931 // final __test = new ParseHtmlTaskTest(); | |
| 4932 // runJUnitTest(__test, __test.test_perform_embedded_source); | |
| 4933 // }); | |
| 4934 // _ut.test('test_perform_empty_source_reference', () { | |
| 4935 // final __test = new ParseHtmlTaskTest(); | |
| 4936 // runJUnitTest(__test, __test.test_perform_empty_source_reference); | |
| 4937 // }); | |
| 4938 // _ut.test('test_perform_invalid_source_reference', () { | |
| 4939 // final __test = new ParseHtmlTaskTest(); | |
| 4940 // runJUnitTest(__test, __test.test_perform_invalid_source_reference); | |
| 4941 // }); | |
| 4942 // _ut.test('test_perform_non_existing_source_reference', () { | |
| 4943 // final __test = new ParseHtmlTaskTest(); | |
| 4944 // runJUnitTest(__test, __test.test_perform_non_existing_source_referenc
e); | |
| 4945 // }); | |
| 4946 // _ut.test('test_perform_referenced_source', () { | |
| 4947 // final __test = new ParseHtmlTaskTest(); | |
| 4948 // runJUnitTest(__test, __test.test_perform_referenced_source); | |
| 4949 // }); | |
| 4950 // }); | |
| 4951 // } | |
| 4952 // } | |
| 4953 // class PartitionManagerTest extends EngineTestCase { | |
| 4954 // void test_clearCache() { | |
| 4955 // PartitionManager manager = new PartitionManager(); | |
| 4956 // DartSdk sdk = new MockDartSdk(); | |
| 4957 // SdkCachePartition oldPartition = manager.forSdk(sdk); | |
| 4958 // manager.clearCache(); | |
| 4959 // SdkCachePartition newPartition = manager.forSdk(sdk); | |
| 4960 // JUnitTestCase.assertNotSame(oldPartition, newPartition); | |
| 4961 // } | |
| 4962 // void test_creation() { | |
| 4963 // JUnitTestCase.assertNotNull(new PartitionManager()); | |
| 4964 // } | |
| 4965 // void test_forSdk() { | |
| 4966 // PartitionManager manager = new PartitionManager(); | |
| 4967 // DartSdk sdk1 = new MockDartSdk(); | |
| 4968 // SdkCachePartition partition1 = manager.forSdk(sdk1); | |
| 4969 // JUnitTestCase.assertNotNull(partition1); | |
| 4970 // JUnitTestCase.assertSame(partition1, manager.forSdk(sdk1)); | |
| 4971 // DartSdk sdk2 = new MockDartSdk(); | |
| 4972 // SdkCachePartition partition2 = manager.forSdk(sdk2); | |
| 4973 // JUnitTestCase.assertNotNull(partition2); | |
| 4974 // JUnitTestCase.assertSame(partition2, manager.forSdk(sdk2)); | |
| 4975 // JUnitTestCase.assertNotSame(partition1, partition2); | |
| 4976 // } | |
| 4977 // static dartSuite() { | |
| 4978 // _ut.group('PartitionManagerTest', () { | |
| 4979 // _ut.test('test_clearCache', () { | |
| 4980 // final __test = new PartitionManagerTest(); | |
| 4981 // runJUnitTest(__test, __test.test_clearCache); | |
| 4982 // }); | |
| 4983 // _ut.test('test_creation', () { | |
| 4984 // final __test = new PartitionManagerTest(); | |
| 4985 // runJUnitTest(__test, __test.test_creation); | |
| 4986 // }); | |
| 4987 // _ut.test('test_forSdk', () { | |
| 4988 // final __test = new PartitionManagerTest(); | |
| 4989 // runJUnitTest(__test, __test.test_forSdk); | |
| 4990 // }); | |
| 4991 // }); | |
| 4992 // } | |
| 4993 // } | |
| 4994 // class ResolveDartLibraryTaskTest extends EngineTestCase { | |
| 4995 // void test_accept() { | |
| 4996 // ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null
); | |
| 4997 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_ResolveDartLibra
ryTaskTest_test_accept())); | |
| 4998 // } | |
| 4999 // void test_getException() { | |
| 5000 // ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null
); | |
| 5001 // JUnitTestCase.assertNull(task.exception); | |
| 5002 // } | |
| 5003 // void test_getLibraryResolver() { | |
| 5004 // ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null
); | |
| 5005 // JUnitTestCase.assertNull(task.libraryResolver); | |
| 5006 // } | |
| 5007 // void test_getLibrarySource() { | |
| 5008 // Source source = new TestSource.con2(""); | |
| 5009 // ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, sour
ce); | |
| 5010 // JUnitTestCase.assertSame(source, task.librarySource); | |
| 5011 // } | |
| 5012 // void test_getUnitSource() { | |
| 5013 // Source source = new TestSource.con2(""); | |
| 5014 // ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, source, nu
ll); | |
| 5015 // JUnitTestCase.assertSame(source, task.unitSource); | |
| 5016 // } | |
| 5017 // void test_perform_exception() { | |
| 5018 // TestSource source = new TestSource(); | |
| 5019 // source.generateExceptionOnRead = true; | |
| 5020 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 5021 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 5022 // ResolveDartLibraryTask task = new ResolveDartLibraryTask(context, source,
source); | |
| 5023 // task.perform(new TestTaskVisitor_ResolveDartLibraryTaskTest_test_perform_
exception()); | |
| 5024 // } | |
| 5025 // void test_perform_library() { | |
| 5026 // Source source = new TestSource.con2(EngineTestCase.createSource(["library
lib;", "class A {}"])); | |
| 5027 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 5028 // ResolveDartLibraryTask task = new ResolveDartLibraryTask(context, source,
source); | |
| 5029 // task.perform(new TestTaskVisitor_ResolveDartLibraryTaskTest_test_perform_
library(source)); | |
| 5030 // } | |
| 5031 // static dartSuite() { | |
| 5032 // _ut.group('ResolveDartLibraryTaskTest', () { | |
| 5033 // _ut.test('test_accept', () { | |
| 5034 // final __test = new ResolveDartLibraryTaskTest(); | |
| 5035 // runJUnitTest(__test, __test.test_accept); | |
| 5036 // }); | |
| 5037 // _ut.test('test_getException', () { | |
| 5038 // final __test = new ResolveDartLibraryTaskTest(); | |
| 5039 // runJUnitTest(__test, __test.test_getException); | |
| 5040 // }); | |
| 5041 // _ut.test('test_getLibraryResolver', () { | |
| 5042 // final __test = new ResolveDartLibraryTaskTest(); | |
| 5043 // runJUnitTest(__test, __test.test_getLibraryResolver); | |
| 5044 // }); | |
| 5045 // _ut.test('test_getLibrarySource', () { | |
| 5046 // final __test = new ResolveDartLibraryTaskTest(); | |
| 5047 // runJUnitTest(__test, __test.test_getLibrarySource); | |
| 5048 // }); | |
| 5049 // _ut.test('test_getUnitSource', () { | |
| 5050 // final __test = new ResolveDartLibraryTaskTest(); | |
| 5051 // runJUnitTest(__test, __test.test_getUnitSource); | |
| 5052 // }); | |
| 5053 // _ut.test('test_perform_exception', () { | |
| 5054 // final __test = new ResolveDartLibraryTaskTest(); | |
| 5055 // runJUnitTest(__test, __test.test_perform_exception); | |
| 5056 // }); | |
| 5057 // _ut.test('test_perform_library', () { | |
| 5058 // final __test = new ResolveDartLibraryTaskTest(); | |
| 5059 // runJUnitTest(__test, __test.test_perform_library); | |
| 5060 // }); | |
| 5061 // }); | |
| 5062 // } | |
| 5063 // } | |
| 5064 // class ResolveDartUnitTaskTest extends EngineTestCase { | |
| 5065 // void test_accept() { | |
| 5066 // ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); | |
| 5067 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_ResolveDartUnitT
askTest_test_accept())); | |
| 5068 // } | |
| 5069 // void test_getException() { | |
| 5070 // ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); | |
| 5071 // JUnitTestCase.assertNull(task.exception); | |
| 5072 // } | |
| 5073 // void test_getLibrarySource() { | |
| 5074 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 5075 // LibraryElementImpl element = ElementFactory.library(context, "lib"); | |
| 5076 // Source source = element.source; | |
| 5077 // ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, element); | |
| 5078 // JUnitTestCase.assertSame(source, task.librarySource); | |
| 5079 // } | |
| 5080 // void test_getModificationTime() { | |
| 5081 // ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); | |
| 5082 // JUnitTestCase.assertEquals(-1, task.modificationTime); | |
| 5083 // } | |
| 5084 // void test_getResolvedUnit() { | |
| 5085 // ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); | |
| 5086 // JUnitTestCase.assertNull(task.resolvedUnit); | |
| 5087 // } | |
| 5088 // void test_getSource() { | |
| 5089 // Source source = new TestSource.con2(""); | |
| 5090 // ResolveDartUnitTask task = new ResolveDartUnitTask(null, source, null); | |
| 5091 // JUnitTestCase.assertSame(source, task.source); | |
| 5092 // } | |
| 5093 // void test_perform_exception() { | |
| 5094 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 5095 // LibraryElementImpl element = ElementFactory.library(context, "lib"); | |
| 5096 // TestSource source = new TestSource(); | |
| 5097 // source.generateExceptionOnRead = true; | |
| 5098 // (element.definingCompilationUnit as CompilationUnitElementImpl).source =
source; | |
| 5099 // ResolveDartUnitTask task = new ResolveDartUnitTask(context, source, eleme
nt); | |
| 5100 // task.perform(new TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_exc
eption()); | |
| 5101 // } | |
| 5102 // void test_perform_library() { | |
| 5103 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 5104 // LibraryElementImpl libraryElement = ElementFactory.library(context, "lib"
); | |
| 5105 // CompilationUnitElementImpl unitElement = libraryElement.definingCompilati
onUnit as CompilationUnitElementImpl; | |
| 5106 // ClassElementImpl classElement = ElementFactory.classElement2("A", []); | |
| 5107 // classElement.nameOffset = 19; | |
| 5108 // ConstructorElementImpl constructorElement = ElementFactory.constructorEle
ment2(classElement, null, []); | |
| 5109 // constructorElement.synthetic = true; | |
| 5110 // classElement.constructors = <ConstructorElement> [constructorElement]; | |
| 5111 // unitElement.types = <ClassElement> [classElement]; | |
| 5112 // Source source = unitElement.source; | |
| 5113 // context.setContents(source, EngineTestCase.createSource(["library lib;",
"class A {}"])); | |
| 5114 // ResolveDartUnitTask task = new ResolveDartUnitTask(context, source, libra
ryElement); | |
| 5115 // task.perform(new TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_lib
rary(source, context)); | |
| 5116 // } | |
| 5117 // static dartSuite() { | |
| 5118 // _ut.group('ResolveDartUnitTaskTest', () { | |
| 5119 // _ut.test('test_accept', () { | |
| 5120 // final __test = new ResolveDartUnitTaskTest(); | |
| 5121 // runJUnitTest(__test, __test.test_accept); | |
| 5122 // }); | |
| 5123 // _ut.test('test_getException', () { | |
| 5124 // final __test = new ResolveDartUnitTaskTest(); | |
| 5125 // runJUnitTest(__test, __test.test_getException); | |
| 5126 // }); | |
| 5127 // _ut.test('test_getLibrarySource', () { | |
| 5128 // final __test = new ResolveDartUnitTaskTest(); | |
| 5129 // runJUnitTest(__test, __test.test_getLibrarySource); | |
| 5130 // }); | |
| 5131 // _ut.test('test_getModificationTime', () { | |
| 5132 // final __test = new ResolveDartUnitTaskTest(); | |
| 5133 // runJUnitTest(__test, __test.test_getModificationTime); | |
| 5134 // }); | |
| 5135 // _ut.test('test_getResolvedUnit', () { | |
| 5136 // final __test = new ResolveDartUnitTaskTest(); | |
| 5137 // runJUnitTest(__test, __test.test_getResolvedUnit); | |
| 5138 // }); | |
| 5139 // _ut.test('test_getSource', () { | |
| 5140 // final __test = new ResolveDartUnitTaskTest(); | |
| 5141 // runJUnitTest(__test, __test.test_getSource); | |
| 5142 // }); | |
| 5143 // _ut.test('test_perform_exception', () { | |
| 5144 // final __test = new ResolveDartUnitTaskTest(); | |
| 5145 // runJUnitTest(__test, __test.test_perform_exception); | |
| 5146 // }); | |
| 5147 // _ut.test('test_perform_library', () { | |
| 5148 // final __test = new ResolveDartUnitTaskTest(); | |
| 5149 // runJUnitTest(__test, __test.test_perform_library); | |
| 5150 // }); | |
| 5151 // }); | |
| 5152 // } | |
| 5153 // } | |
| 5154 // class ResolveHtmlTaskTest extends EngineTestCase { | |
| 5155 // void test_accept() { | |
| 5156 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); | |
| 5157 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_ResolveHtmlTaskT
est_test_accept())); | |
| 5158 // } | |
| 5159 // void test_getElement() { | |
| 5160 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); | |
| 5161 // JUnitTestCase.assertNull(task.element); | |
| 5162 // } | |
| 5163 // void test_getException() { | |
| 5164 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); | |
| 5165 // JUnitTestCase.assertNull(task.exception); | |
| 5166 // } | |
| 5167 // void test_getModificationTime() { | |
| 5168 // int modificationTime = 28; | |
| 5169 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, modificationTime,
null); | |
| 5170 // JUnitTestCase.assertEquals(modificationTime, task.modificationTime); | |
| 5171 // } | |
| 5172 // void test_getResolutionErrors() { | |
| 5173 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); | |
| 5174 // EngineTestCase.assertLength(0, task.resolutionErrors); | |
| 5175 // } | |
| 5176 // void test_getSource() { | |
| 5177 // Source source = new TestSource.con2(""); | |
| 5178 // ResolveHtmlTask task = new ResolveHtmlTask(null, source, 0, null); | |
| 5179 // JUnitTestCase.assertSame(source, task.source); | |
| 5180 // } | |
| 5181 // void test_perform_exception() { | |
| 5182 // Source source = new TestSource(); | |
| 5183 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 5184 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 5185 // ResolveHtmlTask task = new ResolveHtmlTask(context, source, 0, null); | |
| 5186 // task.perform(new TestTaskVisitor_ResolveHtmlTaskTest_test_perform_excepti
on()); | |
| 5187 // } | |
| 5188 // void test_perform_valid() { | |
| 5189 // int modificationStamp = 73; | |
| 5190 // String content = EngineTestCase.createSource([ | |
| 5191 // "<html>", | |
| 5192 // "<head>", | |
| 5193 // " <script type='application/dart'>", | |
| 5194 // " void f() { x = 0; }", | |
| 5195 // " </script>", | |
| 5196 // "</head>", | |
| 5197 // "<body>", | |
| 5198 // "</body>", | |
| 5199 // "</html>"]); | |
| 5200 // Source source = new TestSource.con1(FileUtilities2.createFile("/test.html
"), content); | |
| 5201 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(
); | |
| 5202 // ParseHtmlTask parseTask = new ParseHtmlTask(context, source, modification
Stamp, content); | |
| 5203 // parseTask.perform(new TestTaskVisitor_ResolveHtmlTaskTest_test_perform_va
lid_2()); | |
| 5204 // ResolveHtmlTask task = new ResolveHtmlTask(context, source, parseTask.mod
ificationTime, parseTask.htmlUnit); | |
| 5205 // task.perform(new TestTaskVisitor_ResolveHtmlTaskTest_test_perform_valid(m
odificationStamp, source)); | |
| 5206 // } | |
| 5207 // static dartSuite() { | |
| 5208 // _ut.group('ResolveHtmlTaskTest', () { | |
| 5209 // _ut.test('test_accept', () { | |
| 5210 // final __test = new ResolveHtmlTaskTest(); | |
| 5211 // runJUnitTest(__test, __test.test_accept); | |
| 5212 // }); | |
| 5213 // _ut.test('test_getElement', () { | |
| 5214 // final __test = new ResolveHtmlTaskTest(); | |
| 5215 // runJUnitTest(__test, __test.test_getElement); | |
| 5216 // }); | |
| 5217 // _ut.test('test_getException', () { | |
| 5218 // final __test = new ResolveHtmlTaskTest(); | |
| 5219 // runJUnitTest(__test, __test.test_getException); | |
| 5220 // }); | |
| 5221 // _ut.test('test_getModificationTime', () { | |
| 5222 // final __test = new ResolveHtmlTaskTest(); | |
| 5223 // runJUnitTest(__test, __test.test_getModificationTime); | |
| 5224 // }); | |
| 5225 // _ut.test('test_getResolutionErrors', () { | |
| 5226 // final __test = new ResolveHtmlTaskTest(); | |
| 5227 // runJUnitTest(__test, __test.test_getResolutionErrors); | |
| 5228 // }); | |
| 5229 // _ut.test('test_getSource', () { | |
| 5230 // final __test = new ResolveHtmlTaskTest(); | |
| 5231 // runJUnitTest(__test, __test.test_getSource); | |
| 5232 // }); | |
| 5233 // _ut.test('test_perform_exception', () { | |
| 5234 // final __test = new ResolveHtmlTaskTest(); | |
| 5235 // runJUnitTest(__test, __test.test_perform_exception); | |
| 5236 // }); | |
| 5237 // _ut.test('test_perform_valid', () { | |
| 5238 // final __test = new ResolveHtmlTaskTest(); | |
| 5239 // runJUnitTest(__test, __test.test_perform_valid); | |
| 5240 // }); | |
| 5241 // }); | |
| 5242 // } | |
| 5243 // } | |
| 5244 // class ScanDartTaskTest extends EngineTestCase { | |
| 5245 // void test_accept() { | |
| 5246 // ScanDartTask task = new ScanDartTask(null, null, 0, null); | |
| 5247 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_ScanDartTaskTest
_test_accept())); | |
| 5248 // } | |
| 5249 // void test_getErrors() { | |
| 5250 // ScanDartTask task = new ScanDartTask(null, null, 0, null); | |
| 5251 // EngineTestCase.assertLength(0, task.errors); | |
| 5252 // } | |
| 5253 // void test_getException() { | |
| 5254 // ScanDartTask task = new ScanDartTask(null, null, 0, null); | |
| 5255 // JUnitTestCase.assertNull(task.exception); | |
| 5256 // } | |
| 5257 // void test_getLineInfo() { | |
| 5258 // ScanDartTask task = new ScanDartTask(null, null, 0, null); | |
| 5259 // JUnitTestCase.assertNull(task.lineInfo); | |
| 5260 // } | |
| 5261 // void test_getModificationTime() { | |
| 5262 // ScanDartTask task = new ScanDartTask(null, null, 0, null); | |
| 5263 // JUnitTestCase.assertEquals(0, task.modificationTime); | |
| 5264 // } | |
| 5265 // void test_getSource() { | |
| 5266 // Source source = new TestSource.con2(""); | |
| 5267 // ScanDartTask task = new ScanDartTask(null, source, 0, null); | |
| 5268 // JUnitTestCase.assertSame(source, task.source); | |
| 5269 // } | |
| 5270 // void test_perform_valid() { | |
| 5271 // String content = EngineTestCase.createSource(["class A {}"]); | |
| 5272 // Source source = new TestSource.con2(content); | |
| 5273 // InternalAnalysisContext context = new AnalysisContextImpl(); | |
| 5274 // context.sourceFactory = new SourceFactory([new FileUriResolver()]); | |
| 5275 // ScanDartTask task = new ScanDartTask(context, source, source.modification
Stamp, content); | |
| 5276 // task.perform(new TestTaskVisitor_ScanDartTaskTest_test_perform_valid(cont
ext, source)); | |
| 5277 // } | |
| 5278 // static dartSuite() { | |
| 5279 // _ut.group('ScanDartTaskTest', () { | |
| 5280 // _ut.test('test_accept', () { | |
| 5281 // final __test = new ScanDartTaskTest(); | |
| 5282 // runJUnitTest(__test, __test.test_accept); | |
| 5283 // }); | |
| 5284 // _ut.test('test_getErrors', () { | |
| 5285 // final __test = new ScanDartTaskTest(); | |
| 5286 // runJUnitTest(__test, __test.test_getErrors); | |
| 5287 // }); | |
| 5288 // _ut.test('test_getException', () { | |
| 5289 // final __test = new ScanDartTaskTest(); | |
| 5290 // runJUnitTest(__test, __test.test_getException); | |
| 5291 // }); | |
| 5292 // _ut.test('test_getLineInfo', () { | |
| 5293 // final __test = new ScanDartTaskTest(); | |
| 5294 // runJUnitTest(__test, __test.test_getLineInfo); | |
| 5295 // }); | |
| 5296 // _ut.test('test_getModificationTime', () { | |
| 5297 // final __test = new ScanDartTaskTest(); | |
| 5298 // runJUnitTest(__test, __test.test_getModificationTime); | |
| 5299 // }); | |
| 5300 // _ut.test('test_getSource', () { | |
| 5301 // final __test = new ScanDartTaskTest(); | |
| 5302 // runJUnitTest(__test, __test.test_getSource); | |
| 5303 // }); | |
| 5304 // _ut.test('test_perform_valid', () { | |
| 5305 // final __test = new ScanDartTaskTest(); | |
| 5306 // runJUnitTest(__test, __test.test_perform_valid); | |
| 5307 // }); | |
| 5308 // }); | |
| 5309 // } | |
| 5310 // } | |
| 5311 // class SdkCachePartitionTest extends EngineTestCase { | |
| 5312 // void test_contains_false() { | |
| 5313 // SdkCachePartition partition = new SdkCachePartition(null, 8); | |
| 5314 // Source source = new TestSource(); | |
| 5315 // JUnitTestCase.assertFalse(partition.contains(source)); | |
| 5316 // } | |
| 5317 // void test_contains_true() { | |
| 5318 // SdkCachePartition partition = new SdkCachePartition(null, 8); | |
| 5319 // SourceFactory factory = new SourceFactory([new DartUriResolver(DirectoryB
asedDartSdk.defaultSdk)]); | |
| 5320 // Source source = factory.forUri("dart:core"); | |
| 5321 // JUnitTestCase.assertTrue(partition.contains(source)); | |
| 5322 // } | |
| 5323 // void test_creation() { | |
| 5324 // JUnitTestCase.assertNotNull(new SdkCachePartition(null, 8)); | |
| 5325 // } | |
| 5326 // static dartSuite() { | |
| 5327 // _ut.group('SdkCachePartitionTest', () { | |
| 5328 // _ut.test('test_contains_false', () { | |
| 5329 // final __test = new SdkCachePartitionTest(); | |
| 5330 // runJUnitTest(__test, __test.test_contains_false); | |
| 5331 // }); | |
| 5332 // _ut.test('test_contains_true', () { | |
| 5333 // final __test = new SdkCachePartitionTest(); | |
| 5334 // runJUnitTest(__test, __test.test_contains_true); | |
| 5335 // }); | |
| 5336 // _ut.test('test_creation', () { | |
| 5337 // final __test = new SdkCachePartitionTest(); | |
| 5338 // runJUnitTest(__test, __test.test_creation); | |
| 5339 // }); | |
| 5340 // }); | |
| 5341 // } | |
| 5342 // } | |
| 5343 // class SourceContainer_AnalysisContextImplTest_test_applyChanges_removeContain
er implements SourceContainer { | |
| 5344 // Source libB; | |
| 5345 // SourceContainer_AnalysisContextImplTest_test_applyChanges_removeContainer(t
his.libB); | |
| 5346 // @override | |
| 5347 // bool contains(Source source) => source == libB; | |
| 5348 // } | |
| 5349 // /** | |
| 5350 // * Instances of the class `TestAnalysisContext` implement an analysis context
in which every | |
| 5351 // * method will cause a test to fail when invoked. | |
| 5352 // */ | |
| 5353 // class TestAnalysisContext implements InternalAnalysisContext { | |
| 5354 // @override | |
| 5355 // void addListener(AnalysisListener listener) { | |
| 5356 // JUnitTestCase.fail("Unexpected invocation of addListener"); | |
| 5357 // } | |
| 5358 // @override | |
| 5359 // void addSourceInfo(Source source, SourceEntry info) { | |
| 5360 // JUnitTestCase.fail("Unexpected invocation of addSourceInfo"); | |
| 5361 // } | |
| 5362 // @override | |
| 5363 // void applyAnalysisDelta(AnalysisDelta delta) { | |
| 5364 // JUnitTestCase.fail("Unexpected invocation of applyAnalysisDelta"); | |
| 5365 // } | |
| 5366 // @override | |
| 5367 // void applyChanges(ChangeSet changeSet) { | |
| 5368 // JUnitTestCase.fail("Unexpected invocation of applyChanges"); | |
| 5369 // } | |
| 5370 // @override | |
| 5371 // String computeDocumentationComment(Element element) { | |
| 5372 // JUnitTestCase.fail("Unexpected invocation of computeDocumentationComment"
); | |
| 5373 // return null; | |
| 5374 // } | |
| 5375 // @override | |
| 5376 // List<AnalysisError> computeErrors(Source source) { | |
| 5377 // JUnitTestCase.fail("Unexpected invocation of computeErrors"); | |
| 5378 // return null; | |
| 5379 // } | |
| 5380 // @override | |
| 5381 // List<Source> computeExportedLibraries(Source source) { | |
| 5382 // JUnitTestCase.fail("Unexpected invocation of computeExportedLibraries"); | |
| 5383 // return null; | |
| 5384 // } | |
| 5385 // @override | |
| 5386 // HtmlElement computeHtmlElement(Source source) { | |
| 5387 // JUnitTestCase.fail("Unexpected invocation of computeHtmlElement"); | |
| 5388 // return null; | |
| 5389 // } | |
| 5390 // @override | |
| 5391 // List<Source> computeImportedLibraries(Source source) { | |
| 5392 // JUnitTestCase.fail("Unexpected invocation of computeImportedLibraries"); | |
| 5393 // return null; | |
| 5394 // } | |
| 5395 // @override | |
| 5396 // SourceKind computeKindOf(Source source) { | |
| 5397 // JUnitTestCase.fail("Unexpected invocation of computeKindOf"); | |
| 5398 // return null; | |
| 5399 // } | |
| 5400 // @override | |
| 5401 // LibraryElement computeLibraryElement(Source source) { | |
| 5402 // JUnitTestCase.fail("Unexpected invocation of computeLibraryElement"); | |
| 5403 // return null; | |
| 5404 // } | |
| 5405 // @override | |
| 5406 // LineInfo computeLineInfo(Source source) { | |
| 5407 // JUnitTestCase.fail("Unexpected invocation of computeLineInfo"); | |
| 5408 // return null; | |
| 5409 // } | |
| 5410 // @override | |
| 5411 // ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { | |
| 5412 // JUnitTestCase.fail("Unexpected invocation of computeResolvableCompilation
Unit"); | |
| 5413 // return null; | |
| 5414 // } | |
| 5415 // @override | |
| 5416 // void dispose() { | |
| 5417 // JUnitTestCase.fail("Unexpected invocation of dispose"); | |
| 5418 // } | |
| 5419 // @override | |
| 5420 // bool exists(Source source) { | |
| 5421 // JUnitTestCase.fail("Unexpected invocation of exists"); | |
| 5422 // return false; | |
| 5423 // } | |
| 5424 // @override | |
| 5425 // AnalysisContext extractContext(SourceContainer container) { | |
| 5426 // JUnitTestCase.fail("Unexpected invocation of extractContext"); | |
| 5427 // return null; | |
| 5428 // } | |
| 5429 // @override | |
| 5430 // InternalAnalysisContext extractContextInto(SourceContainer container, Inter
nalAnalysisContext newContext) { | |
| 5431 // JUnitTestCase.fail("Unexpected invocation of extractContextInto"); | |
| 5432 // return null; | |
| 5433 // } | |
| 5434 // @override | |
| 5435 // AnalysisOptions get analysisOptions { | |
| 5436 // JUnitTestCase.fail("Unexpected invocation of getAnalysisOptions"); | |
| 5437 // return null; | |
| 5438 // } | |
| 5439 // @override | |
| 5440 // AngularApplication getAngularApplicationWithHtml(Source htmlSource) { | |
| 5441 // JUnitTestCase.fail("Unexpected invocation of getAngularApplicationWithHtm
l"); | |
| 5442 // return null; | |
| 5443 // } | |
| 5444 // @override | |
| 5445 // CompilationUnitElement getCompilationUnitElement(Source unitSource, Source
librarySource) { | |
| 5446 // JUnitTestCase.fail("Unexpected invocation of getCompilationUnitElement"); | |
| 5447 // return null; | |
| 5448 // } | |
| 5449 // @override | |
| 5450 // TimestampedData<String> getContents(Source source) { | |
| 5451 // JUnitTestCase.fail("Unexpected invocation of getContents"); | |
| 5452 // return null; | |
| 5453 // } | |
| 5454 // @override | |
| 5455 // void getContentsToReceiver(Source source, Source_ContentReceiver receiver)
{ | |
| 5456 // JUnitTestCase.fail("Unexpected invocation of getContentsToReceiver"); | |
| 5457 // } | |
| 5458 // @override | |
| 5459 // InternalAnalysisContext getContextFor(Source source) { | |
| 5460 // JUnitTestCase.fail("Unexpected invocation of getContextFor"); | |
| 5461 // return null; | |
| 5462 // } | |
| 5463 // @override | |
| 5464 // DeclaredVariables get declaredVariables { | |
| 5465 // JUnitTestCase.fail("Unexpected invocation of getDeclaredVariables"); | |
| 5466 // return null; | |
| 5467 // } | |
| 5468 // @override | |
| 5469 // Element getElement(ElementLocation location) { | |
| 5470 // JUnitTestCase.fail("Unexpected invocation of getElement"); | |
| 5471 // return null; | |
| 5472 // } | |
| 5473 // @override | |
| 5474 // AnalysisErrorInfo getErrors(Source source) { | |
| 5475 // JUnitTestCase.fail("Unexpected invocation of getErrors"); | |
| 5476 // return null; | |
| 5477 // } | |
| 5478 // @override | |
| 5479 // HtmlElement getHtmlElement(Source source) { | |
| 5480 // JUnitTestCase.fail("Unexpected invocation of getHtmlElement"); | |
| 5481 // return null; | |
| 5482 // } | |
| 5483 // @override | |
| 5484 // List<Source> getHtmlFilesReferencing(Source source) { | |
| 5485 // JUnitTestCase.fail("Unexpected invocation of getHtmlFilesReferencing"); | |
| 5486 // return null; | |
| 5487 // } | |
| 5488 // @override | |
| 5489 // List<Source> get htmlSources { | |
| 5490 // JUnitTestCase.fail("Unexpected invocation of getHtmlSources"); | |
| 5491 // return null; | |
| 5492 // } | |
| 5493 // @override | |
| 5494 // SourceKind getKindOf(Source source) { | |
| 5495 // JUnitTestCase.fail("Unexpected invocation of getKindOf"); | |
| 5496 // return null; | |
| 5497 // } | |
| 5498 // @override | |
| 5499 // List<Source> get launchableClientLibrarySources { | |
| 5500 // JUnitTestCase.fail("Unexpected invocation of getLaunchableClientLibrarySo
urces"); | |
| 5501 // return null; | |
| 5502 // } | |
| 5503 // @override | |
| 5504 // List<Source> get launchableServerLibrarySources { | |
| 5505 // JUnitTestCase.fail("Unexpected invocation of getLaunchableServerLibrarySo
urces"); | |
| 5506 // return null; | |
| 5507 // } | |
| 5508 // @override | |
| 5509 // List<Source> getLibrariesContaining(Source source) { | |
| 5510 // JUnitTestCase.fail("Unexpected invocation of getLibrariesContaining"); | |
| 5511 // return null; | |
| 5512 // } | |
| 5513 // @override | |
| 5514 // List<Source> getLibrariesDependingOn(Source librarySource) { | |
| 5515 // JUnitTestCase.fail("Unexpected invocation of getLibrariesDependingOn"); | |
| 5516 // return null; | |
| 5517 // } | |
| 5518 // @override | |
| 5519 // List<Source> getLibrariesReferencedFromHtml(Source htmlSource) { | |
| 5520 // JUnitTestCase.fail("Unexpected invocation of getLibrariesReferencedFromHt
ml"); | |
| 5521 // return null; | |
| 5522 // } | |
| 5523 // @override | |
| 5524 // LibraryElement getLibraryElement(Source source) { | |
| 5525 // JUnitTestCase.fail("Unexpected invocation of getLibraryElement"); | |
| 5526 // return null; | |
| 5527 // } | |
| 5528 // @override | |
| 5529 // List<Source> get librarySources { | |
| 5530 // JUnitTestCase.fail("Unexpected invocation of getLibrarySources"); | |
| 5531 // return null; | |
| 5532 // } | |
| 5533 // @override | |
| 5534 // LineInfo getLineInfo(Source source) { | |
| 5535 // JUnitTestCase.fail("Unexpected invocation of getLineInfo"); | |
| 5536 // return null; | |
| 5537 // } | |
| 5538 // @override | |
| 5539 // int getModificationStamp(Source source) { | |
| 5540 // JUnitTestCase.fail("Unexpected invocation of getModificationStamp"); | |
| 5541 // return 0; | |
| 5542 // } | |
| 5543 // @override | |
| 5544 // List<Source> get prioritySources { | |
| 5545 // JUnitTestCase.fail("Unexpected invocation of getPrioritySources"); | |
| 5546 // return null; | |
| 5547 // } | |
| 5548 // @override | |
| 5549 // Namespace getPublicNamespace(LibraryElement library) { | |
| 5550 // JUnitTestCase.fail("Unexpected invocation of getPublicNamespace"); | |
| 5551 // return null; | |
| 5552 // } | |
| 5553 // @override | |
| 5554 // List<Source> get refactoringUnsafeSources { | |
| 5555 // JUnitTestCase.fail("Unexpected invocation of getRefactoringUnsafeSources"
); | |
| 5556 // return null; | |
| 5557 // } | |
| 5558 // @override | |
| 5559 // CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElemen
t library) { | |
| 5560 // JUnitTestCase.fail("Unexpected invocation of getResolvedCompilationUnit")
; | |
| 5561 // return null; | |
| 5562 // } | |
| 5563 // @override | |
| 5564 // CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libra
rySource) { | |
| 5565 // JUnitTestCase.fail("Unexpected invocation of getResolvedCompilationUnit")
; | |
| 5566 // return null; | |
| 5567 // } | |
| 5568 // @override | |
| 5569 // HtmlUnit getResolvedHtmlUnit(Source htmlSource) { | |
| 5570 // JUnitTestCase.fail("Unexpected invocation of getResolvedHtmlUnit"); | |
| 5571 // return null; | |
| 5572 // } | |
| 5573 // @override | |
| 5574 // SourceFactory get sourceFactory { | |
| 5575 // JUnitTestCase.fail("Unexpected invocation of getSourceFactory"); | |
| 5576 // return null; | |
| 5577 // } | |
| 5578 // @override | |
| 5579 // AnalysisContextStatistics get statistics { | |
| 5580 // JUnitTestCase.fail("Unexpected invocation of getStatistics"); | |
| 5581 // return null; | |
| 5582 // } | |
| 5583 // @override | |
| 5584 // TypeProvider get typeProvider { | |
| 5585 // JUnitTestCase.fail("Unexpected invocation of getTypeProvider"); | |
| 5586 // return null; | |
| 5587 // } | |
| 5588 // @override | |
| 5589 // bool isClientLibrary(Source librarySource) { | |
| 5590 // JUnitTestCase.fail("Unexpected invocation of isClientLibrary"); | |
| 5591 // return false; | |
| 5592 // } | |
| 5593 // @override | |
| 5594 // bool get isDisposed { | |
| 5595 // JUnitTestCase.fail("Unexpected invocation of isDisposed"); | |
| 5596 // return false; | |
| 5597 // } | |
| 5598 // @override | |
| 5599 // bool isServerLibrary(Source librarySource) { | |
| 5600 // JUnitTestCase.fail("Unexpected invocation of isServerLibrary"); | |
| 5601 // return false; | |
| 5602 // } | |
| 5603 // @override | |
| 5604 // void mergeContext(AnalysisContext context) { | |
| 5605 // JUnitTestCase.fail("Unexpected invocation of mergeContext"); | |
| 5606 // } | |
| 5607 // @override | |
| 5608 // CompilationUnit parseCompilationUnit(Source source) { | |
| 5609 // JUnitTestCase.fail("Unexpected invocation of parseCompilationUnit"); | |
| 5610 // return null; | |
| 5611 // } | |
| 5612 // @override | |
| 5613 // HtmlUnit parseHtmlUnit(Source source) { | |
| 5614 // JUnitTestCase.fail("Unexpected invocation of parseHtmlUnit"); | |
| 5615 // return null; | |
| 5616 // } | |
| 5617 // @override | |
| 5618 // AnalysisResult performAnalysisTask() { | |
| 5619 // JUnitTestCase.fail("Unexpected invocation of performAnalysisTask"); | |
| 5620 // return null; | |
| 5621 // } | |
| 5622 // @override | |
| 5623 // void recordLibraryElements(Map<Source, LibraryElement> elementMap) { | |
| 5624 // JUnitTestCase.fail("Unexpected invocation of recordLibraryElements"); | |
| 5625 // } | |
| 5626 // @override | |
| 5627 // void removeListener(AnalysisListener listener) { | |
| 5628 // JUnitTestCase.fail("Unexpected invocation of removeListener"); | |
| 5629 // } | |
| 5630 // @override | |
| 5631 // CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement li
brary) { | |
| 5632 // JUnitTestCase.fail("Unexpected invocation of resolveCompilationUnit"); | |
| 5633 // return null; | |
| 5634 // } | |
| 5635 // @override | |
| 5636 // CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySo
urce) { | |
| 5637 // JUnitTestCase.fail("Unexpected invocation of resolveCompilationUnit"); | |
| 5638 // return null; | |
| 5639 // } | |
| 5640 // @override | |
| 5641 // HtmlUnit resolveHtmlUnit(Source htmlSource) { | |
| 5642 // JUnitTestCase.fail("Unexpected invocation of resolveHtmlUnit"); | |
| 5643 // return null; | |
| 5644 // } | |
| 5645 // @override | |
| 5646 // void set analysisOptions(AnalysisOptions options) { | |
| 5647 // JUnitTestCase.fail("Unexpected invocation of setAnalysisOptions"); | |
| 5648 // } | |
| 5649 // @override | |
| 5650 // void set analysisPriorityOrder(List<Source> sources) { | |
| 5651 // JUnitTestCase.fail("Unexpected invocation of setAnalysisPriorityOrder"); | |
| 5652 // } | |
| 5653 // @override | |
| 5654 // void setChangedContents(Source source, String contents, int offset, int old
Length, int newLength) { | |
| 5655 // JUnitTestCase.fail("Unexpected invocation of setChangedContents"); | |
| 5656 // } | |
| 5657 // @override | |
| 5658 // void setContents(Source source, String contents) { | |
| 5659 // JUnitTestCase.fail("Unexpected invocation of setContents"); | |
| 5660 // } | |
| 5661 // @override | |
| 5662 // void set sourceFactory(SourceFactory factory) { | |
| 5663 // JUnitTestCase.fail("Unexpected invocation of setSourceFactory"); | |
| 5664 // } | |
| 5665 // } | |
| 5666 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_addSourceI
nfo extends TestAnalysisContext { | |
| 5667 // List<bool> invoked; | |
| 5668 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_addSourceInfo(
this.invoked) : super(); | |
| 5669 // @override | |
| 5670 // void addSourceInfo(Source source, SourceEntry info) { | |
| 5671 // invoked[0] = true; | |
| 5672 // } | |
| 5673 // } | |
| 5674 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_applyChang
es extends TestAnalysisContext { | |
| 5675 // List<bool> invoked; | |
| 5676 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_applyChanges(t
his.invoked) : super(); | |
| 5677 // @override | |
| 5678 // void applyChanges(ChangeSet changeSet) { | |
| 5679 // invoked[0] = true; | |
| 5680 // } | |
| 5681 // } | |
| 5682 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeDoc
umentationComment extends TestAnalysisContext { | |
| 5683 // List<bool> invoked; | |
| 5684 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeDocumen
tationComment(this.invoked) : super(); | |
| 5685 // @override | |
| 5686 // String computeDocumentationComment(Element element) { | |
| 5687 // invoked[0] = true; | |
| 5688 // return null; | |
| 5689 // } | |
| 5690 // } | |
| 5691 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeErr
ors extends TestAnalysisContext { | |
| 5692 // List<bool> invoked; | |
| 5693 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeErrors(
this.invoked) : super(); | |
| 5694 // @override | |
| 5695 // List<AnalysisError> computeErrors(Source source) { | |
| 5696 // invoked[0] = true; | |
| 5697 // return AnalysisError.NO_ERRORS; | |
| 5698 // } | |
| 5699 // } | |
| 5700 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeExp
ortedLibraries extends TestAnalysisContext { | |
| 5701 // List<bool> invoked; | |
| 5702 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeExporte
dLibraries(this.invoked) : super(); | |
| 5703 // @override | |
| 5704 // List<Source> computeExportedLibraries(Source source) { | |
| 5705 // invoked[0] = true; | |
| 5706 // return null; | |
| 5707 // } | |
| 5708 // } | |
| 5709 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeHtm
lElement extends TestAnalysisContext { | |
| 5710 // List<bool> invoked; | |
| 5711 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeHtmlEle
ment(this.invoked) : super(); | |
| 5712 // @override | |
| 5713 // HtmlElement computeHtmlElement(Source source) { | |
| 5714 // invoked[0] = true; | |
| 5715 // return null; | |
| 5716 // } | |
| 5717 // } | |
| 5718 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeImp
ortedLibraries extends TestAnalysisContext { | |
| 5719 // List<bool> invoked; | |
| 5720 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeImporte
dLibraries(this.invoked) : super(); | |
| 5721 // @override | |
| 5722 // List<Source> computeImportedLibraries(Source source) { | |
| 5723 // invoked[0] = true; | |
| 5724 // return null; | |
| 5725 // } | |
| 5726 // } | |
| 5727 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeKin
dOf extends TestAnalysisContext { | |
| 5728 // List<bool> invoked; | |
| 5729 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeKindOf(
this.invoked) : super(); | |
| 5730 // @override | |
| 5731 // SourceKind computeKindOf(Source source) { | |
| 5732 // invoked[0] = true; | |
| 5733 // return null; | |
| 5734 // } | |
| 5735 // } | |
| 5736 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeLib
raryElement extends TestAnalysisContext { | |
| 5737 // List<bool> invoked; | |
| 5738 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeLibrary
Element(this.invoked) : super(); | |
| 5739 // @override | |
| 5740 // LibraryElement computeLibraryElement(Source source) { | |
| 5741 // invoked[0] = true; | |
| 5742 // return null; | |
| 5743 // } | |
| 5744 // } | |
| 5745 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeLin
eInfo extends TestAnalysisContext { | |
| 5746 // List<bool> invoked; | |
| 5747 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeLineInf
o(this.invoked) : super(); | |
| 5748 // @override | |
| 5749 // LineInfo computeLineInfo(Source source) { | |
| 5750 // invoked[0] = true; | |
| 5751 // return null; | |
| 5752 // } | |
| 5753 // } | |
| 5754 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeRes
olvableCompilationUnit extends TestAnalysisContext { | |
| 5755 // List<bool> invoked; | |
| 5756 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_computeResolva
bleCompilationUnit(this.invoked) : super(); | |
| 5757 // @override | |
| 5758 // ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { | |
| 5759 // invoked[0] = true; | |
| 5760 // return null; | |
| 5761 // } | |
| 5762 // } | |
| 5763 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_dispose ex
tends TestAnalysisContext { | |
| 5764 // List<bool> invoked; | |
| 5765 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_dispose(this.i
nvoked) : super(); | |
| 5766 // @override | |
| 5767 // void dispose() { | |
| 5768 // invoked[0] = true; | |
| 5769 // } | |
| 5770 // } | |
| 5771 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_exists ext
ends TestAnalysisContext { | |
| 5772 // List<bool> invoked; | |
| 5773 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_exists(this.in
voked) : super(); | |
| 5774 // @override | |
| 5775 // bool exists(Source source) { | |
| 5776 // invoked[0] = true; | |
| 5777 // return false; | |
| 5778 // } | |
| 5779 // } | |
| 5780 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_extractCon
text extends TestAnalysisContext { | |
| 5781 // List<bool> invoked; | |
| 5782 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_extractContext
(this.invoked) : super(); | |
| 5783 // @override | |
| 5784 // InternalAnalysisContext extractContextInto(SourceContainer container, Inter
nalAnalysisContext newContext) { | |
| 5785 // invoked[0] = true; | |
| 5786 // return null; | |
| 5787 // } | |
| 5788 // } | |
| 5789 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_extractCon
textInto extends TestAnalysisContext { | |
| 5790 // List<bool> invoked; | |
| 5791 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_extractContext
Into(this.invoked) : super(); | |
| 5792 // @override | |
| 5793 // InternalAnalysisContext extractContextInto(SourceContainer container, Inter
nalAnalysisContext newContext) { | |
| 5794 // invoked[0] = true; | |
| 5795 // return null; | |
| 5796 // } | |
| 5797 // } | |
| 5798 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getAnalysi
sOptions extends TestAnalysisContext { | |
| 5799 // List<bool> invoked; | |
| 5800 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getAnalysisOpt
ions(this.invoked) : super(); | |
| 5801 // @override | |
| 5802 // AnalysisOptions get analysisOptions { | |
| 5803 // invoked[0] = true; | |
| 5804 // return null; | |
| 5805 // } | |
| 5806 // } | |
| 5807 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getAngular
ApplicationWithHtml extends TestAnalysisContext { | |
| 5808 // List<bool> invoked; | |
| 5809 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getAngularAppl
icationWithHtml(this.invoked) : super(); | |
| 5810 // @override | |
| 5811 // AngularApplication getAngularApplicationWithHtml(Source htmlSource) { | |
| 5812 // invoked[0] = true; | |
| 5813 // return null; | |
| 5814 // } | |
| 5815 // } | |
| 5816 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getCompila
tionUnitElement extends TestAnalysisContext { | |
| 5817 // List<bool> invoked; | |
| 5818 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getCompilation
UnitElement(this.invoked) : super(); | |
| 5819 // @override | |
| 5820 // CompilationUnitElement getCompilationUnitElement(Source unitSource, Source
librarySource) { | |
| 5821 // invoked[0] = true; | |
| 5822 // return null; | |
| 5823 // } | |
| 5824 // } | |
| 5825 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getContent
s extends TestAnalysisContext { | |
| 5826 // List<bool> invoked; | |
| 5827 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getContents(th
is.invoked) : super(); | |
| 5828 // @override | |
| 5829 // TimestampedData<String> getContents(Source source) { | |
| 5830 // invoked[0] = true; | |
| 5831 // return null; | |
| 5832 // } | |
| 5833 // } | |
| 5834 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getContent
sToReceiver extends TestAnalysisContext { | |
| 5835 // List<bool> invoked; | |
| 5836 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getContentsToR
eceiver(this.invoked) : super(); | |
| 5837 // @override | |
| 5838 // void getContentsToReceiver(Source source, Source_ContentReceiver receiver)
{ | |
| 5839 // invoked[0] = true; | |
| 5840 // } | |
| 5841 // } | |
| 5842 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getElement
extends TestAnalysisContext { | |
| 5843 // List<bool> invoked; | |
| 5844 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getElement(thi
s.invoked) : super(); | |
| 5845 // @override | |
| 5846 // Element getElement(ElementLocation location) { | |
| 5847 // invoked[0] = true; | |
| 5848 // return null; | |
| 5849 // } | |
| 5850 // } | |
| 5851 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getErrors
extends TestAnalysisContext { | |
| 5852 // List<bool> invoked; | |
| 5853 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getErrors(this
.invoked) : super(); | |
| 5854 // @override | |
| 5855 // AnalysisErrorInfo getErrors(Source source) { | |
| 5856 // invoked[0] = true; | |
| 5857 // return new AnalysisErrorInfoImpl(AnalysisError.NO_ERRORS, null); | |
| 5858 // } | |
| 5859 // } | |
| 5860 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHtmlEle
ment extends TestAnalysisContext { | |
| 5861 // List<bool> invoked; | |
| 5862 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHtmlElement
(this.invoked) : super(); | |
| 5863 // @override | |
| 5864 // HtmlElement getHtmlElement(Source source) { | |
| 5865 // invoked[0] = true; | |
| 5866 // return null; | |
| 5867 // } | |
| 5868 // } | |
| 5869 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHtmlFil
esReferencing extends TestAnalysisContext { | |
| 5870 // List<bool> invoked; | |
| 5871 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHtmlFilesRe
ferencing(this.invoked) : super(); | |
| 5872 // @override | |
| 5873 // List<Source> getHtmlFilesReferencing(Source source) { | |
| 5874 // invoked[0] = true; | |
| 5875 // return Source.EMPTY_ARRAY; | |
| 5876 // } | |
| 5877 // } | |
| 5878 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHtmlSou
rces extends TestAnalysisContext { | |
| 5879 // List<bool> invoked; | |
| 5880 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getHtmlSources
(this.invoked) : super(); | |
| 5881 // @override | |
| 5882 // List<Source> get htmlSources { | |
| 5883 // invoked[0] = true; | |
| 5884 // return Source.EMPTY_ARRAY; | |
| 5885 // } | |
| 5886 // } | |
| 5887 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getKindOf
extends TestAnalysisContext { | |
| 5888 // List<bool> invoked; | |
| 5889 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getKindOf(this
.invoked) : super(); | |
| 5890 // @override | |
| 5891 // SourceKind getKindOf(Source source) { | |
| 5892 // invoked[0] = true; | |
| 5893 // return null; | |
| 5894 // } | |
| 5895 // } | |
| 5896 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLauncha
bleClientLibrarySources extends TestAnalysisContext { | |
| 5897 // List<bool> invoked; | |
| 5898 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLaunchableC
lientLibrarySources(this.invoked) : super(); | |
| 5899 // @override | |
| 5900 // List<Source> get launchableClientLibrarySources { | |
| 5901 // invoked[0] = true; | |
| 5902 // return Source.EMPTY_ARRAY; | |
| 5903 // } | |
| 5904 // } | |
| 5905 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLauncha
bleServerLibrarySources extends TestAnalysisContext { | |
| 5906 // List<bool> invoked; | |
| 5907 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLaunchableS
erverLibrarySources(this.invoked) : super(); | |
| 5908 // @override | |
| 5909 // List<Source> get launchableServerLibrarySources { | |
| 5910 // invoked[0] = true; | |
| 5911 // return Source.EMPTY_ARRAY; | |
| 5912 // } | |
| 5913 // } | |
| 5914 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrari
esContaining extends TestAnalysisContext { | |
| 5915 // List<bool> invoked; | |
| 5916 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrariesCo
ntaining(this.invoked) : super(); | |
| 5917 // @override | |
| 5918 // List<Source> getLibrariesContaining(Source source) { | |
| 5919 // invoked[0] = true; | |
| 5920 // return Source.EMPTY_ARRAY; | |
| 5921 // } | |
| 5922 // } | |
| 5923 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrari
esDependingOn extends TestAnalysisContext { | |
| 5924 // List<bool> invoked; | |
| 5925 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrariesDe
pendingOn(this.invoked) : super(); | |
| 5926 // @override | |
| 5927 // List<Source> getLibrariesDependingOn(Source librarySource) { | |
| 5928 // invoked[0] = true; | |
| 5929 // return Source.EMPTY_ARRAY; | |
| 5930 // } | |
| 5931 // } | |
| 5932 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrari
esReferencedFromHtml extends TestAnalysisContext { | |
| 5933 // List<bool> invoked; | |
| 5934 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrariesRe
ferencedFromHtml(this.invoked) : super(); | |
| 5935 // @override | |
| 5936 // List<Source> getLibrariesReferencedFromHtml(Source htmlSource) { | |
| 5937 // invoked[0] = true; | |
| 5938 // return null; | |
| 5939 // } | |
| 5940 // } | |
| 5941 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrary
Element extends TestAnalysisContext { | |
| 5942 // List<bool> invoked; | |
| 5943 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibraryElem
ent(this.invoked) : super(); | |
| 5944 // @override | |
| 5945 // LibraryElement getLibraryElement(Source source) { | |
| 5946 // invoked[0] = true; | |
| 5947 // return null; | |
| 5948 // } | |
| 5949 // } | |
| 5950 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrary
Sources extends TestAnalysisContext { | |
| 5951 // List<bool> invoked; | |
| 5952 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLibrarySour
ces(this.invoked) : super(); | |
| 5953 // @override | |
| 5954 // List<Source> get librarySources { | |
| 5955 // invoked[0] = true; | |
| 5956 // return Source.EMPTY_ARRAY; | |
| 5957 // } | |
| 5958 // } | |
| 5959 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLineInf
o extends TestAnalysisContext { | |
| 5960 // List<bool> invoked; | |
| 5961 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getLineInfo(th
is.invoked) : super(); | |
| 5962 // @override | |
| 5963 // LineInfo getLineInfo(Source source) { | |
| 5964 // invoked[0] = true; | |
| 5965 // return null; | |
| 5966 // } | |
| 5967 // } | |
| 5968 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getModific
ationStamp extends TestAnalysisContext { | |
| 5969 // List<bool> invoked; | |
| 5970 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getModificatio
nStamp(this.invoked) : super(); | |
| 5971 // @override | |
| 5972 // int getModificationStamp(Source source) { | |
| 5973 // invoked[0] = true; | |
| 5974 // return 0; | |
| 5975 // } | |
| 5976 // } | |
| 5977 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getPublicN
amespace extends TestAnalysisContext { | |
| 5978 // List<bool> invoked; | |
| 5979 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getPublicNames
pace(this.invoked) : super(); | |
| 5980 // @override | |
| 5981 // Namespace getPublicNamespace(LibraryElement library) { | |
| 5982 // invoked[0] = true; | |
| 5983 // return null; | |
| 5984 // } | |
| 5985 // } | |
| 5986 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getRefacto
ringUnsafeSources extends TestAnalysisContext { | |
| 5987 // List<bool> invoked; | |
| 5988 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getRefactoring
UnsafeSources(this.invoked) : super(); | |
| 5989 // @override | |
| 5990 // List<Source> get refactoringUnsafeSources { | |
| 5991 // invoked[0] = true; | |
| 5992 // return null; | |
| 5993 // } | |
| 5994 // } | |
| 5995 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getResolve
dCompilationUnit_element extends TestAnalysisContext { | |
| 5996 // List<bool> invoked; | |
| 5997 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getResolvedCom
pilationUnit_element(this.invoked) : super(); | |
| 5998 // @override | |
| 5999 // CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElemen
t library) { | |
| 6000 // invoked[0] = true; | |
| 6001 // return null; | |
| 6002 // } | |
| 6003 // } | |
| 6004 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getResolve
dCompilationUnit_source extends TestAnalysisContext { | |
| 6005 // List<bool> invoked; | |
| 6006 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getResolvedCom
pilationUnit_source(this.invoked) : super(); | |
| 6007 // @override | |
| 6008 // CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libra
rySource) { | |
| 6009 // invoked[0] = true; | |
| 6010 // return null; | |
| 6011 // } | |
| 6012 // } | |
| 6013 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getResolve
dHtmlUnit extends TestAnalysisContext { | |
| 6014 // List<bool> invoked; | |
| 6015 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getResolvedHtm
lUnit(this.invoked) : super(); | |
| 6016 // @override | |
| 6017 // HtmlUnit getResolvedHtmlUnit(Source htmlSource) { | |
| 6018 // invoked[0] = true; | |
| 6019 // return null; | |
| 6020 // } | |
| 6021 // } | |
| 6022 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getSourceF
actory extends TestAnalysisContext { | |
| 6023 // List<bool> invoked; | |
| 6024 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getSourceFacto
ry(this.invoked) : super(); | |
| 6025 // @override | |
| 6026 // SourceFactory get sourceFactory { | |
| 6027 // invoked[0] = true; | |
| 6028 // return null; | |
| 6029 // } | |
| 6030 // } | |
| 6031 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getStatist
ics extends TestAnalysisContext { | |
| 6032 // List<bool> invoked; | |
| 6033 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getStatistics(
this.invoked) : super(); | |
| 6034 // @override | |
| 6035 // AnalysisContextStatistics get statistics { | |
| 6036 // invoked[0] = true; | |
| 6037 // return null; | |
| 6038 // } | |
| 6039 // } | |
| 6040 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getTypePro
vider extends TestAnalysisContext { | |
| 6041 // List<bool> invoked; | |
| 6042 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_getTypeProvide
r(this.invoked) : super(); | |
| 6043 // @override | |
| 6044 // TypeProvider get typeProvider { | |
| 6045 // invoked[0] = true; | |
| 6046 // return null; | |
| 6047 // } | |
| 6048 // } | |
| 6049 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isClientLi
brary extends TestAnalysisContext { | |
| 6050 // List<bool> invoked; | |
| 6051 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isClientLibrar
y(this.invoked) : super(); | |
| 6052 // @override | |
| 6053 // bool isClientLibrary(Source librarySource) { | |
| 6054 // invoked[0] = true; | |
| 6055 // return false; | |
| 6056 // } | |
| 6057 // } | |
| 6058 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isDisposed
extends TestAnalysisContext { | |
| 6059 // List<bool> invoked; | |
| 6060 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isDisposed(thi
s.invoked) : super(); | |
| 6061 // @override | |
| 6062 // bool get isDisposed { | |
| 6063 // invoked[0] = true; | |
| 6064 // return false; | |
| 6065 // } | |
| 6066 // } | |
| 6067 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isServerLi
brary extends TestAnalysisContext { | |
| 6068 // List<bool> invoked; | |
| 6069 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_isServerLibrar
y(this.invoked) : super(); | |
| 6070 // @override | |
| 6071 // bool isServerLibrary(Source librarySource) { | |
| 6072 // invoked[0] = true; | |
| 6073 // return false; | |
| 6074 // } | |
| 6075 // } | |
| 6076 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_mergeConte
xt extends TestAnalysisContext { | |
| 6077 // List<bool> invoked; | |
| 6078 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_mergeContext(t
his.invoked) : super(); | |
| 6079 // @override | |
| 6080 // void mergeContext(AnalysisContext context) { | |
| 6081 // invoked[0] = true; | |
| 6082 // } | |
| 6083 // } | |
| 6084 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_parseCompi
lationUnit extends TestAnalysisContext { | |
| 6085 // List<bool> invoked; | |
| 6086 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_parseCompilati
onUnit(this.invoked) : super(); | |
| 6087 // @override | |
| 6088 // CompilationUnit parseCompilationUnit(Source source) { | |
| 6089 // invoked[0] = true; | |
| 6090 // return null; | |
| 6091 // } | |
| 6092 // } | |
| 6093 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_parseHtmlU
nit extends TestAnalysisContext { | |
| 6094 // List<bool> invoked; | |
| 6095 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_parseHtmlUnit(
this.invoked) : super(); | |
| 6096 // @override | |
| 6097 // HtmlUnit parseHtmlUnit(Source source) { | |
| 6098 // invoked[0] = true; | |
| 6099 // return null; | |
| 6100 // } | |
| 6101 // } | |
| 6102 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_performAna
lysisTask extends TestAnalysisContext { | |
| 6103 // List<bool> invoked; | |
| 6104 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_performAnalysi
sTask(this.invoked) : super(); | |
| 6105 // @override | |
| 6106 // AnalysisResult performAnalysisTask() { | |
| 6107 // invoked[0] = true; | |
| 6108 // return new AnalysisResult(new List<ChangeNotice>(0), 0, null, 0); | |
| 6109 // } | |
| 6110 // } | |
| 6111 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_recordLibr
aryElements extends TestAnalysisContext { | |
| 6112 // List<bool> invoked; | |
| 6113 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_recordLibraryE
lements(this.invoked) : super(); | |
| 6114 // @override | |
| 6115 // void recordLibraryElements(Map<Source, LibraryElement> elementMap) { | |
| 6116 // invoked[0] = true; | |
| 6117 // } | |
| 6118 // } | |
| 6119 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resolveCom
pilationUnit extends TestAnalysisContext { | |
| 6120 // List<bool> invoked; | |
| 6121 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resolveCompila
tionUnit(this.invoked) : super(); | |
| 6122 // @override | |
| 6123 // CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySo
urce) { | |
| 6124 // invoked[0] = true; | |
| 6125 // return null; | |
| 6126 // } | |
| 6127 // } | |
| 6128 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resolveCom
pilationUnit_element extends TestAnalysisContext { | |
| 6129 // List<bool> invoked; | |
| 6130 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resolveCompila
tionUnit_element(this.invoked) : super(); | |
| 6131 // @override | |
| 6132 // CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement li
brary) { | |
| 6133 // invoked[0] = true; | |
| 6134 // return null; | |
| 6135 // } | |
| 6136 // } | |
| 6137 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resolveHtm
lUnit extends TestAnalysisContext { | |
| 6138 // List<bool> invoked; | |
| 6139 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_resolveHtmlUni
t(this.invoked) : super(); | |
| 6140 // @override | |
| 6141 // HtmlUnit resolveHtmlUnit(Source htmlSource) { | |
| 6142 // invoked[0] = true; | |
| 6143 // return null; | |
| 6144 // } | |
| 6145 // } | |
| 6146 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setAnalysi
sOptions extends TestAnalysisContext { | |
| 6147 // List<bool> invoked; | |
| 6148 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setAnalysisOpt
ions(this.invoked) : super(); | |
| 6149 // @override | |
| 6150 // void set analysisOptions(AnalysisOptions options) { | |
| 6151 // invoked[0] = true; | |
| 6152 // } | |
| 6153 // } | |
| 6154 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setAnalysi
sPriorityOrder extends TestAnalysisContext { | |
| 6155 // List<bool> invoked; | |
| 6156 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setAnalysisPri
orityOrder(this.invoked) : super(); | |
| 6157 // @override | |
| 6158 // void set analysisPriorityOrder(List<Source> sources) { | |
| 6159 // invoked[0] = true; | |
| 6160 // } | |
| 6161 // } | |
| 6162 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setChanged
Contents extends TestAnalysisContext { | |
| 6163 // List<bool> invoked; | |
| 6164 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setChangedCont
ents(this.invoked) : super(); | |
| 6165 // @override | |
| 6166 // void setChangedContents(Source source, String contents, int offset, int old
Length, int newLength) { | |
| 6167 // invoked[0] = true; | |
| 6168 // } | |
| 6169 // } | |
| 6170 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setContent
s extends TestAnalysisContext { | |
| 6171 // List<bool> invoked; | |
| 6172 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setContents(th
is.invoked) : super(); | |
| 6173 // @override | |
| 6174 // void setContents(Source source, String contents) { | |
| 6175 // invoked[0] = true; | |
| 6176 // } | |
| 6177 // } | |
| 6178 // class TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setSourceF
actory extends TestAnalysisContext { | |
| 6179 // List<bool> invoked; | |
| 6180 // TestAnalysisContext_InstrumentedAnalysisContextImplTest_test_setSourceFacto
ry(this.invoked) : super(); | |
| 6181 // @override | |
| 6182 // void set sourceFactory(SourceFactory factory) { | |
| 6183 // invoked[0] = true; | |
| 6184 // } | |
| 6185 // } | |
| 6186 // /** | |
| 6187 // * This subclass of DartEntryImpl allows test code to invoke the copyFrom() m
ethod. | |
| 6188 // */ | |
| 6189 // class TestDartEntryImpl extends DartEntryImpl { | |
| 6190 // @override | |
| 6191 // void copyFrom(SourceEntryImpl entry) { | |
| 6192 // super.copyFrom(entry); | |
| 6193 // } | |
| 6194 // } | |
| 6195 // class TestSource_AnalysisContextImplTest_test_exists_true extends TestSource
{ | |
| 6196 // @override | |
| 6197 // bool exists() => true; | |
| 6198 // } | |
| 6199 // class TestSource_AnalysisContextImplTest_test_getModificationStamp_fromSource
extends TestSource { | |
| 6200 // long stamp; | |
| 6201 // TestSource_AnalysisContextImplTest_test_getModificationStamp_fromSource(thi
s.stamp) : super(); | |
| 6202 // @override | |
| 6203 // int get modificationStamp => stamp; | |
| 6204 // } | |
| 6205 // class TestSource_AnalysisContextImplTest_test_getModificationStamp_overridden
extends TestSource { | |
| 6206 // long stamp; | |
| 6207 // TestSource_AnalysisContextImplTest_test_getModificationStamp_overridden(thi
s.stamp) : super(); | |
| 6208 // @override | |
| 6209 // int get modificationStamp => stamp; | |
| 6210 // } | |
| 6211 // class TestSource_ParseHtmlTaskTest_test_perform_non_existing_source_reference
extends TestSource { | |
| 6212 // TestSource_ParseHtmlTaskTest_test_perform_non_existing_source_reference(Str
ing arg0) : super.con2(arg0); | |
| 6213 // @override | |
| 6214 // Uri resolveRelativeUri(Uri containedUri) { | |
| 6215 // try { | |
| 6216 // return parseUriWithException("file:/does/not/exist.dart"); | |
| 6217 // } on URISyntaxException catch (exception) { | |
| 6218 // return null; | |
| 6219 // } | |
| 6220 // } | |
| 6221 // } | |
| 6222 // /** | |
| 6223 // * Instances of the class `TestTaskVisitor` implement a task visitor that fai
ls if any of its | |
| 6224 // * methods are invoked. Subclasses typically override the expected methods to
not cause a test | |
| 6225 // * failure. | |
| 6226 // */ | |
| 6227 // class TestTaskVisitor<E> implements AnalysisTaskVisitor<E> { | |
| 6228 // @override | |
| 6229 // E visitGenerateDartErrorsTask(GenerateDartErrorsTask task) { | |
| 6230 // JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartErrorsTask"); | |
| 6231 // return null; | |
| 6232 // } | |
| 6233 // @override | |
| 6234 // E visitGenerateDartHintsTask(GenerateDartHintsTask task) { | |
| 6235 // JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartHintsTask"); | |
| 6236 // return null; | |
| 6237 // } | |
| 6238 // @override | |
| 6239 // E visitGetContentTask(GetContentTask task) { | |
| 6240 // JUnitTestCase.fail("Unexpectedly invoked visitGetContentsTask"); | |
| 6241 // return null; | |
| 6242 // } | |
| 6243 // @override | |
| 6244 // E visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisT
ask) { | |
| 6245 // JUnitTestCase.fail("Unexpectedly invoked visitIncrementalAnalysisTask"); | |
| 6246 // return null; | |
| 6247 // } | |
| 6248 // @override | |
| 6249 // E visitParseDartTask(ParseDartTask task) { | |
| 6250 // JUnitTestCase.fail("Unexpectedly invoked visitParseDartTask"); | |
| 6251 // return null; | |
| 6252 // } | |
| 6253 // @override | |
| 6254 // E visitParseHtmlTask(ParseHtmlTask task) { | |
| 6255 // JUnitTestCase.fail("Unexpectedly invoked visitParseHtmlTask"); | |
| 6256 // return null; | |
| 6257 // } | |
| 6258 // @override | |
| 6259 // E visitPolymerBuildHtmlTask(PolymerBuildHtmlTask task) { | |
| 6260 // JUnitTestCase.fail("Unexpectedly invoked visitPolymerBuildHtmlTask"); | |
| 6261 // return null; | |
| 6262 // } | |
| 6263 // @override | |
| 6264 // E visitPolymerResolveHtmlTask(PolymerResolveHtmlTask task) { | |
| 6265 // JUnitTestCase.fail("Unexpectedly invoked visitPolymerResolveHtmlTask"); | |
| 6266 // return null; | |
| 6267 // } | |
| 6268 // @override | |
| 6269 // E visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemplateT
ask task) { | |
| 6270 // JUnitTestCase.fail("Unexpectedly invoked visitResolveAngularComponentTemp
lateTask"); | |
| 6271 // return null; | |
| 6272 // } | |
| 6273 // @override | |
| 6274 // E visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) { | |
| 6275 // JUnitTestCase.fail("Unexpectedly invoked visitResolveAngularEntryHtmlTask
"); | |
| 6276 // return null; | |
| 6277 // } | |
| 6278 // @override | |
| 6279 // E visitResolveDartLibraryCycleTask(ResolveDartLibraryCycleTask task) { | |
| 6280 // JUnitTestCase.fail("Unexpectedly invoked visitResolveDartLibraryCycleTask
"); | |
| 6281 // return null; | |
| 6282 // } | |
| 6283 // @override | |
| 6284 // E visitResolveDartLibraryTask(ResolveDartLibraryTask task) { | |
| 6285 // JUnitTestCase.fail("Unexpectedly invoked visitResolveDartLibraryTask"); | |
| 6286 // return null; | |
| 6287 // } | |
| 6288 // @override | |
| 6289 // E visitResolveDartUnitTask(ResolveDartUnitTask task) { | |
| 6290 // JUnitTestCase.fail("Unexpectedly invoked visitResolveDartUnitTask"); | |
| 6291 // return null; | |
| 6292 // } | |
| 6293 // @override | |
| 6294 // E visitResolveHtmlTask(ResolveHtmlTask task) { | |
| 6295 // JUnitTestCase.fail("Unexpectedly invoked visitResolveHtmlTask"); | |
| 6296 // return null; | |
| 6297 // } | |
| 6298 // @override | |
| 6299 // E visitScanDartTask(ScanDartTask task) { | |
| 6300 // JUnitTestCase.fail("Unexpectedly invoked visitScanDartTask"); | |
| 6301 // return null; | |
| 6302 // } | |
| 6303 // } | |
| 6304 // class TestTaskVisitor_GenerateDartErrorsTaskTest_test_accept extends TestTask
Visitor<Boolean> { | |
| 6305 // @override | |
| 6306 // bool visitGenerateDartErrorsTask(GenerateDartErrorsTask task) => true; | |
| 6307 // } | |
| 6308 // class TestTaskVisitor_GenerateDartErrorsTaskTest_test_perform extends TestTas
kVisitor<Boolean> { | |
| 6309 // LibraryElement libraryElement; | |
| 6310 // Source source; | |
| 6311 // TestTaskVisitor_GenerateDartErrorsTaskTest_test_perform(this.libraryElement
, this.source) : super(); | |
| 6312 // @override | |
| 6313 // bool visitGenerateDartErrorsTask(GenerateDartErrorsTask task) { | |
| 6314 // CaughtException exception = task.exception; | |
| 6315 // if (exception != null) { | |
| 6316 // throw exception; | |
| 6317 // } | |
| 6318 // JUnitTestCase.assertSame(libraryElement, task.libraryElement); | |
| 6319 // JUnitTestCase.assertSame(source, task.source); | |
| 6320 // List<AnalysisError> errors = task.errors; | |
| 6321 // EngineTestCase.assertLength(1, errors); | |
| 6322 // return true; | |
| 6323 // } | |
| 6324 // } | |
| 6325 // class TestTaskVisitor_GenerateDartErrorsTaskTest_test_perform_validateDirecti
ves extends TestTaskVisitor<Boolean> { | |
| 6326 // LibraryElement libraryElement; | |
| 6327 // Source source; | |
| 6328 // TestTaskVisitor_GenerateDartErrorsTaskTest_test_perform_validateDirectives(
this.libraryElement, this.source) : super(); | |
| 6329 // @override | |
| 6330 // bool visitGenerateDartErrorsTask(GenerateDartErrorsTask task) { | |
| 6331 // CaughtException exception = task.exception; | |
| 6332 // if (exception != null) { | |
| 6333 // throw exception; | |
| 6334 // } | |
| 6335 // JUnitTestCase.assertSame(libraryElement, task.libraryElement); | |
| 6336 // JUnitTestCase.assertSame(source, task.source); | |
| 6337 // List<AnalysisError> errors = task.errors; | |
| 6338 // EngineTestCase.assertLength(1, errors); | |
| 6339 // JUnitTestCase.assertSame(CompileTimeErrorCode.URI_DOES_NOT_EXIST, errors[
0].errorCode); | |
| 6340 // return true; | |
| 6341 // } | |
| 6342 // } | |
| 6343 // class TestTaskVisitor_GenerateDartHintsTaskTest_test_accept extends TestTaskV
isitor<Boolean> { | |
| 6344 // @override | |
| 6345 // bool visitGenerateDartHintsTask(GenerateDartHintsTask task) => true; | |
| 6346 // } | |
| 6347 // class TestTaskVisitor_GenerateDartHintsTaskTest_test_perform extends TestTask
Visitor<Boolean> { | |
| 6348 // Source librarySource; | |
| 6349 // Source partSource; | |
| 6350 // TestTaskVisitor_GenerateDartHintsTaskTest_test_perform(this.librarySource,
this.partSource) : super(); | |
| 6351 // @override | |
| 6352 // bool visitGenerateDartHintsTask(GenerateDartHintsTask task) { | |
| 6353 // CaughtException exception = task.exception; | |
| 6354 // if (exception != null) { | |
| 6355 // throw exception; | |
| 6356 // } | |
| 6357 // JUnitTestCase.assertNotNull(task.libraryElement); | |
| 6358 // HashMap<Source, TimestampedData<List<AnalysisError>>> hintMap = task.hint
Map; | |
| 6359 // EngineTestCase.assertSizeOfMap(2, hintMap); | |
| 6360 // EngineTestCase.assertLength(1, hintMap[librarySource].data); | |
| 6361 // EngineTestCase.assertLength(0, hintMap[partSource].data); | |
| 6362 // return true; | |
| 6363 // } | |
| 6364 // } | |
| 6365 // class TestTaskVisitor_GetContentTaskTest_test_accept extends TestTaskVisitor<
Boolean> { | |
| 6366 // @override | |
| 6367 // bool visitGetContentTask(GetContentTask task) => true; | |
| 6368 // } | |
| 6369 // class TestTaskVisitor_GetContentTaskTest_test_perform_exception extends TestT
askVisitor<Boolean> { | |
| 6370 // @override | |
| 6371 // bool visitGetContentTask(GetContentTask task) { | |
| 6372 // JUnitTestCase.assertNotNull(task.exception); | |
| 6373 // return true; | |
| 6374 // } | |
| 6375 // } | |
| 6376 // class TestTaskVisitor_GetContentTaskTest_test_perform_valid extends TestTaskV
isitor<Boolean> { | |
| 6377 // InternalAnalysisContext context; | |
| 6378 // Source source; | |
| 6379 // TestTaskVisitor_GetContentTaskTest_test_perform_valid(this.context, this.so
urce) : super(); | |
| 6380 // @override | |
| 6381 // bool visitGetContentTask(GetContentTask task) { | |
| 6382 // CaughtException exception = task.exception; | |
| 6383 // if (exception != null) { | |
| 6384 // throw exception; | |
| 6385 // } | |
| 6386 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); | |
| 6387 // JUnitTestCase.assertSame(source, task.source); | |
| 6388 // return true; | |
| 6389 // } | |
| 6390 // } | |
| 6391 // class TestTaskVisitor_IncrementalAnalysisTaskTest_assertTask extends TestTask
Visitor<CompilationUnit> { | |
| 6392 // IncrementalAnalysisTask task; | |
| 6393 // TestTaskVisitor_IncrementalAnalysisTaskTest_assertTask(this.task) : super()
; | |
| 6394 // @override | |
| 6395 // CompilationUnit visitIncrementalAnalysisTask(IncrementalAnalysisTask increm
entalAnalysisTask) => task.compilationUnit; | |
| 6396 // } | |
| 6397 // class TestTaskVisitor_IncrementalAnalysisTaskTest_test_accept extends TestTas
kVisitor<Boolean> { | |
| 6398 // @override | |
| 6399 // bool visitIncrementalAnalysisTask(IncrementalAnalysisTask task) => true; | |
| 6400 // } | |
| 6401 // class TestTaskVisitor_ParseDartTaskTest_createParseTask extends TestTaskVisit
or<Object> { | |
| 6402 // @override | |
| 6403 // Object visitScanDartTask(ScanDartTask task) => null; | |
| 6404 // } | |
| 6405 // class TestTaskVisitor_ParseDartTaskTest_test_accept extends TestTaskVisitor<B
oolean> { | |
| 6406 // @override | |
| 6407 // bool visitParseDartTask(ParseDartTask task) => true; | |
| 6408 // } | |
| 6409 // class TestTaskVisitor_ParseDartTaskTest_test_perform_exception extends TestTa
skVisitor<Boolean> { | |
| 6410 // @override | |
| 6411 // bool visitParseDartTask(ParseDartTask task) { | |
| 6412 // JUnitTestCase.assertNotNull(task.exception); | |
| 6413 // return true; | |
| 6414 // } | |
| 6415 // } | |
| 6416 // class TestTaskVisitor_ParseDartTaskTest_test_perform_library extends TestTask
Visitor<Object> { | |
| 6417 // InternalAnalysisContext context; | |
| 6418 // Source source; | |
| 6419 // TestTaskVisitor_ParseDartTaskTest_test_perform_library(this.context, this.s
ource) : super(); | |
| 6420 // @override | |
| 6421 // Object visitParseDartTask(ParseDartTask task) { | |
| 6422 // CaughtException exception = task.exception; | |
| 6423 // if (exception != null) { | |
| 6424 // throw exception; | |
| 6425 // } | |
| 6426 // JUnitTestCase.assertNotNull(task.compilationUnit); | |
| 6427 // EngineTestCase.assertLength(1, task.errors); | |
| 6428 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); | |
| 6429 // JUnitTestCase.assertSame(source, task.source); | |
| 6430 // JUnitTestCase.assertTrue(task.hasNonPartOfDirective); | |
| 6431 // JUnitTestCase.assertFalse(task.hasPartOfDirective); | |
| 6432 // return null; | |
| 6433 // } | |
| 6434 // } | |
| 6435 // class TestTaskVisitor_ParseDartTaskTest_test_perform_part extends TestTaskVis
itor<Object> { | |
| 6436 // InternalAnalysisContext context; | |
| 6437 // Source source; | |
| 6438 // TestTaskVisitor_ParseDartTaskTest_test_perform_part(this.context, this.sour
ce) : super(); | |
| 6439 // @override | |
| 6440 // Object visitParseDartTask(ParseDartTask task) { | |
| 6441 // CaughtException exception = task.exception; | |
| 6442 // if (exception != null) { | |
| 6443 // throw exception; | |
| 6444 // } | |
| 6445 // JUnitTestCase.assertNotNull(task.compilationUnit); | |
| 6446 // EngineTestCase.assertLength(0, task.errors); | |
| 6447 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); | |
| 6448 // JUnitTestCase.assertSame(source, task.source); | |
| 6449 // JUnitTestCase.assertFalse(task.hasNonPartOfDirective); | |
| 6450 // JUnitTestCase.assertTrue(task.hasPartOfDirective); | |
| 6451 // return null; | |
| 6452 // } | |
| 6453 // } | |
| 6454 // class TestTaskVisitor_ParseDartTaskTest_test_perform_validateDirectives exten
ds TestTaskVisitor<Object> { | |
| 6455 // InternalAnalysisContext context; | |
| 6456 // Source source; | |
| 6457 // TestTaskVisitor_ParseDartTaskTest_test_perform_validateDirectives(this.cont
ext, this.source) : super(); | |
| 6458 // @override | |
| 6459 // Object visitParseDartTask(ParseDartTask task) { | |
| 6460 // CaughtException exception = task.exception; | |
| 6461 // if (exception != null) { | |
| 6462 // throw exception; | |
| 6463 // } | |
| 6464 // JUnitTestCase.assertNotNull(task.compilationUnit); | |
| 6465 // GatheringErrorListener errorListener = new GatheringErrorListener(); | |
| 6466 // errorListener.addAll(task.errors); | |
| 6467 // errorListener.assertErrorsWithCodes([ | |
| 6468 // CompileTimeErrorCode.URI_WITH_INTERPOLATION, | |
| 6469 // CompileTimeErrorCode.INVALID_URI]); | |
| 6470 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); | |
| 6471 // JUnitTestCase.assertSame(source, task.source); | |
| 6472 // JUnitTestCase.assertTrue(task.hasNonPartOfDirective); | |
| 6473 // JUnitTestCase.assertFalse(task.hasPartOfDirective); | |
| 6474 // return null; | |
| 6475 // } | |
| 6476 // } | |
| 6477 // class TestTaskVisitor_ParseHtmlTaskTest_parseSource extends TestTaskVisitor<B
oolean> { | |
| 6478 // InternalAnalysisContext context; | |
| 6479 // Source source; | |
| 6480 // TestTaskVisitor_ParseHtmlTaskTest_parseSource(this.context, this.source) :
super(); | |
| 6481 // @override | |
| 6482 // bool visitParseHtmlTask(ParseHtmlTask task) { | |
| 6483 // CaughtException exception = task.exception; | |
| 6484 // if (exception != null) { | |
| 6485 // throw exception; | |
| 6486 // } | |
| 6487 // JUnitTestCase.assertNotNull(task.htmlUnit); | |
| 6488 // JUnitTestCase.assertNotNull(task.lineInfo); | |
| 6489 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); | |
| 6490 // JUnitTestCase.assertSame(source, task.source); | |
| 6491 // return true; | |
| 6492 // } | |
| 6493 // } | |
| 6494 // class TestTaskVisitor_ParseHtmlTaskTest_test_accept extends TestTaskVisitor<B
oolean> { | |
| 6495 // @override | |
| 6496 // bool visitParseHtmlTask(ParseHtmlTask task) => true; | |
| 6497 // } | |
| 6498 // class TestTaskVisitor_ResolveDartLibraryTaskTest_test_accept extends TestTask
Visitor<Boolean> { | |
| 6499 // @override | |
| 6500 // bool visitResolveDartLibraryTask(ResolveDartLibraryTask task) => true; | |
| 6501 // } | |
| 6502 // class TestTaskVisitor_ResolveDartLibraryTaskTest_test_perform_exception exten
ds TestTaskVisitor<Boolean> { | |
| 6503 // @override | |
| 6504 // bool visitResolveDartLibraryTask(ResolveDartLibraryTask task) { | |
| 6505 // JUnitTestCase.assertNotNull(task.exception); | |
| 6506 // return true; | |
| 6507 // } | |
| 6508 // } | |
| 6509 // class TestTaskVisitor_ResolveDartLibraryTaskTest_test_perform_library extends
TestTaskVisitor<Boolean> { | |
| 6510 // Source source; | |
| 6511 // TestTaskVisitor_ResolveDartLibraryTaskTest_test_perform_library(this.source
) : super(); | |
| 6512 // @override | |
| 6513 // bool visitResolveDartLibraryTask(ResolveDartLibraryTask task) { | |
| 6514 // CaughtException exception = task.exception; | |
| 6515 // if (exception != null) { | |
| 6516 // throw exception; | |
| 6517 // } | |
| 6518 // JUnitTestCase.assertNotNull(task.libraryResolver); | |
| 6519 // JUnitTestCase.assertSame(source, task.librarySource); | |
| 6520 // JUnitTestCase.assertSame(source, task.unitSource); | |
| 6521 // return true; | |
| 6522 // } | |
| 6523 // } | |
| 6524 // class TestTaskVisitor_ResolveDartUnitTaskTest_test_accept extends TestTaskVis
itor<Boolean> { | |
| 6525 // @override | |
| 6526 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) => true; | |
| 6527 // } | |
| 6528 // class TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_exception extends
TestTaskVisitor<Boolean> { | |
| 6529 // @override | |
| 6530 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) { | |
| 6531 // JUnitTestCase.assertNotNull(task.exception); | |
| 6532 // return true; | |
| 6533 // } | |
| 6534 // } | |
| 6535 // class TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_library extends Te
stTaskVisitor<Boolean> { | |
| 6536 // Source source; | |
| 6537 // InternalAnalysisContext context; | |
| 6538 // TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_library(this.source, t
his.context) : super(); | |
| 6539 // @override | |
| 6540 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) { | |
| 6541 // CaughtException exception = task.exception; | |
| 6542 // if (exception != null) { | |
| 6543 // throw exception; | |
| 6544 // } | |
| 6545 // JUnitTestCase.assertSame(source, task.librarySource); | |
| 6546 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); | |
| 6547 // JUnitTestCase.assertNotNull(task.resolvedUnit); | |
| 6548 // JUnitTestCase.assertSame(source, task.source); | |
| 6549 // return true; | |
| 6550 // } | |
| 6551 // } | |
| 6552 // class TestTaskVisitor_ResolveHtmlTaskTest_test_accept extends TestTaskVisitor
<Boolean> { | |
| 6553 // @override | |
| 6554 // bool visitResolveHtmlTask(ResolveHtmlTask task) => true; | |
| 6555 // } | |
| 6556 // class TestTaskVisitor_ResolveHtmlTaskTest_test_perform_exception extends Test
TaskVisitor<Boolean> { | |
| 6557 // @override | |
| 6558 // bool visitResolveHtmlTask(ResolveHtmlTask task) { | |
| 6559 // JUnitTestCase.assertNotNull(task.exception); | |
| 6560 // return true; | |
| 6561 // } | |
| 6562 // } | |
| 6563 // class TestTaskVisitor_ResolveHtmlTaskTest_test_perform_valid extends TestTask
Visitor<Object> { | |
| 6564 // long modificationStamp; | |
| 6565 // Source source; | |
| 6566 // TestTaskVisitor_ResolveHtmlTaskTest_test_perform_valid(this.modificationSta
mp, this.source) : super(); | |
| 6567 // @override | |
| 6568 // Object visitResolveHtmlTask(ResolveHtmlTask task) { | |
| 6569 // CaughtException exception = task.exception; | |
| 6570 // if (exception != null) { | |
| 6571 // throw exception; | |
| 6572 // } | |
| 6573 // JUnitTestCase.assertNotNull(task.element); | |
| 6574 // JUnitTestCase.assertEquals(modificationStamp, task.modificationTime); | |
| 6575 // EngineTestCase.assertLength(1, task.resolutionErrors); | |
| 6576 // JUnitTestCase.assertSame(source, task.source); | |
| 6577 // return null; | |
| 6578 // } | |
| 6579 // } | |
| 6580 // class TestTaskVisitor_ResolveHtmlTaskTest_test_perform_valid_2 extends TestTa
skVisitor<Object> { | |
| 6581 // @override | |
| 6582 // Object visitParseHtmlTask(ParseHtmlTask task) => null; | |
| 6583 // } | |
| 6584 // class TestTaskVisitor_ScanDartTaskTest_test_accept extends TestTaskVisitor<Bo
olean> { | |
| 6585 // @override | |
| 6586 // bool visitScanDartTask(ScanDartTask task) => true; | |
| 6587 // } | |
| 6588 // class TestTaskVisitor_ScanDartTaskTest_test_perform_valid extends TestTaskVis
itor<Boolean> { | |
| 6589 // InternalAnalysisContext context; | |
| 6590 // Source source; | |
| 6591 // TestTaskVisitor_ScanDartTaskTest_test_perform_valid(this.context, this.sour
ce) : super(); | |
| 6592 // @override | |
| 6593 // bool visitScanDartTask(ScanDartTask task) { | |
| 6594 // CaughtException exception = task.exception; | |
| 6595 // if (exception != null) { | |
| 6596 // throw exception; | |
| 6597 // } | |
| 6598 // JUnitTestCase.assertNotNull(task.tokenStream); | |
| 6599 // EngineTestCase.assertLength(0, task.errors); | |
| 6600 // JUnitTestCase.assertNotNull(task.lineInfo); | |
| 6601 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); | |
| 6602 // JUnitTestCase.assertSame(source, task.source); | |
| 6603 // return true; | |
| 6604 // } | |
| 6605 // } | |
| 6606 // class UniversalCachePartitionTest extends EngineTestCase { | |
| 6607 // void test_contains() { | |
| 6608 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); | |
| 6609 // TestSource source = new TestSource(); | |
| 6610 // JUnitTestCase.assertTrue(partition.contains(source)); | |
| 6611 // } | |
| 6612 // void test_creation() { | |
| 6613 // JUnitTestCase.assertNotNull(new UniversalCachePartition(null, 8, null)); | |
| 6614 // } | |
| 6615 // void test_entrySet() { | |
| 6616 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); | |
| 6617 // TestSource source = new TestSource(); | |
| 6618 // DartEntryImpl entry = new DartEntryImpl(); | |
| 6619 // partition.put(source, entry); | |
| 6620 // JavaIterator<MapEntry<Source, SourceEntry>> entries = new JavaIterator(ge
tMapEntrySet(partition.map)); | |
| 6621 // JUnitTestCase.assertTrue(entries.hasNext); | |
| 6622 // MapEntry<Source, SourceEntry> mapEntry = entries.next(); | |
| 6623 // JUnitTestCase.assertSame(source, mapEntry.getKey()); | |
| 6624 // JUnitTestCase.assertSame(entry, mapEntry.getValue()); | |
| 6625 // JUnitTestCase.assertFalse(entries.hasNext); | |
| 6626 // } | |
| 6627 // void test_get() { | |
| 6628 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); | |
| 6629 // TestSource source = new TestSource(); | |
| 6630 // JUnitTestCase.assertNull(partition.get(source)); | |
| 6631 // } | |
| 6632 // void test_put_noFlush() { | |
| 6633 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); | |
| 6634 // TestSource source = new TestSource(); | |
| 6635 // DartEntryImpl entry = new DartEntryImpl(); | |
| 6636 // partition.put(source, entry); | |
| 6637 // JUnitTestCase.assertSame(entry, partition.get(source)); | |
| 6638 // } | |
| 6639 // void test_remove() { | |
| 6640 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); | |
| 6641 // TestSource source = new TestSource(); | |
| 6642 // DartEntryImpl entry = new DartEntryImpl(); | |
| 6643 // partition.put(source, entry); | |
| 6644 // JUnitTestCase.assertSame(entry, partition.get(source)); | |
| 6645 // partition.remove(source); | |
| 6646 // JUnitTestCase.assertNull(partition.get(source)); | |
| 6647 // } | |
| 6648 // void test_setMaxCacheSize() { | |
| 6649 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
new CacheRetentionPolicy_UniversalCachePartitionTest_test_setMaxCacheSize()); | |
| 6650 // int size = 6; | |
| 6651 // for (int i = 0; i < size; i++) { | |
| 6652 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); | |
| 6653 // DartEntryImpl entry = new DartEntryImpl(); | |
| 6654 // entry.setValue(DartEntry.PARSED_UNIT, null); | |
| 6655 // partition.put(source, entry); | |
| 6656 // partition.accessedAst(source); | |
| 6657 // } | |
| 6658 // _assertNonFlushedCount(size, partition); | |
| 6659 // int newSize = size - 2; | |
| 6660 // partition.maxCacheSize = newSize; | |
| 6661 // _assertNonFlushedCount(newSize, partition); | |
| 6662 // } | |
| 6663 // void test_size() { | |
| 6664 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); | |
| 6665 // int size = 4; | |
| 6666 // for (int i = 0; i < size; i++) { | |
| 6667 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); | |
| 6668 // partition.put(source, new DartEntryImpl()); | |
| 6669 // partition.accessedAst(source); | |
| 6670 // } | |
| 6671 // JUnitTestCase.assertEquals(size, partition.size()); | |
| 6672 // } | |
| 6673 // void _assertNonFlushedCount(int expectedCount, UniversalCachePartition part
ition) { | |
| 6674 // int nonFlushedCount = 0; | |
| 6675 // JavaIterator<MapEntry<Source, SourceEntry>> entries = new JavaIterator(ge
tMapEntrySet(partition.map)); | |
| 6676 // while (entries.hasNext) { | |
| 6677 // MapEntry<Source, SourceEntry> entry = entries.next(); | |
| 6678 // if (entry.getValue().getState(DartEntry.PARSED_UNIT) != CacheState.FLUS
HED) { | |
| 6679 // nonFlushedCount++; | |
| 6680 // } | |
| 6681 // } | |
| 6682 // JUnitTestCase.assertEquals(expectedCount, nonFlushedCount); | |
| 6683 // } | |
| 6684 // static dartSuite() { | |
| 6685 // _ut.group('UniversalCachePartitionTest', () { | |
| 6686 // _ut.test('test_contains', () { | |
| 6687 // final __test = new UniversalCachePartitionTest(); | |
| 6688 // runJUnitTest(__test, __test.test_contains); | |
| 6689 // }); | |
| 6690 // _ut.test('test_creation', () { | |
| 6691 // final __test = new UniversalCachePartitionTest(); | |
| 6692 // runJUnitTest(__test, __test.test_creation); | |
| 6693 // }); | |
| 6694 // _ut.test('test_entrySet', () { | |
| 6695 // final __test = new UniversalCachePartitionTest(); | |
| 6696 // runJUnitTest(__test, __test.test_entrySet); | |
| 6697 // }); | |
| 6698 // _ut.test('test_get', () { | |
| 6699 // final __test = new UniversalCachePartitionTest(); | |
| 6700 // runJUnitTest(__test, __test.test_get); | |
| 6701 // }); | |
| 6702 // _ut.test('test_put_noFlush', () { | |
| 6703 // final __test = new UniversalCachePartitionTest(); | |
| 6704 // runJUnitTest(__test, __test.test_put_noFlush); | |
| 6705 // }); | |
| 6706 // _ut.test('test_remove', () { | |
| 6707 // final __test = new UniversalCachePartitionTest(); | |
| 6708 // runJUnitTest(__test, __test.test_remove); | |
| 6709 // }); | |
| 6710 // _ut.test('test_setMaxCacheSize', () { | |
| 6711 // final __test = new UniversalCachePartitionTest(); | |
| 6712 // runJUnitTest(__test, __test.test_setMaxCacheSize); | |
| 6713 // }); | |
| 6714 // _ut.test('test_size', () { | |
| 6715 // final __test = new UniversalCachePartitionTest(); | |
| 6716 // runJUnitTest(__test, __test.test_size); | |
| 6717 // }); | |
| 6718 // }); | |
| 6719 // } | |
| 6720 // } | |
| 6721 // class WorkManagerTest extends EngineTestCase { | |
| 6722 // void test_addFirst() { | |
| 6723 // TestSource source1 = new TestSource.con1(FileUtilities2.createFile("/f1.d
art"), ""); | |
| 6724 // TestSource source2 = new TestSource.con1(FileUtilities2.createFile("/f2.d
art"), ""); | |
| 6725 // WorkManager manager = new WorkManager(); | |
| 6726 // manager.add(source1, SourcePriority.UNKNOWN); | |
| 6727 // manager.addFirst(source2, SourcePriority.UNKNOWN); | |
| 6728 // WorkManager_WorkIterator iterator = manager.iterator(); | |
| 6729 // JUnitTestCase.assertSame(source2, iterator.next()); | |
| 6730 // JUnitTestCase.assertSame(source1, iterator.next()); | |
| 6731 // } | |
| 6732 // void test_creation() { | |
| 6733 // JUnitTestCase.assertNotNull(new WorkManager()); | |
| 6734 // } | |
| 6735 // void test_iterator_empty() { | |
| 6736 // WorkManager manager = new WorkManager(); | |
| 6737 // WorkManager_WorkIterator iterator = manager.iterator(); | |
| 6738 // JUnitTestCase.assertFalse(iterator.hasNext); | |
| 6739 // try { | |
| 6740 // iterator.next(); | |
| 6741 // JUnitTestCase.fail("Expected NoSuchElementException"); | |
| 6742 // } on NoSuchElementException catch (exception) { | |
| 6743 // } | |
| 6744 // } | |
| 6745 // void test_iterator_nonEmpty() { | |
| 6746 // TestSource source = new TestSource(); | |
| 6747 // WorkManager manager = new WorkManager(); | |
| 6748 // manager.add(source, SourcePriority.UNKNOWN); | |
| 6749 // WorkManager_WorkIterator iterator = manager.iterator(); | |
| 6750 // JUnitTestCase.assertTrue(iterator.hasNext); | |
| 6751 // JUnitTestCase.assertSame(source, iterator.next()); | |
| 6752 // } | |
| 6753 // void test_remove() { | |
| 6754 // TestSource source1 = new TestSource.con1(FileUtilities2.createFile("/f1.d
art"), ""); | |
| 6755 // TestSource source2 = new TestSource.con1(FileUtilities2.createFile("/f2.d
art"), ""); | |
| 6756 // TestSource source3 = new TestSource.con1(FileUtilities2.createFile("/f3.d
art"), ""); | |
| 6757 // WorkManager manager = new WorkManager(); | |
| 6758 // manager.add(source1, SourcePriority.UNKNOWN); | |
| 6759 // manager.add(source2, SourcePriority.UNKNOWN); | |
| 6760 // manager.add(source3, SourcePriority.UNKNOWN); | |
| 6761 // manager.remove(source2); | |
| 6762 // WorkManager_WorkIterator iterator = manager.iterator(); | |
| 6763 // JUnitTestCase.assertSame(source1, iterator.next()); | |
| 6764 // JUnitTestCase.assertSame(source3, iterator.next()); | |
| 6765 // } | |
| 6766 // void test_toString_empty() { | |
| 6767 // WorkManager manager = new WorkManager(); | |
| 6768 // JUnitTestCase.assertNotNull(manager.toString()); | |
| 6769 // } | |
| 6770 // void test_toString_nonEmpty() { | |
| 6771 // WorkManager manager = new WorkManager(); | |
| 6772 // manager.add(new TestSource(), SourcePriority.HTML); | |
| 6773 // manager.add(new TestSource(), SourcePriority.LIBRARY); | |
| 6774 // manager.add(new TestSource(), SourcePriority.NORMAL_PART); | |
| 6775 // manager.add(new TestSource(), SourcePriority.PRIORITY_PART); | |
| 6776 // manager.add(new TestSource(), SourcePriority.UNKNOWN); | |
| 6777 // JUnitTestCase.assertNotNull(manager.toString()); | |
| 6778 // } | |
| 6779 // static dartSuite() { | |
| 6780 // _ut.group('WorkManagerTest', () { | |
| 6781 // _ut.test('test_addFirst', () { | |
| 6782 // final __test = new WorkManagerTest(); | |
| 6783 // runJUnitTest(__test, __test.test_addFirst); | |
| 6784 // }); | |
| 6785 // _ut.test('test_creation', () { | |
| 6786 // final __test = new WorkManagerTest(); | |
| 6787 // runJUnitTest(__test, __test.test_creation); | |
| 6788 // }); | |
| 6789 // _ut.test('test_iterator_empty', () { | |
| 6790 // final __test = new WorkManagerTest(); | |
| 6791 // runJUnitTest(__test, __test.test_iterator_empty); | |
| 6792 // }); | |
| 6793 // _ut.test('test_iterator_nonEmpty', () { | |
| 6794 // final __test = new WorkManagerTest(); | |
| 6795 // runJUnitTest(__test, __test.test_iterator_nonEmpty); | |
| 6796 // }); | |
| 6797 // _ut.test('test_remove', () { | |
| 6798 // final __test = new WorkManagerTest(); | |
| 6799 // runJUnitTest(__test, __test.test_remove); | |
| 6800 // }); | |
| 6801 // _ut.test('test_toString_empty', () { | |
| 6802 // final __test = new WorkManagerTest(); | |
| 6803 // runJUnitTest(__test, __test.test_toString_empty); | |
| 6804 // }); | |
| 6805 // _ut.test('test_toString_nonEmpty', () { | |
| 6806 // final __test = new WorkManagerTest(); | |
| 6807 // runJUnitTest(__test, __test.test_toString_nonEmpty); | |
| 6808 // }); | |
| 6809 // }); | |
| 6810 // } | |
| 6811 // } | |
| 6812 // main() { | |
| 6813 // AnalysisContextImplTest.dartSuite(); | |
| 6814 // AnalysisOptionsImplTest.dartSuite(); | |
| 6815 // IncrementalAnalysisCacheTest.dartSuite(); | |
| 6816 // InstrumentedAnalysisContextImplTest.dartSuite(); | |
| 6817 // WorkManagerTest.dartSuite(); | |
| 6818 // AnalysisTaskTest.dartSuite(); | |
| 6819 // GenerateDartErrorsTaskTest.dartSuite(); | |
| 6820 // GenerateDartHintsTaskTest.dartSuite(); | |
| 6821 // GetContentTaskTest.dartSuite(); | |
| 6822 // IncrementalAnalysisTaskTest.dartSuite(); | |
| 6823 // ParseDartTaskTest.dartSuite(); | |
| 6824 // ParseHtmlTaskTest.dartSuite(); | |
| 6825 // ResolveDartLibraryTaskTest.dartSuite(); | |
| 6826 // ResolveDartUnitTaskTest.dartSuite(); | |
| 6827 // ResolveHtmlTaskTest.dartSuite(); | |
| 6828 // ScanDartTaskTest.dartSuite(); | |
| 6829 // AnalysisCacheTest.dartSuite(); | |
| 6830 // DartEntryImplTest.dartSuite(); | |
| 6831 // HtmlEntryImplTest.dartSuite(); | |
| 6832 // PartitionManagerTest.dartSuite(); | |
| 6833 // SdkCachePartitionTest.dartSuite(); | |
| 6834 // UniversalCachePartitionTest.dartSuite(); | |
| 6835 // } | |
| 6836 | 38 |
| 6837 main() { | 39 main() { |
| 6838 } | 40 AnalysisContextImplTest.dartSuite(); |
| 41 AnalysisOptionsImplTest.dartSuite(); |
| 42 IncrementalAnalysisCacheTest.dartSuite(); |
| 43 InstrumentedAnalysisContextImplTest.dartSuite(); |
| 44 AnalysisTaskTest.dartSuite(); |
| 45 GenerateDartErrorsTaskTest.dartSuite(); |
| 46 GenerateDartHintsTaskTest.dartSuite(); |
| 47 GetContentTaskTest.dartSuite(); |
| 48 IncrementalAnalysisTaskTest.dartSuite(); |
| 49 ParseDartTaskTest.dartSuite(); |
| 50 ParseHtmlTaskTest.dartSuite(); |
| 51 ResolveDartLibraryTaskTest.dartSuite(); |
| 52 ResolveDartUnitTaskTest.dartSuite(); |
| 53 ResolveHtmlTaskTest.dartSuite(); |
| 54 ScanDartTaskTest.dartSuite(); |
| 55 AnalysisCacheTest.dartSuite(); |
| 56 DartEntryImplTest.dartSuite(); |
| 57 HtmlEntryImplTest.dartSuite(); |
| 58 PartitionManagerTest.dartSuite(); |
| 59 SdkCachePartitionTest.dartSuite(); |
| 60 UniversalCachePartitionTest.dartSuite(); |
| 61 WorkManagerTest.dartSuite(); |
| 62 } |
| 63 |
| 64 |
| 65 class AnalysisCacheTest extends EngineTestCase { |
| 66 void test_creation() { |
| 67 JUnitTestCase.assertNotNull(new AnalysisCache(new List<CachePartition>(0))); |
| 68 } |
| 69 |
| 70 void test_get() { |
| 71 AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); |
| 72 TestSource source = new TestSource(); |
| 73 JUnitTestCase.assertNull(cache.get(source)); |
| 74 } |
| 75 |
| 76 void test_iterator() { |
| 77 CachePartition partition = new UniversalCachePartition(null, 8, new DefaultR
etentionPolicy()); |
| 78 AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); |
| 79 TestSource source = new TestSource(); |
| 80 DartEntryImpl entry = new DartEntryImpl(); |
| 81 cache.put(source, entry); |
| 82 MapIterator<Source, SourceEntry> iterator = cache.iterator(); |
| 83 JUnitTestCase.assertTrue(iterator.moveNext()); |
| 84 JUnitTestCase.assertSame(source, iterator.key); |
| 85 JUnitTestCase.assertSame(entry, iterator.value); |
| 86 JUnitTestCase.assertFalse(iterator.moveNext()); |
| 87 } |
| 88 |
| 89 void test_put_noFlush() { |
| 90 CachePartition partition = new UniversalCachePartition(null, 8, new DefaultR
etentionPolicy()); |
| 91 AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); |
| 92 TestSource source = new TestSource(); |
| 93 DartEntryImpl entry = new DartEntryImpl(); |
| 94 cache.put(source, entry); |
| 95 JUnitTestCase.assertSame(entry, cache.get(source)); |
| 96 } |
| 97 |
| 98 void test_setMaxCacheSize() { |
| 99 CachePartition partition = new UniversalCachePartition(null, 8, new _Analysi
sCacheTest_test_setMaxCacheSize()); |
| 100 AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); |
| 101 int size = 6; |
| 102 for (int i = 0; i < size; i++) { |
| 103 Source source = new TestSource("/test${i}.dart"); |
| 104 DartEntryImpl entry = new DartEntryImpl(); |
| 105 entry.setValue(DartEntry.PARSED_UNIT, null); |
| 106 cache.put(source, entry); |
| 107 cache.accessedAst(source); |
| 108 } |
| 109 _assertNonFlushedCount(size, cache); |
| 110 int newSize = size - 2; |
| 111 partition.maxCacheSize = newSize; |
| 112 _assertNonFlushedCount(newSize, cache); |
| 113 } |
| 114 |
| 115 void test_size() { |
| 116 CachePartition partition = new UniversalCachePartition(null, 8, new DefaultR
etentionPolicy()); |
| 117 AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); |
| 118 int size = 4; |
| 119 for (int i = 0; i < size; i++) { |
| 120 Source source = new TestSource("/test${i}.dart"); |
| 121 cache.put(source, new DartEntryImpl()); |
| 122 cache.accessedAst(source); |
| 123 } |
| 124 JUnitTestCase.assertEquals(size, cache.size()); |
| 125 } |
| 126 |
| 127 void _assertNonFlushedCount(int expectedCount, AnalysisCache cache) { |
| 128 int nonFlushedCount = 0; |
| 129 MapIterator<Source, SourceEntry> iterator = cache.iterator(); |
| 130 while (iterator.moveNext()) { |
| 131 if (iterator.value.getState(DartEntry.PARSED_UNIT) != CacheState.FLUSHED)
{ |
| 132 nonFlushedCount++; |
| 133 } |
| 134 } |
| 135 JUnitTestCase.assertEquals(expectedCount, nonFlushedCount); |
| 136 } |
| 137 |
| 138 static dartSuite() { |
| 139 _ut.group('AnalysisCacheTest', () { |
| 140 _ut.test('test_creation', () { |
| 141 final __test = new AnalysisCacheTest(); |
| 142 runJUnitTest(__test, __test.test_creation); |
| 143 }); |
| 144 _ut.test('test_get', () { |
| 145 final __test = new AnalysisCacheTest(); |
| 146 runJUnitTest(__test, __test.test_get); |
| 147 }); |
| 148 _ut.test('test_iterator', () { |
| 149 final __test = new AnalysisCacheTest(); |
| 150 runJUnitTest(__test, __test.test_iterator); |
| 151 }); |
| 152 _ut.test('test_put_noFlush', () { |
| 153 final __test = new AnalysisCacheTest(); |
| 154 runJUnitTest(__test, __test.test_put_noFlush); |
| 155 }); |
| 156 _ut.test('test_setMaxCacheSize', () { |
| 157 final __test = new AnalysisCacheTest(); |
| 158 runJUnitTest(__test, __test.test_setMaxCacheSize); |
| 159 }); |
| 160 _ut.test('test_size', () { |
| 161 final __test = new AnalysisCacheTest(); |
| 162 runJUnitTest(__test, __test.test_size); |
| 163 }); |
| 164 }); |
| 165 } |
| 166 } |
| 167 |
| 168 |
| 169 class AnalysisContextImplTest extends EngineTestCase { |
| 170 /** |
| 171 * An analysis context whose source factory is [sourceFactory]. |
| 172 */ |
| 173 AnalysisContextImpl _context; |
| 174 |
| 175 /** |
| 176 * The source factory associated with the analysis [context]. |
| 177 */ |
| 178 SourceFactory _sourceFactory; |
| 179 |
| 180 void fail_extractContext() { |
| 181 JUnitTestCase.fail("Implement this"); |
| 182 } |
| 183 |
| 184 void fail_mergeContext() { |
| 185 JUnitTestCase.fail("Implement this"); |
| 186 } |
| 187 |
| 188 void fail_performAnalysisTask_importedLibraryDelete_html() { |
| 189 Source htmlSource = _addSource("/page.html", EngineTestCase.createSource([ |
| 190 "<html><body><script type=\"application/dart\">", |
| 191 " import 'libB.dart';", |
| 192 " main() {print('hello dart');}", |
| 193 "</script></body></html>"])); |
| 194 Source libBSource = _addSource("/libB.dart", "library libB;"); |
| 195 _analyzeAll_assertFinished(); |
| 196 JUnitTestCase.assertNotNullMsg("htmlUnit resolved 1", _context.getResolvedHt
mlUnit(htmlSource)); |
| 197 JUnitTestCase.assertNotNullMsg("libB resolved 1", _context.getResolvedCompil
ationUnit2(libBSource, libBSource)); |
| 198 JUnitTestCase.assertTrueMsg("htmlSource doesn't have errors", !_hasAnalysisE
rrorWithErrorSeverity(_context.getErrors(htmlSource))); |
| 199 // remove libB.dart content and analyze |
| 200 _context.setContents(libBSource, null); |
| 201 _analyzeAll_assertFinished(); |
| 202 JUnitTestCase.assertNotNullMsg("htmlUnit resolved 1", _context.getResolvedHt
mlUnit(htmlSource)); |
| 203 AnalysisErrorInfo errors = _context.getErrors(htmlSource); |
| 204 JUnitTestCase.assertTrueMsg("htmlSource has an error", _hasAnalysisErrorWith
ErrorSeverity(errors)); |
| 205 } |
| 206 |
| 207 void fail_recordLibraryElements() { |
| 208 JUnitTestCase.fail("Implement this"); |
| 209 } |
| 210 |
| 211 @override |
| 212 void setUp() { |
| 213 _context = new AnalysisContextImpl(); |
| 214 _sourceFactory = new SourceFactory([ |
| 215 new DartUriResolver(DirectoryBasedDartSdk.defaultSdk), |
| 216 new FileUriResolver()]); |
| 217 _context.sourceFactory = _sourceFactory; |
| 218 AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(_context.analysis
Options); |
| 219 options.cacheSize = 256; |
| 220 _context.analysisOptions = options; |
| 221 } |
| 222 |
| 223 @override |
| 224 void tearDown() { |
| 225 _context = null; |
| 226 _sourceFactory = null; |
| 227 super.tearDown(); |
| 228 } |
| 229 |
| 230 void test_applyChanges_add() { |
| 231 JUnitTestCase.assertTrue(_context.sourcesNeedingProcessing.isEmpty); |
| 232 Source source = _addSource("/test.dart", "main() {}"); |
| 233 JUnitTestCase.assertTrue(_context.sourcesNeedingProcessing.contains(source))
; |
| 234 } |
| 235 |
| 236 void test_applyChanges_change_flush_element() { |
| 237 _context = AnalysisContextFactory.contextWithCore(); |
| 238 _sourceFactory = _context.sourceFactory; |
| 239 Source librarySource = _addSource("/lib.dart", EngineTestCase.createSource([
"library lib;", "int a = 0;"])); |
| 240 JUnitTestCase.assertNotNull(_context.computeLibraryElement(librarySource)); |
| 241 _context.setContents(librarySource, EngineTestCase.createSource(["library li
b;", "int aa = 0;"])); |
| 242 JUnitTestCase.assertNull(_context.getLibraryElement(librarySource)); |
| 243 } |
| 244 |
| 245 void test_applyChanges_change_multiple() { |
| 246 _context = AnalysisContextFactory.contextWithCore(); |
| 247 _sourceFactory = _context.sourceFactory; |
| 248 Source librarySource = _addSource("/lib.dart", EngineTestCase.createSource([
"library lib;", "part 'part.dart';", "int a = 0;"])); |
| 249 Source partSource = _addSource("/part.dart", EngineTestCase.createSource(["p
art of lib;", "int b = a;"])); |
| 250 _context.computeLibraryElement(librarySource); |
| 251 _context.setContents(librarySource, EngineTestCase.createSource(["library li
b;", "part 'part.dart';", "int aa = 0;"])); |
| 252 _context.setContents(partSource, EngineTestCase.createSource(["part of lib;"
, "int b = aa;"])); |
| 253 _context.computeLibraryElement(librarySource); |
| 254 CompilationUnit libraryUnit = _context.resolveCompilationUnit2(librarySource
, librarySource); |
| 255 CompilationUnit partUnit = _context.resolveCompilationUnit2(partSource, libr
arySource); |
| 256 TopLevelVariableDeclaration declaration = libraryUnit.declarations[0] as Top
LevelVariableDeclaration; |
| 257 Element declarationElement = declaration.variables.variables[0].element; |
| 258 TopLevelVariableDeclaration use = partUnit.declarations[0] as TopLevelVariab
leDeclaration; |
| 259 Element useElement = (use.variables.variables[0].initializer as SimpleIdenti
fier).staticElement; |
| 260 JUnitTestCase.assertSame(declarationElement, (useElement as PropertyAccessor
Element).variable); |
| 261 } |
| 262 |
| 263 void test_applyChanges_empty() { |
| 264 _context.applyChanges(new ChangeSet()); |
| 265 JUnitTestCase.assertNull(_context.performAnalysisTask().changeNotices); |
| 266 } |
| 267 |
| 268 void test_applyChanges_overriddenSource() { |
| 269 // Note: addSource adds the source to the contentCache. |
| 270 Source source = _addSource("/test.dart", "library test;"); |
| 271 _context.computeErrors(source); |
| 272 while (!_context.sourcesNeedingProcessing.isEmpty) { |
| 273 _context.performAnalysisTask(); |
| 274 } |
| 275 // Adding the source as a changedSource should have no effect since |
| 276 // it is already overridden in the content cache. |
| 277 ChangeSet changeSet = new ChangeSet(); |
| 278 changeSet.changedSource(source); |
| 279 _context.applyChanges(changeSet); |
| 280 EngineTestCase.assertSizeOfList(0, _context.sourcesNeedingProcessing); |
| 281 } |
| 282 |
| 283 void test_applyChanges_remove() { |
| 284 _context = AnalysisContextFactory.contextWithCore(); |
| 285 _sourceFactory = _context.sourceFactory; |
| 286 Source libA = _addSource("/libA.dart", EngineTestCase.createSource(["library
libA;", "import 'libB.dart';"])); |
| 287 Source libB = _addSource("/libB.dart", EngineTestCase.createSource(["library
libB;"])); |
| 288 LibraryElement libAElement = _context.computeLibraryElement(libA); |
| 289 List<LibraryElement> importedLibraries = libAElement.importedLibraries; |
| 290 EngineTestCase.assertLength(2, importedLibraries); |
| 291 _context.computeErrors(libA); |
| 292 _context.computeErrors(libB); |
| 293 EngineTestCase.assertSizeOfList(0, _context.sourcesNeedingProcessing); |
| 294 _context.setContents(libB, null); |
| 295 _removeSource(libB); |
| 296 List<Source> sources = _context.sourcesNeedingProcessing; |
| 297 EngineTestCase.assertSizeOfList(1, sources); |
| 298 JUnitTestCase.assertSame(libA, sources[0]); |
| 299 libAElement = _context.computeLibraryElement(libA); |
| 300 importedLibraries = libAElement.importedLibraries; |
| 301 EngineTestCase.assertLength(1, importedLibraries); |
| 302 } |
| 303 |
| 304 void test_applyChanges_removeContainer() { |
| 305 _context = AnalysisContextFactory.contextWithCore(); |
| 306 _sourceFactory = _context.sourceFactory; |
| 307 Source libA = _addSource("/libA.dart", EngineTestCase.createSource(["library
libA;", "import 'libB.dart';"])); |
| 308 Source libB = _addSource("/libB.dart", EngineTestCase.createSource(["library
libB;"])); |
| 309 _context.computeLibraryElement(libA); |
| 310 _context.computeErrors(libA); |
| 311 _context.computeErrors(libB); |
| 312 EngineTestCase.assertSizeOfList(0, _context.sourcesNeedingProcessing); |
| 313 ChangeSet changeSet = new ChangeSet(); |
| 314 changeSet.removedContainer(new _AnalysisContextImplTest_test_applyChanges_re
moveContainer(libB)); |
| 315 _context.applyChanges(changeSet); |
| 316 List<Source> sources = _context.sourcesNeedingProcessing; |
| 317 EngineTestCase.assertSizeOfList(1, sources); |
| 318 JUnitTestCase.assertSame(libA, sources[0]); |
| 319 } |
| 320 |
| 321 void test_computeDocumentationComment_block() { |
| 322 _context = AnalysisContextFactory.contextWithCore(); |
| 323 _sourceFactory = _context.sourceFactory; |
| 324 String comment = "/** Comment */"; |
| 325 Source source = _addSource("/test.dart", EngineTestCase.createSource([commen
t, "class A {}"])); |
| 326 LibraryElement libraryElement = _context.computeLibraryElement(source); |
| 327 JUnitTestCase.assertNotNull(libraryElement); |
| 328 ClassElement classElement = libraryElement.definingCompilationUnit.types[0]; |
| 329 JUnitTestCase.assertNotNull(libraryElement); |
| 330 JUnitTestCase.assertEquals(comment, _context.computeDocumentationComment(cla
ssElement)); |
| 331 } |
| 332 |
| 333 void test_computeDocumentationComment_none() { |
| 334 _context = AnalysisContextFactory.contextWithCore(); |
| 335 _sourceFactory = _context.sourceFactory; |
| 336 Source source = _addSource("/test.dart", EngineTestCase.createSource(["class
A {}"])); |
| 337 LibraryElement libraryElement = _context.computeLibraryElement(source); |
| 338 JUnitTestCase.assertNotNull(libraryElement); |
| 339 ClassElement classElement = libraryElement.definingCompilationUnit.types[0]; |
| 340 JUnitTestCase.assertNotNull(libraryElement); |
| 341 JUnitTestCase.assertNull(_context.computeDocumentationComment(classElement))
; |
| 342 } |
| 343 |
| 344 void test_computeDocumentationComment_null() { |
| 345 JUnitTestCase.assertNull(_context.computeDocumentationComment(null)); |
| 346 } |
| 347 |
| 348 void test_computeDocumentationComment_singleLine_multiple_EOL_n() { |
| 349 _context = AnalysisContextFactory.contextWithCore(); |
| 350 _sourceFactory = _context.sourceFactory; |
| 351 String comment = "/// line 1\n/// line 2\n/// line 3\n"; |
| 352 Source source = _addSource("/test.dart", "${comment}class A {}"); |
| 353 LibraryElement libraryElement = _context.computeLibraryElement(source); |
| 354 JUnitTestCase.assertNotNull(libraryElement); |
| 355 ClassElement classElement = libraryElement.definingCompilationUnit.types[0]; |
| 356 JUnitTestCase.assertNotNull(libraryElement); |
| 357 String actual = _context.computeDocumentationComment(classElement); |
| 358 JUnitTestCase.assertEquals("/// line 1\n/// line 2\n/// line 3", actual); |
| 359 } |
| 360 |
| 361 void test_computeDocumentationComment_singleLine_multiple_EOL_rn() { |
| 362 _context = AnalysisContextFactory.contextWithCore(); |
| 363 _sourceFactory = _context.sourceFactory; |
| 364 String comment = "/// line 1\r\n/// line 2\r\n/// line 3\r\n"; |
| 365 Source source = _addSource("/test.dart", "${comment}class A {}"); |
| 366 LibraryElement libraryElement = _context.computeLibraryElement(source); |
| 367 JUnitTestCase.assertNotNull(libraryElement); |
| 368 ClassElement classElement = libraryElement.definingCompilationUnit.types[0]; |
| 369 JUnitTestCase.assertNotNull(libraryElement); |
| 370 String actual = _context.computeDocumentationComment(classElement); |
| 371 JUnitTestCase.assertEquals("/// line 1\n/// line 2\n/// line 3", actual); |
| 372 } |
| 373 |
| 374 void test_computeErrors_dart_none() { |
| 375 Source source = _addSource("/lib.dart", "library lib;"); |
| 376 List<AnalysisError> errors = _context.computeErrors(source); |
| 377 EngineTestCase.assertLength(0, errors); |
| 378 } |
| 379 |
| 380 void test_computeErrors_dart_part() { |
| 381 Source librarySource = _addSource("/lib.dart", "library lib; part 'part.dart
';"); |
| 382 Source partSource = _addSource("/part.dart", "part of 'lib';"); |
| 383 _context.parseCompilationUnit(librarySource); |
| 384 List<AnalysisError> errors = _context.computeErrors(partSource); |
| 385 JUnitTestCase.assertNotNull(errors); |
| 386 JUnitTestCase.assertTrue(errors.length > 0); |
| 387 } |
| 388 |
| 389 void test_computeErrors_dart_some() { |
| 390 Source source = _addSource("/lib.dart", "library 'lib';"); |
| 391 List<AnalysisError> errors = _context.computeErrors(source); |
| 392 JUnitTestCase.assertNotNull(errors); |
| 393 JUnitTestCase.assertTrue(errors.length > 0); |
| 394 } |
| 395 |
| 396 void test_computeErrors_html_none() { |
| 397 Source source = _addSource("/test.html", "<html></html>"); |
| 398 List<AnalysisError> errors = _context.computeErrors(source); |
| 399 EngineTestCase.assertLength(0, errors); |
| 400 } |
| 401 |
| 402 void test_computeExportedLibraries_none() { |
| 403 Source source = _addSource("/test.dart", "library test;"); |
| 404 EngineTestCase.assertLength(0, _context.computeExportedLibraries(source)); |
| 405 } |
| 406 |
| 407 void test_computeExportedLibraries_some() { |
| 408 // addSource("/lib1.dart", "library lib1;"); |
| 409 // addSource("/lib2.dart", "library lib2;"); |
| 410 Source source = _addSource("/test.dart", "library test; export 'lib1.dart';
export 'lib2.dart';"); |
| 411 EngineTestCase.assertLength(2, _context.computeExportedLibraries(source)); |
| 412 } |
| 413 |
| 414 void test_computeHtmlElement_nonHtml() { |
| 415 Source source = _addSource("/test.dart", "library test;"); |
| 416 JUnitTestCase.assertNull(_context.computeHtmlElement(source)); |
| 417 } |
| 418 |
| 419 void test_computeHtmlElement_valid() { |
| 420 Source source = _addSource("/test.html", "<html></html>"); |
| 421 HtmlElement element = _context.computeHtmlElement(source); |
| 422 JUnitTestCase.assertNotNull(element); |
| 423 JUnitTestCase.assertSame(element, _context.computeHtmlElement(source)); |
| 424 } |
| 425 |
| 426 void test_computeImportedLibraries_none() { |
| 427 Source source = _addSource("/test.dart", "library test;"); |
| 428 EngineTestCase.assertLength(0, _context.computeImportedLibraries(source)); |
| 429 } |
| 430 |
| 431 void test_computeImportedLibraries_some() { |
| 432 // addSource("/lib1.dart", "library lib1;"); |
| 433 // addSource("/lib2.dart", "library lib2;"); |
| 434 Source source = _addSource("/test.dart", "library test; import 'lib1.dart';
import 'lib2.dart';"); |
| 435 EngineTestCase.assertLength(2, _context.computeImportedLibraries(source)); |
| 436 } |
| 437 |
| 438 void test_computeKindOf_html() { |
| 439 Source source = _addSource("/test.html", ""); |
| 440 JUnitTestCase.assertSame(SourceKind.HTML, _context.computeKindOf(source)); |
| 441 } |
| 442 |
| 443 void test_computeKindOf_library() { |
| 444 Source source = _addSource("/test.dart", "library lib;"); |
| 445 JUnitTestCase.assertSame(SourceKind.LIBRARY, _context.computeKindOf(source))
; |
| 446 } |
| 447 |
| 448 void test_computeKindOf_libraryAndPart() { |
| 449 Source source = _addSource("/test.dart", "library lib; part of lib;"); |
| 450 JUnitTestCase.assertSame(SourceKind.LIBRARY, _context.computeKindOf(source))
; |
| 451 } |
| 452 |
| 453 void test_computeKindOf_part() { |
| 454 Source source = _addSource("/test.dart", "part of lib;"); |
| 455 JUnitTestCase.assertSame(SourceKind.PART, _context.computeKindOf(source)); |
| 456 } |
| 457 |
| 458 void test_computeLibraryElement() { |
| 459 _context = AnalysisContextFactory.contextWithCore(); |
| 460 _sourceFactory = _context.sourceFactory; |
| 461 Source source = _addSource("/test.dart", "library lib;"); |
| 462 LibraryElement element = _context.computeLibraryElement(source); |
| 463 JUnitTestCase.assertNotNull(element); |
| 464 } |
| 465 |
| 466 void test_computeLineInfo_dart() { |
| 467 Source source = _addSource("/test.dart", EngineTestCase.createSource(["libra
ry lib;", "", "main() {}"])); |
| 468 LineInfo info = _context.computeLineInfo(source); |
| 469 JUnitTestCase.assertNotNull(info); |
| 470 } |
| 471 |
| 472 void test_computeLineInfo_html() { |
| 473 Source source = _addSource("/test.html", EngineTestCase.createSource([ |
| 474 "<html>", |
| 475 " <body>", |
| 476 " <h1>A</h1>", |
| 477 " </body>", |
| 478 "</html>"])); |
| 479 LineInfo info = _context.computeLineInfo(source); |
| 480 JUnitTestCase.assertNotNull(info); |
| 481 } |
| 482 |
| 483 void test_computeResolvableCompilationUnit_dart_exception() { |
| 484 TestSource source = _addSourceWithException("/test.dart"); |
| 485 try { |
| 486 _context.computeResolvableCompilationUnit(source); |
| 487 JUnitTestCase.fail("Expected AnalysisException"); |
| 488 } on AnalysisException catch (exception) { |
| 489 } |
| 490 } |
| 491 |
| 492 void test_computeResolvableCompilationUnit_html_exception() { |
| 493 Source source = _addSource("/lib.html", "<html></html>"); |
| 494 try { |
| 495 _context.computeResolvableCompilationUnit(source); |
| 496 JUnitTestCase.fail("Expected AnalysisException"); |
| 497 } on AnalysisException catch (exception) { |
| 498 } |
| 499 } |
| 500 |
| 501 void test_computeResolvableCompilationUnit_valid() { |
| 502 Source source = _addSource("/lib.dart", "library lib;"); |
| 503 CompilationUnit parsedUnit = _context.parseCompilationUnit(source); |
| 504 JUnitTestCase.assertNotNull(parsedUnit); |
| 505 CompilationUnit resolvedUnit = _context.computeResolvableCompilationUnit(sou
rce).compilationUnit; |
| 506 JUnitTestCase.assertNotNull(resolvedUnit); |
| 507 JUnitTestCase.assertNotSame(parsedUnit, resolvedUnit); |
| 508 } |
| 509 |
| 510 void test_dispose() { |
| 511 JUnitTestCase.assertFalse(_context.isDisposed); |
| 512 _context.dispose(); |
| 513 JUnitTestCase.assertTrue(_context.isDisposed); |
| 514 } |
| 515 |
| 516 void test_exists_false() { |
| 517 TestSource source = new TestSource(); |
| 518 source.exists2 = false; |
| 519 JUnitTestCase.assertFalse(_context.exists(source)); |
| 520 } |
| 521 |
| 522 void test_exists_null() { |
| 523 JUnitTestCase.assertFalse(_context.exists(null)); |
| 524 } |
| 525 |
| 526 void test_exists_overridden() { |
| 527 Source source = new TestSource(); |
| 528 _context.setContents(source, ""); |
| 529 JUnitTestCase.assertTrue(_context.exists(source)); |
| 530 } |
| 531 |
| 532 void test_exists_true() { |
| 533 JUnitTestCase.assertTrue(_context.exists(new AnalysisContextImplTest_Source_
exists_true())); |
| 534 } |
| 535 |
| 536 void test_getAnalysisOptions() { |
| 537 JUnitTestCase.assertNotNull(_context.analysisOptions); |
| 538 } |
| 539 |
| 540 void test_getContents_fromSource() { |
| 541 String content = "library lib;"; |
| 542 TimestampedData<String> contents = _context.getContents(new TestSource('/tes
t.dart', content)); |
| 543 JUnitTestCase.assertEquals(content, contents.data.toString()); |
| 544 } |
| 545 |
| 546 void test_getContents_overridden() { |
| 547 String content = "library lib;"; |
| 548 Source source = new TestSource(); |
| 549 _context.setContents(source, content); |
| 550 TimestampedData<String> contents = _context.getContents(source); |
| 551 JUnitTestCase.assertEquals(content, contents.data.toString()); |
| 552 } |
| 553 |
| 554 void test_getContents_unoverridden() { |
| 555 String content = "library lib;"; |
| 556 Source source = new TestSource('/test.dart', content); |
| 557 _context.setContents(source, "part of lib;"); |
| 558 _context.setContents(source, null); |
| 559 TimestampedData<String> contents = _context.getContents(source); |
| 560 JUnitTestCase.assertEquals(content, contents.data.toString()); |
| 561 } |
| 562 |
| 563 void test_getDeclaredVariables() { |
| 564 _context = AnalysisContextFactory.contextWithCore(); |
| 565 JUnitTestCase.assertNotNull(_context.declaredVariables); |
| 566 } |
| 567 |
| 568 void test_getElement() { |
| 569 _context = AnalysisContextFactory.contextWithCore(); |
| 570 _sourceFactory = _context.sourceFactory; |
| 571 LibraryElement core = _context.computeLibraryElement(_sourceFactory.forUri("
dart:core")); |
| 572 JUnitTestCase.assertNotNull(core); |
| 573 ClassElement classObject = _findClass(core.definingCompilationUnit, "Object"
); |
| 574 JUnitTestCase.assertNotNull(classObject); |
| 575 ElementLocation location = classObject.location; |
| 576 Element element = _context.getElement(location); |
| 577 JUnitTestCase.assertSame(classObject, element); |
| 578 } |
| 579 |
| 580 void test_getElement_constructor_named() { |
| 581 Source source = _addSource("/lib.dart", EngineTestCase.createSource(["class
A {", " A.named() {}", "}"])); |
| 582 _analyzeAll_assertFinished(); |
| 583 LibraryElement library = _context.computeLibraryElement(source); |
| 584 ClassElement classA = _findClass(library.definingCompilationUnit, "A"); |
| 585 ConstructorElement constructor = classA.constructors[0]; |
| 586 ElementLocation location = constructor.location; |
| 587 Element element = _context.getElement(location); |
| 588 JUnitTestCase.assertSame(constructor, element); |
| 589 } |
| 590 |
| 591 void test_getElement_constructor_unnamed() { |
| 592 Source source = _addSource("/lib.dart", EngineTestCase.createSource(["class
A {", " A() {}", "}"])); |
| 593 _analyzeAll_assertFinished(); |
| 594 LibraryElement library = _context.computeLibraryElement(source); |
| 595 ClassElement classA = _findClass(library.definingCompilationUnit, "A"); |
| 596 ConstructorElement constructor = classA.constructors[0]; |
| 597 ElementLocation location = constructor.location; |
| 598 Element element = _context.getElement(location); |
| 599 JUnitTestCase.assertSame(constructor, element); |
| 600 } |
| 601 |
| 602 void test_getErrors_dart_none() { |
| 603 Source source = _addSource("/lib.dart", "library lib;"); |
| 604 List<AnalysisError> errors = _context.getErrors(source).errors; |
| 605 EngineTestCase.assertLength(0, errors); |
| 606 _context.computeErrors(source); |
| 607 errors = _context.getErrors(source).errors; |
| 608 EngineTestCase.assertLength(0, errors); |
| 609 } |
| 610 |
| 611 void test_getErrors_dart_some() { |
| 612 Source source = _addSource("/lib.dart", "library 'lib';"); |
| 613 List<AnalysisError> errors = _context.getErrors(source).errors; |
| 614 EngineTestCase.assertLength(0, errors); |
| 615 _context.computeErrors(source); |
| 616 errors = _context.getErrors(source).errors; |
| 617 EngineTestCase.assertLength(1, errors); |
| 618 } |
| 619 |
| 620 void test_getErrors_html_none() { |
| 621 Source source = _addSource("/test.html", "<html></html>"); |
| 622 List<AnalysisError> errors = _context.getErrors(source).errors; |
| 623 EngineTestCase.assertLength(0, errors); |
| 624 _context.computeErrors(source); |
| 625 errors = _context.getErrors(source).errors; |
| 626 EngineTestCase.assertLength(0, errors); |
| 627 } |
| 628 |
| 629 void test_getErrors_html_some() { |
| 630 Source source = _addSource("/test.html", EngineTestCase.createSource([ |
| 631 "<html><head>", |
| 632 "<script type='application/dart' src='test.dart'/>", |
| 633 "</head></html>"])); |
| 634 List<AnalysisError> errors = _context.getErrors(source).errors; |
| 635 EngineTestCase.assertLength(0, errors); |
| 636 _context.computeErrors(source); |
| 637 errors = _context.getErrors(source).errors; |
| 638 EngineTestCase.assertLength(1, errors); |
| 639 } |
| 640 |
| 641 void test_getHtmlElement_dart() { |
| 642 Source source = _addSource("/test.dart", ""); |
| 643 JUnitTestCase.assertNull(_context.getHtmlElement(source)); |
| 644 JUnitTestCase.assertNull(_context.computeHtmlElement(source)); |
| 645 JUnitTestCase.assertNull(_context.getHtmlElement(source)); |
| 646 } |
| 647 |
| 648 void test_getHtmlElement_html() { |
| 649 Source source = _addSource("/test.html", "<html></html>"); |
| 650 HtmlElement element = _context.getHtmlElement(source); |
| 651 JUnitTestCase.assertNull(element); |
| 652 _context.computeHtmlElement(source); |
| 653 element = _context.getHtmlElement(source); |
| 654 JUnitTestCase.assertNotNull(element); |
| 655 } |
| 656 |
| 657 void test_getHtmlFilesReferencing_html() { |
| 658 _context = AnalysisContextFactory.contextWithCore(); |
| 659 _sourceFactory = _context.sourceFactory; |
| 660 Source htmlSource = _addSource("/test.html", EngineTestCase.createSource([ |
| 661 "<html><head>", |
| 662 "<script type='application/dart' src='test.dart'/>", |
| 663 "<script type='application/dart' src='test.js'/>", |
| 664 "</head></html>"])); |
| 665 Source librarySource = _addSource("/test.dart", "library lib;"); |
| 666 Source secondHtmlSource = _addSource("/test.html", "<html></html>"); |
| 667 _context.computeLibraryElement(librarySource); |
| 668 List<Source> result = _context.getHtmlFilesReferencing(secondHtmlSource); |
| 669 EngineTestCase.assertLength(0, result); |
| 670 _context.parseHtmlUnit(htmlSource); |
| 671 result = _context.getHtmlFilesReferencing(secondHtmlSource); |
| 672 EngineTestCase.assertLength(0, result); |
| 673 } |
| 674 |
| 675 void test_getHtmlFilesReferencing_library() { |
| 676 Source htmlSource = _addSource("/test.html", EngineTestCase.createSource([ |
| 677 "<html><head>", |
| 678 "<script type='application/dart' src='test.dart'/>", |
| 679 "<script type='application/dart' src='test.js'/>", |
| 680 "</head></html>"])); |
| 681 Source librarySource = _addSource("/test.dart", "library lib;"); |
| 682 List<Source> result = _context.getHtmlFilesReferencing(librarySource); |
| 683 EngineTestCase.assertLength(0, result); |
| 684 _context.parseHtmlUnit(htmlSource); |
| 685 result = _context.getHtmlFilesReferencing(librarySource); |
| 686 EngineTestCase.assertLength(1, result); |
| 687 JUnitTestCase.assertEquals(htmlSource, result[0]); |
| 688 } |
| 689 |
| 690 void test_getHtmlFilesReferencing_part() { |
| 691 _context = AnalysisContextFactory.contextWithCore(); |
| 692 _sourceFactory = _context.sourceFactory; |
| 693 Source htmlSource = _addSource("/test.html", EngineTestCase.createSource([ |
| 694 "<html><head>", |
| 695 "<script type='application/dart' src='test.dart'/>", |
| 696 "<script type='application/dart' src='test.js'/>", |
| 697 "</head></html>"])); |
| 698 Source librarySource = _addSource("/test.dart", "library lib; part 'part.dar
t';"); |
| 699 Source partSource = _addSource("/part.dart", "part of lib;"); |
| 700 _context.computeLibraryElement(librarySource); |
| 701 List<Source> result = _context.getHtmlFilesReferencing(partSource); |
| 702 EngineTestCase.assertLength(0, result); |
| 703 _context.parseHtmlUnit(htmlSource); |
| 704 result = _context.getHtmlFilesReferencing(partSource); |
| 705 EngineTestCase.assertLength(1, result); |
| 706 JUnitTestCase.assertEquals(htmlSource, result[0]); |
| 707 } |
| 708 |
| 709 void test_getHtmlSources() { |
| 710 List<Source> sources = _context.htmlSources; |
| 711 EngineTestCase.assertLength(0, sources); |
| 712 Source source = _addSource("/test.html", ""); |
| 713 _context.computeKindOf(source); |
| 714 sources = _context.htmlSources; |
| 715 EngineTestCase.assertLength(1, sources); |
| 716 JUnitTestCase.assertEquals(source, sources[0]); |
| 717 } |
| 718 |
| 719 void test_getKindOf_html() { |
| 720 Source source = _addSource("/test.html", ""); |
| 721 JUnitTestCase.assertSame(SourceKind.HTML, _context.getKindOf(source)); |
| 722 } |
| 723 |
| 724 void test_getKindOf_library() { |
| 725 Source source = _addSource("/test.dart", "library lib;"); |
| 726 JUnitTestCase.assertSame(SourceKind.UNKNOWN, _context.getKindOf(source)); |
| 727 _context.computeKindOf(source); |
| 728 JUnitTestCase.assertSame(SourceKind.LIBRARY, _context.getKindOf(source)); |
| 729 } |
| 730 |
| 731 void test_getKindOf_part() { |
| 732 Source source = _addSource("/test.dart", "part of lib;"); |
| 733 JUnitTestCase.assertSame(SourceKind.UNKNOWN, _context.getKindOf(source)); |
| 734 _context.computeKindOf(source); |
| 735 JUnitTestCase.assertSame(SourceKind.PART, _context.getKindOf(source)); |
| 736 } |
| 737 |
| 738 void test_getKindOf_unknown() { |
| 739 Source source = _addSource("/test.css", ""); |
| 740 JUnitTestCase.assertSame(SourceKind.UNKNOWN, _context.getKindOf(source)); |
| 741 } |
| 742 |
| 743 void test_getLaunchableClientLibrarySources() { |
| 744 _context = AnalysisContextFactory.contextWithCore(); |
| 745 _sourceFactory = _context.sourceFactory; |
| 746 List<Source> sources = _context.launchableClientLibrarySources; |
| 747 EngineTestCase.assertLength(0, sources); |
| 748 Source source = _addSource("/test.dart", EngineTestCase.createSource(["impor
t 'dart:html';", "main() {}"])); |
| 749 _context.computeLibraryElement(source); |
| 750 sources = _context.launchableClientLibrarySources; |
| 751 EngineTestCase.assertLength(1, sources); |
| 752 } |
| 753 |
| 754 void test_getLaunchableServerLibrarySources() { |
| 755 _context = AnalysisContextFactory.contextWithCore(); |
| 756 _sourceFactory = _context.sourceFactory; |
| 757 List<Source> sources = _context.launchableServerLibrarySources; |
| 758 EngineTestCase.assertLength(0, sources); |
| 759 Source source = _addSource("/test.dart", "main() {}"); |
| 760 _context.computeLibraryElement(source); |
| 761 sources = _context.launchableServerLibrarySources; |
| 762 EngineTestCase.assertLength(1, sources); |
| 763 } |
| 764 |
| 765 void test_getLibrariesContaining() { |
| 766 _context = AnalysisContextFactory.contextWithCore(); |
| 767 _sourceFactory = _context.sourceFactory; |
| 768 Source librarySource = _addSource("/lib.dart", EngineTestCase.createSource([
"library lib;", "part 'part.dart';"])); |
| 769 Source partSource = _addSource("/part.dart", "part of lib;"); |
| 770 _context.computeLibraryElement(librarySource); |
| 771 List<Source> result = _context.getLibrariesContaining(librarySource); |
| 772 EngineTestCase.assertLength(1, result); |
| 773 JUnitTestCase.assertEquals(librarySource, result[0]); |
| 774 result = _context.getLibrariesContaining(partSource); |
| 775 EngineTestCase.assertLength(1, result); |
| 776 JUnitTestCase.assertEquals(librarySource, result[0]); |
| 777 } |
| 778 |
| 779 void test_getLibrariesDependingOn() { |
| 780 _context = AnalysisContextFactory.contextWithCore(); |
| 781 _sourceFactory = _context.sourceFactory; |
| 782 Source libASource = _addSource("/libA.dart", "library libA;"); |
| 783 _addSource("/libB.dart", "library libB;"); |
| 784 Source lib1Source = _addSource("/lib1.dart", EngineTestCase.createSource([ |
| 785 "library lib1;", |
| 786 "import 'libA.dart';", |
| 787 "export 'libB.dart';"])); |
| 788 Source lib2Source = _addSource("/lib2.dart", EngineTestCase.createSource([ |
| 789 "library lib2;", |
| 790 "import 'libB.dart';", |
| 791 "export 'libA.dart';"])); |
| 792 _context.computeLibraryElement(lib1Source); |
| 793 _context.computeLibraryElement(lib2Source); |
| 794 List<Source> result = _context.getLibrariesDependingOn(libASource); |
| 795 EngineTestCase.assertContains(result, [lib1Source, lib2Source]); |
| 796 } |
| 797 |
| 798 void test_getLibrariesReferencedFromHtml() { |
| 799 _context = AnalysisContextFactory.contextWithCore(); |
| 800 _sourceFactory = _context.sourceFactory; |
| 801 Source htmlSource = _addSource("/test.html", EngineTestCase.createSource([ |
| 802 "<html><head>", |
| 803 "<script type='application/dart' src='test.dart'/>", |
| 804 "<script type='application/dart' src='test.js'/>", |
| 805 "</head></html>"])); |
| 806 Source librarySource = _addSource("/test.dart", "library lib;"); |
| 807 _context.computeLibraryElement(librarySource); |
| 808 _context.parseHtmlUnit(htmlSource); |
| 809 List<Source> result = _context.getLibrariesReferencedFromHtml(htmlSource); |
| 810 EngineTestCase.assertLength(1, result); |
| 811 JUnitTestCase.assertEquals(librarySource, result[0]); |
| 812 } |
| 813 |
| 814 void test_getLibrariesReferencedFromHtml_no() { |
| 815 _context = AnalysisContextFactory.contextWithCore(); |
| 816 _sourceFactory = _context.sourceFactory; |
| 817 Source htmlSource = _addSource("/test.html", EngineTestCase.createSource([ |
| 818 "<html><head>", |
| 819 "<script type='application/dart' src='test.js'/>", |
| 820 "</head></html>"])); |
| 821 _addSource("/test.dart", "library lib;"); |
| 822 _context.parseHtmlUnit(htmlSource); |
| 823 List<Source> result = _context.getLibrariesReferencedFromHtml(htmlSource); |
| 824 EngineTestCase.assertLength(0, result); |
| 825 } |
| 826 |
| 827 void test_getLibraryElement() { |
| 828 _context = AnalysisContextFactory.contextWithCore(); |
| 829 _sourceFactory = _context.sourceFactory; |
| 830 Source source = _addSource("/test.dart", "library lib;"); |
| 831 LibraryElement element = _context.getLibraryElement(source); |
| 832 JUnitTestCase.assertNull(element); |
| 833 _context.computeLibraryElement(source); |
| 834 element = _context.getLibraryElement(source); |
| 835 JUnitTestCase.assertNotNull(element); |
| 836 } |
| 837 |
| 838 void test_getLibrarySources() { |
| 839 List<Source> sources = _context.librarySources; |
| 840 int originalLength = sources.length; |
| 841 Source source = _addSource("/test.dart", "library lib;"); |
| 842 _context.computeKindOf(source); |
| 843 sources = _context.librarySources; |
| 844 EngineTestCase.assertLength(originalLength + 1, sources); |
| 845 for (Source returnedSource in sources) { |
| 846 if (returnedSource == source) { |
| 847 return; |
| 848 } |
| 849 } |
| 850 JUnitTestCase.fail("The added source was not in the list of library sources"
); |
| 851 } |
| 852 |
| 853 void test_getLineInfo() { |
| 854 Source source = _addSource("/test.dart", EngineTestCase.createSource(["libra
ry lib;", "", "main() {}"])); |
| 855 LineInfo info = _context.getLineInfo(source); |
| 856 JUnitTestCase.assertNull(info); |
| 857 _context.parseCompilationUnit(source); |
| 858 info = _context.getLineInfo(source); |
| 859 JUnitTestCase.assertNotNull(info); |
| 860 } |
| 861 |
| 862 void test_getModificationStamp_fromSource() { |
| 863 int stamp = 42; |
| 864 JUnitTestCase.assertEquals(stamp, _context.getModificationStamp(new Analysis
ContextImplTest_Source_getModificationStamp_fromSource(stamp))); |
| 865 } |
| 866 |
| 867 void test_getModificationStamp_overridden() { |
| 868 int stamp = 42; |
| 869 Source source = new AnalysisContextImplTest_Source_getModificationStamp_over
ridden(stamp); |
| 870 _context.setContents(source, ""); |
| 871 JUnitTestCase.assertTrue(stamp != _context.getModificationStamp(source)); |
| 872 } |
| 873 |
| 874 void test_getPublicNamespace_element() { |
| 875 _context = AnalysisContextFactory.contextWithCore(); |
| 876 _sourceFactory = _context.sourceFactory; |
| 877 Source source = _addSource("/test.dart", "class A {}"); |
| 878 LibraryElement library = _context.computeLibraryElement(source); |
| 879 Namespace namespace = _context.getPublicNamespace(library); |
| 880 JUnitTestCase.assertNotNull(namespace); |
| 881 EngineTestCase.assertInstanceOf((obj) => obj is ClassElement, ClassElement,
namespace.get("A")); |
| 882 } |
| 883 |
| 884 void test_getRefactoringUnsafeSources() { |
| 885 // not sources initially |
| 886 List<Source> sources = _context.refactoringUnsafeSources; |
| 887 EngineTestCase.assertLength(0, sources); |
| 888 // add new source, unresolved |
| 889 Source source = _addSource("/test.dart", "library lib;"); |
| 890 sources = _context.refactoringUnsafeSources; |
| 891 EngineTestCase.assertLength(1, sources); |
| 892 JUnitTestCase.assertEquals(source, sources[0]); |
| 893 // resolve source |
| 894 _context.computeLibraryElement(source); |
| 895 sources = _context.refactoringUnsafeSources; |
| 896 EngineTestCase.assertLength(0, sources); |
| 897 } |
| 898 |
| 899 void test_getResolvedCompilationUnit_library() { |
| 900 _context = AnalysisContextFactory.contextWithCore(); |
| 901 _sourceFactory = _context.sourceFactory; |
| 902 Source source = _addSource("/lib.dart", "library libb;"); |
| 903 LibraryElement library = _context.computeLibraryElement(source); |
| 904 JUnitTestCase.assertNotNull(_context.getResolvedCompilationUnit(source, libr
ary)); |
| 905 _context.setContents(source, "library lib;"); |
| 906 JUnitTestCase.assertNull(_context.getResolvedCompilationUnit(source, library
)); |
| 907 } |
| 908 |
| 909 void test_getResolvedCompilationUnit_library_null() { |
| 910 _context = AnalysisContextFactory.contextWithCore(); |
| 911 _sourceFactory = _context.sourceFactory; |
| 912 Source source = _addSource("/lib.dart", "library lib;"); |
| 913 JUnitTestCase.assertNull(_context.getResolvedCompilationUnit(source, null)); |
| 914 } |
| 915 |
| 916 void test_getResolvedCompilationUnit_source_dart() { |
| 917 _context = AnalysisContextFactory.contextWithCore(); |
| 918 _sourceFactory = _context.sourceFactory; |
| 919 Source source = _addSource("/lib.dart", "library lib;"); |
| 920 JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(source, source
)); |
| 921 _context.resolveCompilationUnit2(source, source); |
| 922 JUnitTestCase.assertNotNull(_context.getResolvedCompilationUnit2(source, sou
rce)); |
| 923 } |
| 924 |
| 925 void test_getResolvedCompilationUnit_source_html() { |
| 926 _context = AnalysisContextFactory.contextWithCore(); |
| 927 _sourceFactory = _context.sourceFactory; |
| 928 Source source = _addSource("/test.html", "<html></html>"); |
| 929 JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(source, source
)); |
| 930 JUnitTestCase.assertNull(_context.resolveCompilationUnit2(source, source)); |
| 931 JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(source, source
)); |
| 932 } |
| 933 |
| 934 void test_getResolvedHtmlUnit() { |
| 935 _context = AnalysisContextFactory.contextWithCore(); |
| 936 _sourceFactory = _context.sourceFactory; |
| 937 Source source = _addSource("/test.html", "<html></html>"); |
| 938 JUnitTestCase.assertNull(_context.getResolvedHtmlUnit(source)); |
| 939 _context.resolveHtmlUnit(source); |
| 940 JUnitTestCase.assertNotNull(_context.getResolvedHtmlUnit(source)); |
| 941 } |
| 942 |
| 943 void test_getSourceFactory() { |
| 944 JUnitTestCase.assertSame(_sourceFactory, _context.sourceFactory); |
| 945 } |
| 946 |
| 947 void test_getStatistics() { |
| 948 AnalysisContextStatistics statistics = _context.statistics; |
| 949 JUnitTestCase.assertNotNull(statistics); |
| 950 } |
| 951 |
| 952 void test_isClientLibrary_dart() { |
| 953 _context = AnalysisContextFactory.contextWithCore(); |
| 954 _sourceFactory = _context.sourceFactory; |
| 955 Source source = _addSource("/test.dart", EngineTestCase.createSource(["impor
t 'dart:html';", "", "main() {}"])); |
| 956 JUnitTestCase.assertFalse(_context.isClientLibrary(source)); |
| 957 JUnitTestCase.assertFalse(_context.isServerLibrary(source)); |
| 958 _context.computeLibraryElement(source); |
| 959 JUnitTestCase.assertTrue(_context.isClientLibrary(source)); |
| 960 JUnitTestCase.assertFalse(_context.isServerLibrary(source)); |
| 961 } |
| 962 |
| 963 void test_isClientLibrary_html() { |
| 964 Source source = _addSource("/test.html", "<html></html>"); |
| 965 JUnitTestCase.assertFalse(_context.isClientLibrary(source)); |
| 966 } |
| 967 |
| 968 void test_isServerLibrary_dart() { |
| 969 _context = AnalysisContextFactory.contextWithCore(); |
| 970 _sourceFactory = _context.sourceFactory; |
| 971 Source source = _addSource("/test.dart", EngineTestCase.createSource(["libra
ry lib;", "", "main() {}"])); |
| 972 JUnitTestCase.assertFalse(_context.isClientLibrary(source)); |
| 973 JUnitTestCase.assertFalse(_context.isServerLibrary(source)); |
| 974 _context.computeLibraryElement(source); |
| 975 JUnitTestCase.assertFalse(_context.isClientLibrary(source)); |
| 976 JUnitTestCase.assertTrue(_context.isServerLibrary(source)); |
| 977 } |
| 978 |
| 979 void test_isServerLibrary_html() { |
| 980 Source source = _addSource("/test.html", "<html></html>"); |
| 981 JUnitTestCase.assertFalse(_context.isServerLibrary(source)); |
| 982 } |
| 983 |
| 984 void test_parseCompilationUnit_errors() { |
| 985 Source source = _addSource("/lib.dart", "library {"); |
| 986 CompilationUnit compilationUnit = _context.parseCompilationUnit(source); |
| 987 JUnitTestCase.assertNotNull(compilationUnit); |
| 988 List<AnalysisError> errors = _context.getErrors(source).errors; |
| 989 JUnitTestCase.assertNotNull(errors); |
| 990 JUnitTestCase.assertTrue(errors.length > 0); |
| 991 } |
| 992 |
| 993 void test_parseCompilationUnit_exception() { |
| 994 Source source = _addSourceWithException("/test.dart"); |
| 995 try { |
| 996 _context.parseCompilationUnit(source); |
| 997 JUnitTestCase.fail("Expected AnalysisException"); |
| 998 } on AnalysisException catch (exception) { |
| 999 } |
| 1000 } |
| 1001 |
| 1002 void test_parseCompilationUnit_html() { |
| 1003 Source source = _addSource("/test.html", "<html></html>"); |
| 1004 JUnitTestCase.assertNull(_context.parseCompilationUnit(source)); |
| 1005 } |
| 1006 |
| 1007 void test_parseCompilationUnit_noErrors() { |
| 1008 Source source = _addSource("/lib.dart", "library lib;"); |
| 1009 CompilationUnit compilationUnit = _context.parseCompilationUnit(source); |
| 1010 JUnitTestCase.assertNotNull(compilationUnit); |
| 1011 EngineTestCase.assertLength(0, _context.getErrors(source).errors); |
| 1012 } |
| 1013 |
| 1014 void test_parseCompilationUnit_nonExistentSource() { |
| 1015 Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test.da
rt")); |
| 1016 try { |
| 1017 _context.parseCompilationUnit(source); |
| 1018 JUnitTestCase.fail("Expected AnalysisException because file does not exist
"); |
| 1019 } on AnalysisException catch (exception) { |
| 1020 } |
| 1021 } |
| 1022 |
| 1023 void test_parseHtmlUnit_noErrors() { |
| 1024 Source source = _addSource("/lib.html", "<html></html>"); |
| 1025 ht.HtmlUnit unit = _context.parseHtmlUnit(source); |
| 1026 JUnitTestCase.assertNotNull(unit); |
| 1027 } |
| 1028 |
| 1029 void test_parseHtmlUnit_resolveDirectives() { |
| 1030 Source libSource = _addSource("/lib.dart", EngineTestCase.createSource(["lib
rary lib;", "class ClassA {}"])); |
| 1031 Source source = _addSource("/lib.html", EngineTestCase.createSource([ |
| 1032 "<html>", |
| 1033 "<head>", |
| 1034 " <script type='application/dart'>", |
| 1035 " import 'lib.dart';", |
| 1036 " ClassA v = null;", |
| 1037 " </script>", |
| 1038 "</head>", |
| 1039 "<body>", |
| 1040 "</body>", |
| 1041 "</html>"])); |
| 1042 ht.HtmlUnit unit = _context.parseHtmlUnit(source); |
| 1043 // import directive should be resolved |
| 1044 ht.XmlTagNode htmlNode = unit.tagNodes[0]; |
| 1045 ht.XmlTagNode headNode = htmlNode.tagNodes[0]; |
| 1046 ht.HtmlScriptTagNode scriptNode = headNode.tagNodes[0]; |
| 1047 CompilationUnit script = scriptNode.script; |
| 1048 ImportDirective importNode = script.directives[0] as ImportDirective; |
| 1049 JUnitTestCase.assertNotNull(importNode.uriContent); |
| 1050 JUnitTestCase.assertEquals(libSource, importNode.source); |
| 1051 } |
| 1052 |
| 1053 void test_performAnalysisTask_IOException() { |
| 1054 TestSource source = _addSourceWithException2("/test.dart", "library test;"); |
| 1055 int oldTimestamp = _context.getModificationStamp(source); |
| 1056 source.generateExceptionOnRead = false; |
| 1057 _analyzeAll_assertFinished(); |
| 1058 JUnitTestCase.assertEquals(1, source.readCount); |
| 1059 source.generateExceptionOnRead = true; |
| 1060 do { |
| 1061 _changeSource(source, ""); |
| 1062 } while (oldTimestamp == _context.getModificationStamp(source)); |
| 1063 _analyzeAll_assertFinished(); |
| 1064 JUnitTestCase.assertEquals(2, source.readCount); |
| 1065 } |
| 1066 |
| 1067 void test_performAnalysisTask_addPart() { |
| 1068 Source libSource = _addSource("/lib.dart", EngineTestCase.createSource(["lib
rary lib;", "part 'part.dart';"])); |
| 1069 // run all tasks without part |
| 1070 _analyzeAll_assertFinished(); |
| 1071 // add part and run all tasks |
| 1072 Source partSource = _addSource("/part.dart", EngineTestCase.createSource(["p
art of lib;", ""])); |
| 1073 _analyzeAll_assertFinished(); |
| 1074 // "libSource" should be here |
| 1075 List<Source> librariesWithPart = _context.getLibrariesContaining(partSource)
; |
| 1076 EngineTestCase.assertContains(librariesWithPart, [libSource]); |
| 1077 } |
| 1078 |
| 1079 void test_performAnalysisTask_changeLibraryContents() { |
| 1080 Source libSource = _addSource("/test.dart", "library lib; part 'test-part.da
rt';"); |
| 1081 Source partSource = _addSource("/test-part.dart", "part of lib;"); |
| 1082 _analyzeAll_assertFinished(); |
| 1083 JUnitTestCase.assertNotNullMsg("library resolved 1", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1084 JUnitTestCase.assertNotNullMsg("part resolved 1", _context.getResolvedCompil
ationUnit2(partSource, libSource)); |
| 1085 // update and analyze #1 |
| 1086 _context.setContents(libSource, "library lib;"); |
| 1087 JUnitTestCase.assertNullMsg("library changed 2", _context.getResolvedCompila
tionUnit2(libSource, libSource)); |
| 1088 JUnitTestCase.assertNullMsg("part changed 2", _context.getResolvedCompilatio
nUnit2(partSource, libSource)); |
| 1089 _analyzeAll_assertFinished(); |
| 1090 JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1091 JUnitTestCase.assertNullMsg("part resolved 2", _context.getResolvedCompilati
onUnit2(partSource, libSource)); |
| 1092 // update and analyze #2 |
| 1093 _context.setContents(libSource, "library lib; part 'test-part.dart';"); |
| 1094 JUnitTestCase.assertNullMsg("library changed 3", _context.getResolvedCompila
tionUnit2(libSource, libSource)); |
| 1095 JUnitTestCase.assertNullMsg("part changed 3", _context.getResolvedCompilatio
nUnit2(partSource, libSource)); |
| 1096 _analyzeAll_assertFinished(); |
| 1097 JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1098 JUnitTestCase.assertNotNullMsg("part resolved 3", _context.getResolvedCompil
ationUnit2(partSource, libSource)); |
| 1099 } |
| 1100 |
| 1101 void test_performAnalysisTask_changeLibraryThenPartContents() { |
| 1102 Source libSource = _addSource("/test.dart", "library lib; part 'test-part.da
rt';"); |
| 1103 Source partSource = _addSource("/test-part.dart", "part of lib;"); |
| 1104 _analyzeAll_assertFinished(); |
| 1105 JUnitTestCase.assertNotNullMsg("library resolved 1", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1106 JUnitTestCase.assertNotNullMsg("part resolved 1", _context.getResolvedCompil
ationUnit2(partSource, libSource)); |
| 1107 // update and analyze #1 |
| 1108 _context.setContents(libSource, "library lib;"); |
| 1109 JUnitTestCase.assertNullMsg("library changed 2", _context.getResolvedCompila
tionUnit2(libSource, libSource)); |
| 1110 JUnitTestCase.assertNullMsg("part changed 2", _context.getResolvedCompilatio
nUnit2(partSource, libSource)); |
| 1111 _analyzeAll_assertFinished(); |
| 1112 JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1113 JUnitTestCase.assertNullMsg("part resolved 2", _context.getResolvedCompilati
onUnit2(partSource, libSource)); |
| 1114 // update and analyze #2 |
| 1115 _context.setContents(partSource, "part of lib; // 1"); |
| 1116 // Assert that changing the part's content does not effect the library |
| 1117 // now that it is no longer part of that library |
| 1118 JUnitTestCase.assertNotNullMsg("library changed 3", _context.getResolvedComp
ilationUnit2(libSource, libSource)); |
| 1119 JUnitTestCase.assertNullMsg("part changed 3", _context.getResolvedCompilatio
nUnit2(partSource, libSource)); |
| 1120 _analyzeAll_assertFinished(); |
| 1121 JUnitTestCase.assertNotNullMsg("library resolved 3", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1122 JUnitTestCase.assertNullMsg("part resolved 3", _context.getResolvedCompilati
onUnit2(partSource, libSource)); |
| 1123 } |
| 1124 |
| 1125 void test_performAnalysisTask_changePartContents_makeItAPart() { |
| 1126 Source libSource = _addSource("/lib.dart", EngineTestCase.createSource(["lib
rary lib;", "part 'part.dart';", "void f(x) {}"])); |
| 1127 Source partSource = _addSource("/part.dart", EngineTestCase.createSource(["v
oid g() { f(null); }"])); |
| 1128 _analyzeAll_assertFinished(); |
| 1129 JUnitTestCase.assertNotNullMsg("library resolved 1", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1130 JUnitTestCase.assertNotNullMsg("part resolved 1", _context.getResolvedCompil
ationUnit2(partSource, libSource)); |
| 1131 // update and analyze |
| 1132 _context.setContents(partSource, EngineTestCase.createSource(["part of lib;"
, "void g() { f(null); }"])); |
| 1133 JUnitTestCase.assertNullMsg("library changed 2", _context.getResolvedCompila
tionUnit2(libSource, libSource)); |
| 1134 JUnitTestCase.assertNullMsg("part changed 2", _context.getResolvedCompilatio
nUnit2(partSource, libSource)); |
| 1135 _analyzeAll_assertFinished(); |
| 1136 JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1137 JUnitTestCase.assertNotNullMsg("part resolved 2", _context.getResolvedCompil
ationUnit2(partSource, libSource)); |
| 1138 EngineTestCase.assertLength(0, _context.getErrors(libSource).errors); |
| 1139 EngineTestCase.assertLength(0, _context.getErrors(partSource).errors); |
| 1140 } |
| 1141 |
| 1142 /** |
| 1143 * https://code.google.com/p/dart/issues/detail?id=12424 |
| 1144 */ |
| 1145 void test_performAnalysisTask_changePartContents_makeItNotPart() { |
| 1146 Source libSource = _addSource("/lib.dart", EngineTestCase.createSource(["lib
rary lib;", "part 'part.dart';", "void f(x) {}"])); |
| 1147 Source partSource = _addSource("/part.dart", EngineTestCase.createSource(["p
art of lib;", "void g() { f(null); }"])); |
| 1148 _analyzeAll_assertFinished(); |
| 1149 EngineTestCase.assertLength(0, _context.getErrors(libSource).errors); |
| 1150 EngineTestCase.assertLength(0, _context.getErrors(partSource).errors); |
| 1151 // Remove 'part' directive, which should make "f(null)" an error. |
| 1152 _context.setContents(partSource, EngineTestCase.createSource(["//part of lib
;", "void g() { f(null); }"])); |
| 1153 _analyzeAll_assertFinished(); |
| 1154 JUnitTestCase.assertTrue(_context.getErrors(libSource).errors.length != 0); |
| 1155 } |
| 1156 |
| 1157 void test_performAnalysisTask_changePartContents_noSemanticChanges() { |
| 1158 Source libSource = _addSource("/test.dart", "library lib; part 'test-part.da
rt';"); |
| 1159 Source partSource = _addSource("/test-part.dart", "part of lib;"); |
| 1160 _analyzeAll_assertFinished(); |
| 1161 JUnitTestCase.assertNotNullMsg("library resolved 1", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1162 JUnitTestCase.assertNotNullMsg("part resolved 1", _context.getResolvedCompil
ationUnit2(partSource, libSource)); |
| 1163 // update and analyze #1 |
| 1164 _context.setContents(partSource, "part of lib; // 1"); |
| 1165 JUnitTestCase.assertNullMsg("library changed 2", _context.getResolvedCompila
tionUnit2(libSource, libSource)); |
| 1166 JUnitTestCase.assertNullMsg("part changed 2", _context.getResolvedCompilatio
nUnit2(partSource, libSource)); |
| 1167 _analyzeAll_assertFinished(); |
| 1168 JUnitTestCase.assertNotNullMsg("library resolved 2", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1169 JUnitTestCase.assertNotNullMsg("part resolved 2", _context.getResolvedCompil
ationUnit2(partSource, libSource)); |
| 1170 // update and analyze #2 |
| 1171 _context.setContents(partSource, "part of lib; // 12"); |
| 1172 JUnitTestCase.assertNullMsg("library changed 3", _context.getResolvedCompila
tionUnit2(libSource, libSource)); |
| 1173 JUnitTestCase.assertNullMsg("part changed 3", _context.getResolvedCompilatio
nUnit2(partSource, libSource)); |
| 1174 _analyzeAll_assertFinished(); |
| 1175 JUnitTestCase.assertNotNullMsg("library resolved 3", _context.getResolvedCom
pilationUnit2(libSource, libSource)); |
| 1176 JUnitTestCase.assertNotNullMsg("part resolved 3", _context.getResolvedCompil
ationUnit2(partSource, libSource)); |
| 1177 } |
| 1178 |
| 1179 void test_performAnalysisTask_importedLibraryAdd() { |
| 1180 Source libASource = _addSource("/libA.dart", "library libA; import 'libB.dar
t';"); |
| 1181 _analyzeAll_assertFinished(); |
| 1182 JUnitTestCase.assertNotNullMsg("libA resolved 1", _context.getResolvedCompil
ationUnit2(libASource, libASource)); |
| 1183 JUnitTestCase.assertTrueMsg("libA has an error", _hasAnalysisErrorWithErrorS
everity(_context.getErrors(libASource))); |
| 1184 // add libB.dart and analyze |
| 1185 Source libBSource = _addSource("/libB.dart", "library libB;"); |
| 1186 _analyzeAll_assertFinished(); |
| 1187 JUnitTestCase.assertNotNullMsg("libA resolved 2", _context.getResolvedCompil
ationUnit2(libASource, libASource)); |
| 1188 JUnitTestCase.assertNotNullMsg("libB resolved 2", _context.getResolvedCompil
ationUnit2(libBSource, libBSource)); |
| 1189 JUnitTestCase.assertTrueMsg("libA doesn't have errors", !_hasAnalysisErrorWi
thErrorSeverity(_context.getErrors(libASource))); |
| 1190 } |
| 1191 |
| 1192 void test_performAnalysisTask_importedLibraryAdd_html() { |
| 1193 Source htmlSource = _addSource("/page.html", EngineTestCase.createSource([ |
| 1194 "<html><body><script type=\"application/dart\">", |
| 1195 " import '/libB.dart';", |
| 1196 " main() {print('hello dart');}", |
| 1197 "</script></body></html>"])); |
| 1198 _analyzeAll_assertFinished(); |
| 1199 JUnitTestCase.assertNotNullMsg("htmlUnit resolved 1", _context.getResolvedHt
mlUnit(htmlSource)); |
| 1200 JUnitTestCase.assertTrueMsg("htmlSource has an error", _hasAnalysisErrorWith
ErrorSeverity(_context.getErrors(htmlSource))); |
| 1201 // add libB.dart and analyze |
| 1202 Source libBSource = _addSource("/libB.dart", "library libB;"); |
| 1203 _analyzeAll_assertFinished(); |
| 1204 JUnitTestCase.assertNotNullMsg("htmlUnit resolved 1", _context.getResolvedHt
mlUnit(htmlSource)); |
| 1205 JUnitTestCase.assertNotNullMsg("libB resolved 2", _context.getResolvedCompil
ationUnit2(libBSource, libBSource)); |
| 1206 AnalysisErrorInfo errors = _context.getErrors(htmlSource); |
| 1207 JUnitTestCase.assertTrueMsg("htmlSource doesn't have errors", !_hasAnalysisE
rrorWithErrorSeverity(errors)); |
| 1208 } |
| 1209 |
| 1210 void test_performAnalysisTask_importedLibraryDelete() { |
| 1211 Source libASource = _addSource("/libA.dart", "library libA; import 'libB.dar
t';"); |
| 1212 Source libBSource = _addSource("/libB.dart", "library libB;"); |
| 1213 _analyzeAll_assertFinished(); |
| 1214 JUnitTestCase.assertNotNullMsg("libA resolved 1", _context.getResolvedCompil
ationUnit2(libASource, libASource)); |
| 1215 JUnitTestCase.assertNotNullMsg("libB resolved 1", _context.getResolvedCompil
ationUnit2(libBSource, libBSource)); |
| 1216 JUnitTestCase.assertTrueMsg("libA doesn't have errors", !_hasAnalysisErrorWi
thErrorSeverity(_context.getErrors(libASource))); |
| 1217 // remove libB.dart content and analyze |
| 1218 _context.setContents(libBSource, null); |
| 1219 _analyzeAll_assertFinished(); |
| 1220 JUnitTestCase.assertNotNullMsg("libA resolved 2", _context.getResolvedCompil
ationUnit2(libASource, libASource)); |
| 1221 JUnitTestCase.assertTrueMsg("libA has an error", _hasAnalysisErrorWithErrorS
everity(_context.getErrors(libASource))); |
| 1222 } |
| 1223 |
| 1224 void test_performAnalysisTask_missingPart() { |
| 1225 Source source = _addSource("/test.dart", "library lib; part 'no-such-file.da
rt';"); |
| 1226 _analyzeAll_assertFinished(); |
| 1227 JUnitTestCase.assertNotNullMsg("performAnalysisTask failed to compute an ele
ment model", _context.getLibraryElement(source)); |
| 1228 } |
| 1229 |
| 1230 void test_performAnalysisTask_modifiedAfterParse() { |
| 1231 // TODO(scheglov) no threads in Dart |
| 1232 // Source source = _addSource("/test.dart", "library lib;"); |
| 1233 // int initialTime = _context.getModificationStamp(source); |
| 1234 // List<Source> sources = new List<Source>(); |
| 1235 // sources.add(source); |
| 1236 // _context.analysisPriorityOrder = sources; |
| 1237 // _context.parseCompilationUnit(source); |
| 1238 // while (initialTime == JavaSystem.currentTimeMillis()) { |
| 1239 // Thread.sleep(1); |
| 1240 // } |
| 1241 // _context.setContents(source, "library test;"); |
| 1242 // JUnitTestCase.assertTrue(initialTime != _context.getModificationStamp(sour
ce)); |
| 1243 // _analyzeAll_assertFinished(); |
| 1244 // JUnitTestCase.assertNotNullMsg("performAnalysisTask failed to compute an e
lement model", _context.getLibraryElement(source)); |
| 1245 } |
| 1246 |
| 1247 void test_resolveCompilationUnit_import_relative() { |
| 1248 _context = AnalysisContextFactory.contextWithCore(); |
| 1249 Source sourceA = _addSource("/libA.dart", "library libA; import 'libB.dart';
class A{}"); |
| 1250 _addSource("/libB.dart", "library libB; class B{}"); |
| 1251 CompilationUnit compilationUnit = _context.resolveCompilationUnit2(sourceA,
sourceA); |
| 1252 LibraryElement library = compilationUnit.element.library; |
| 1253 List<LibraryElement> importedLibraries = library.importedLibraries; |
| 1254 assertNamedElements(importedLibraries, ["dart.core", "libB"]); |
| 1255 List<LibraryElement> visibleLibraries = library.visibleLibraries; |
| 1256 assertNamedElements(visibleLibraries, ["dart.core", "libA", "libB"]); |
| 1257 } |
| 1258 |
| 1259 void test_resolveCompilationUnit_import_relative_cyclic() { |
| 1260 _context = AnalysisContextFactory.contextWithCore(); |
| 1261 Source sourceA = _addSource("/libA.dart", "library libA; import 'libB.dart';
class A{}"); |
| 1262 _addSource("/libB.dart", "library libB; import 'libA.dart'; class B{}"); |
| 1263 CompilationUnit compilationUnit = _context.resolveCompilationUnit2(sourceA,
sourceA); |
| 1264 LibraryElement library = compilationUnit.element.library; |
| 1265 List<LibraryElement> importedLibraries = library.importedLibraries; |
| 1266 assertNamedElements(importedLibraries, ["dart.core", "libB"]); |
| 1267 List<LibraryElement> visibleLibraries = library.visibleLibraries; |
| 1268 assertNamedElements(visibleLibraries, ["dart.core", "libA", "libB"]); |
| 1269 } |
| 1270 |
| 1271 void test_resolveCompilationUnit_library() { |
| 1272 _context = AnalysisContextFactory.contextWithCore(); |
| 1273 _sourceFactory = _context.sourceFactory; |
| 1274 Source source = _addSource("/lib.dart", "library lib;"); |
| 1275 LibraryElement library = _context.computeLibraryElement(source); |
| 1276 CompilationUnit compilationUnit = _context.resolveCompilationUnit(source, li
brary); |
| 1277 JUnitTestCase.assertNotNull(compilationUnit); |
| 1278 JUnitTestCase.assertNotNull(compilationUnit.element); |
| 1279 } |
| 1280 |
| 1281 void test_resolveCompilationUnit_source() { |
| 1282 _context = AnalysisContextFactory.contextWithCore(); |
| 1283 _sourceFactory = _context.sourceFactory; |
| 1284 Source source = _addSource("/lib.dart", "library lib;"); |
| 1285 CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source, s
ource); |
| 1286 JUnitTestCase.assertNotNull(compilationUnit); |
| 1287 } |
| 1288 |
| 1289 void test_resolveCompilationUnit_sourceChangeDuringResolution() { |
| 1290 _context = new _AnalysisContext_sourceChangeDuringResolution(); |
| 1291 AnalysisContextFactory.initContextWithCore(_context); |
| 1292 _sourceFactory = _context.sourceFactory; |
| 1293 Source source = _addSource("/lib.dart", "library lib;"); |
| 1294 CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source, s
ource); |
| 1295 JUnitTestCase.assertNotNull(compilationUnit); |
| 1296 JUnitTestCase.assertNotNull(_context.getLineInfo(source)); |
| 1297 } |
| 1298 |
| 1299 void test_resolveHtmlUnit() { |
| 1300 Source source = _addSource("/lib.html", "<html></html>"); |
| 1301 ht.HtmlUnit unit = _context.resolveHtmlUnit(source); |
| 1302 JUnitTestCase.assertNotNull(unit); |
| 1303 } |
| 1304 |
| 1305 void test_setAnalysisOptions() { |
| 1306 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 1307 options.cacheSize = 42; |
| 1308 options.dart2jsHint = false; |
| 1309 options.hint = false; |
| 1310 _context.analysisOptions = options; |
| 1311 AnalysisOptions result = _context.analysisOptions; |
| 1312 JUnitTestCase.assertEquals(options.cacheSize, result.cacheSize); |
| 1313 JUnitTestCase.assertEquals(options.dart2jsHint, result.dart2jsHint); |
| 1314 JUnitTestCase.assertEquals(options.hint, result.hint); |
| 1315 } |
| 1316 |
| 1317 void test_setAnalysisOptions_reduceAnalysisPriorityOrder() { |
| 1318 AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(_context.analysis
Options); |
| 1319 List<Source> sources = new List<Source>(); |
| 1320 for (int index = 0; index < options.cacheSize; index++) { |
| 1321 sources.add(_addSource("/lib.dart${index}", "")); |
| 1322 } |
| 1323 _context.analysisPriorityOrder = sources; |
| 1324 int oldPriorityOrderSize = _getPriorityOrder(_context).length; |
| 1325 options.cacheSize = options.cacheSize - 10; |
| 1326 _context.analysisOptions = options; |
| 1327 JUnitTestCase.assertTrue(oldPriorityOrderSize > _getPriorityOrder(_context).
length); |
| 1328 } |
| 1329 |
| 1330 void test_setAnalysisPriorityOrder_empty() { |
| 1331 _context.analysisPriorityOrder = new List<Source>(); |
| 1332 } |
| 1333 |
| 1334 void test_setAnalysisPriorityOrder_lessThanCacheSize() { |
| 1335 AnalysisOptions options = _context.analysisOptions; |
| 1336 List<Source> sources = new List<Source>(); |
| 1337 for (int index = 0; index < options.cacheSize; index++) { |
| 1338 sources.add(_addSource("/lib.dart${index}", "")); |
| 1339 } |
| 1340 _context.analysisPriorityOrder = sources; |
| 1341 JUnitTestCase.assertTrue(options.cacheSize > _getPriorityOrder(_context).len
gth); |
| 1342 } |
| 1343 |
| 1344 void test_setAnalysisPriorityOrder_nonEmpty() { |
| 1345 List<Source> sources = new List<Source>(); |
| 1346 sources.add(_addSource("/lib.dart", "library lib;")); |
| 1347 _context.analysisPriorityOrder = sources; |
| 1348 } |
| 1349 |
| 1350 void test_setChangedContents_libraryWithPart() { |
| 1351 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 1352 options.incremental = true; |
| 1353 _context = AnalysisContextFactory.contextWithCoreAndOptions(options); |
| 1354 _sourceFactory = _context.sourceFactory; |
| 1355 String oldCode = EngineTestCase.createSource(["library lib;", "part 'part.da
rt';", "int a = 0;"]); |
| 1356 Source librarySource = _addSource("/lib.dart", oldCode); |
| 1357 Source partSource = _addSource("/part.dart", EngineTestCase.createSource(["p
art of lib;", "int b = a;"])); |
| 1358 LibraryElement element = _context.computeLibraryElement(librarySource); |
| 1359 CompilationUnit unit = _context.getResolvedCompilationUnit(librarySource, el
ement); |
| 1360 JUnitTestCase.assertNotNull(unit); |
| 1361 int offset = oldCode.indexOf("int a") + 4; |
| 1362 String newCode = EngineTestCase.createSource(["library lib;", "part 'part.da
rt';", "int ya = 0;"]); |
| 1363 JUnitTestCase.assertNull(_getIncrementalAnalysisCache(_context)); |
| 1364 _context.setChangedContents(librarySource, newCode, offset, 0, 1); |
| 1365 JUnitTestCase.assertEquals(newCode, _context.getContents(librarySource).data
); |
| 1366 IncrementalAnalysisCache incrementalCache = _getIncrementalAnalysisCache(_co
ntext); |
| 1367 JUnitTestCase.assertEquals(librarySource, incrementalCache.librarySource); |
| 1368 JUnitTestCase.assertSame(unit, incrementalCache.resolvedUnit); |
| 1369 JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(partSource, li
brarySource)); |
| 1370 JUnitTestCase.assertEquals(newCode, incrementalCache.newContents); |
| 1371 } |
| 1372 |
| 1373 void test_setChangedContents_notResolved() { |
| 1374 _context = AnalysisContextFactory.contextWithCore(); |
| 1375 AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(_context.analysis
Options); |
| 1376 options.incremental = true; |
| 1377 _context.analysisOptions = options; |
| 1378 _sourceFactory = _context.sourceFactory; |
| 1379 String oldCode = EngineTestCase.createSource(["library lib;", "int a = 0;"])
; |
| 1380 Source librarySource = _addSource("/lib.dart", oldCode); |
| 1381 int offset = oldCode.indexOf("int a") + 4; |
| 1382 String newCode = EngineTestCase.createSource(["library lib;", "int ya = 0;"]
); |
| 1383 _context.setChangedContents(librarySource, newCode, offset, 0, 1); |
| 1384 JUnitTestCase.assertEquals(newCode, _context.getContents(librarySource).data
); |
| 1385 JUnitTestCase.assertNull(_getIncrementalAnalysisCache(_context)); |
| 1386 } |
| 1387 |
| 1388 void test_setContents_libraryWithPart() { |
| 1389 _context = AnalysisContextFactory.contextWithCore(); |
| 1390 _sourceFactory = _context.sourceFactory; |
| 1391 Source librarySource = _addSource("/lib.dart", EngineTestCase.createSource([
"library lib;", "part 'part.dart';", "int a = 0;"])); |
| 1392 Source partSource = _addSource("/part.dart", EngineTestCase.createSource(["p
art of lib;", "int b = a;"])); |
| 1393 _context.computeLibraryElement(librarySource); |
| 1394 IncrementalAnalysisCache incrementalCache = new IncrementalAnalysisCache(lib
rarySource, librarySource, null, null, null, 0, 0, 0); |
| 1395 _setIncrementalAnalysisCache(_context, incrementalCache); |
| 1396 JUnitTestCase.assertSame(incrementalCache, _getIncrementalAnalysisCache(_con
text)); |
| 1397 _context.setContents(librarySource, EngineTestCase.createSource(["library li
b;", "part 'part.dart';", "int aa = 0;"])); |
| 1398 JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(partSource, li
brarySource)); |
| 1399 JUnitTestCase.assertNull(_getIncrementalAnalysisCache(_context)); |
| 1400 } |
| 1401 |
| 1402 void test_setContents_null() { |
| 1403 _context = AnalysisContextFactory.contextWithCore(); |
| 1404 _sourceFactory = _context.sourceFactory; |
| 1405 Source librarySource = _addSource("/lib.dart", EngineTestCase.createSource([
"library lib;", "int a = 0;"])); |
| 1406 _context.computeLibraryElement(librarySource); |
| 1407 IncrementalAnalysisCache incrementalCache = new IncrementalAnalysisCache(lib
rarySource, librarySource, null, null, null, 0, 0, 0); |
| 1408 _setIncrementalAnalysisCache(_context, incrementalCache); |
| 1409 JUnitTestCase.assertSame(incrementalCache, _getIncrementalAnalysisCache(_con
text)); |
| 1410 _context.setContents(librarySource, null); |
| 1411 JUnitTestCase.assertNull(_context.getResolvedCompilationUnit2(librarySource,
librarySource)); |
| 1412 JUnitTestCase.assertNull(_getIncrementalAnalysisCache(_context)); |
| 1413 } |
| 1414 |
| 1415 void test_setSourceFactory() { |
| 1416 JUnitTestCase.assertEquals(_sourceFactory, _context.sourceFactory); |
| 1417 SourceFactory factory = new SourceFactory([]); |
| 1418 _context.sourceFactory = factory; |
| 1419 JUnitTestCase.assertEquals(factory, _context.sourceFactory); |
| 1420 } |
| 1421 |
| 1422 void test_unreadableSource() { |
| 1423 _context = AnalysisContextFactory.contextWithCore(); |
| 1424 _sourceFactory = _context.sourceFactory; |
| 1425 Source test1 = _addSource("/test1.dart", EngineTestCase.createSource(["impor
t 'test2.dart';", "library test1;"])); |
| 1426 Source test2 = _addSource("/test2.dart", EngineTestCase.createSource([ |
| 1427 "import 'test1.dart';", |
| 1428 "import 'test3.dart';", |
| 1429 "library test2;"])); |
| 1430 Source test3 = _addSourceWithException("/test3.dart"); |
| 1431 _analyzeAll_assertFinished(); |
| 1432 // test1 and test2 should have been successfully analyzed despite the fact t
hat |
| 1433 // test3 couldn't be read. |
| 1434 JUnitTestCase.assertNotNull(_context.computeLibraryElement(test1)); |
| 1435 JUnitTestCase.assertNotNull(_context.computeLibraryElement(test2)); |
| 1436 JUnitTestCase.assertNull(_context.computeLibraryElement(test3)); |
| 1437 } |
| 1438 |
| 1439 void test_updateAnalysis() { |
| 1440 JUnitTestCase.assertTrue(_context.sourcesNeedingProcessing.isEmpty); |
| 1441 Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test.da
rt")); |
| 1442 AnalysisDelta delta = new AnalysisDelta(); |
| 1443 delta.setAnalysisLevel(source, AnalysisLevel.ALL); |
| 1444 _context.applyAnalysisDelta(delta); |
| 1445 JUnitTestCase.assertTrue(_context.sourcesNeedingProcessing.contains(source))
; |
| 1446 delta = new AnalysisDelta(); |
| 1447 delta.setAnalysisLevel(source, AnalysisLevel.NONE); |
| 1448 _context.applyAnalysisDelta(delta); |
| 1449 JUnitTestCase.assertFalse(_context.sourcesNeedingProcessing.contains(source)
); |
| 1450 } |
| 1451 |
| 1452 void xtest_performAnalysisTask_stress() { |
| 1453 int maxCacheSize = 4; |
| 1454 AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(_context.analysis
Options); |
| 1455 options.cacheSize = maxCacheSize; |
| 1456 _context.analysisOptions = options; |
| 1457 int sourceCount = maxCacheSize + 2; |
| 1458 List<Source> sources = new List<Source>(); |
| 1459 ChangeSet changeSet = new ChangeSet(); |
| 1460 for (int i = 0; i < sourceCount; i++) { |
| 1461 Source source = _addSource("/lib${i}.dart", "library lib${i};"); |
| 1462 sources.add(source); |
| 1463 changeSet.addedSource(source); |
| 1464 } |
| 1465 _context.applyChanges(changeSet); |
| 1466 _context.analysisPriorityOrder = sources; |
| 1467 for (int i = 0; i < 1000; i++) { |
| 1468 List<ChangeNotice> notice = _context.performAnalysisTask().changeNotices; |
| 1469 if (notice == null) { |
| 1470 //System.out.println("test_performAnalysisTask_stress: " + i); |
| 1471 break; |
| 1472 } |
| 1473 } |
| 1474 List<ChangeNotice> notice = _context.performAnalysisTask().changeNotices; |
| 1475 if (notice != null) { |
| 1476 JUnitTestCase.fail("performAnalysisTask failed to terminate after analyzin
g all sources"); |
| 1477 } |
| 1478 } |
| 1479 |
| 1480 Source _addSource(String fileName, String contents) { |
| 1481 Source source = new FileBasedSource.con1(FileUtilities2.createFile(fileName)
); |
| 1482 ChangeSet changeSet = new ChangeSet(); |
| 1483 changeSet.addedSource(source); |
| 1484 _context.applyChanges(changeSet); |
| 1485 _context.setContents(source, contents); |
| 1486 return source; |
| 1487 } |
| 1488 |
| 1489 TestSource _addSourceWithException(String fileName) { |
| 1490 return _addSourceWithException2(fileName, ""); |
| 1491 } |
| 1492 |
| 1493 TestSource _addSourceWithException2(String fileName, String contents) { |
| 1494 TestSource source = new TestSource(fileName, contents); |
| 1495 source.generateExceptionOnRead = true; |
| 1496 ChangeSet changeSet = new ChangeSet(); |
| 1497 changeSet.addedSource(source); |
| 1498 _context.applyChanges(changeSet); |
| 1499 return source; |
| 1500 } |
| 1501 |
| 1502 /** |
| 1503 * Perform analysis tasks up to 512 times and asserts that that was enough. |
| 1504 */ |
| 1505 void _analyzeAll_assertFinished() { |
| 1506 _analyzeAll_assertFinished2(512); |
| 1507 } |
| 1508 |
| 1509 /** |
| 1510 * Perform analysis tasks up to the given number of times and asserts that tha
t was enough. |
| 1511 * |
| 1512 * @param maxIterations the maximum number of tasks to perform |
| 1513 */ |
| 1514 void _analyzeAll_assertFinished2(int maxIterations) { |
| 1515 for (int i = 0; i < maxIterations; i++) { |
| 1516 List<ChangeNotice> notice = _context.performAnalysisTask().changeNotices; |
| 1517 if (notice == null) { |
| 1518 return; |
| 1519 } |
| 1520 } |
| 1521 JUnitTestCase.fail("performAnalysisTask failed to terminate after analyzing
all sources"); |
| 1522 } |
| 1523 |
| 1524 void _changeSource(TestSource source, String contents) { |
| 1525 source.setContents(contents); |
| 1526 ChangeSet changeSet = new ChangeSet(); |
| 1527 changeSet.changedSource(source); |
| 1528 _context.applyChanges(changeSet); |
| 1529 } |
| 1530 |
| 1531 /** |
| 1532 * Search the given compilation unit for a class with the given name. Return t
he class with the |
| 1533 * given name, or `null` if the class cannot be found. |
| 1534 * |
| 1535 * @param unit the compilation unit being searched |
| 1536 * @param className the name of the class being searched for |
| 1537 * @return the class with the given name |
| 1538 */ |
| 1539 ClassElement _findClass(CompilationUnitElement unit, String className) { |
| 1540 for (ClassElement classElement in unit.types) { |
| 1541 if (classElement.displayName == className) { |
| 1542 return classElement; |
| 1543 } |
| 1544 } |
| 1545 return null; |
| 1546 } |
| 1547 |
| 1548 IncrementalAnalysisCache _getIncrementalAnalysisCache(AnalysisContextImpl cont
ext2) { |
| 1549 return context2.test_incrementalAnalysisCache; |
| 1550 } |
| 1551 |
| 1552 List<Source> _getPriorityOrder(AnalysisContextImpl context2) { |
| 1553 return context2.test_priorityOrder; |
| 1554 } |
| 1555 |
| 1556 void _removeSource(Source source) { |
| 1557 ChangeSet changeSet = new ChangeSet(); |
| 1558 changeSet.removedSource(source); |
| 1559 _context.applyChanges(changeSet); |
| 1560 } |
| 1561 |
| 1562 void _setIncrementalAnalysisCache(AnalysisContextImpl context, IncrementalAnal
ysisCache incrementalCache) { |
| 1563 context.test_incrementalAnalysisCache = incrementalCache; |
| 1564 } |
| 1565 |
| 1566 static dartSuite() { |
| 1567 _ut.group('AnalysisContextImplTest', () { |
| 1568 _ut.test('test_applyChanges_add', () { |
| 1569 final __test = new AnalysisContextImplTest(); |
| 1570 runJUnitTest(__test, __test.test_applyChanges_add); |
| 1571 }); |
| 1572 _ut.test('test_applyChanges_change_flush_element', () { |
| 1573 final __test = new AnalysisContextImplTest(); |
| 1574 runJUnitTest(__test, __test.test_applyChanges_change_flush_element); |
| 1575 }); |
| 1576 _ut.test('test_applyChanges_change_multiple', () { |
| 1577 final __test = new AnalysisContextImplTest(); |
| 1578 runJUnitTest(__test, __test.test_applyChanges_change_multiple); |
| 1579 }); |
| 1580 _ut.test('test_applyChanges_empty', () { |
| 1581 final __test = new AnalysisContextImplTest(); |
| 1582 runJUnitTest(__test, __test.test_applyChanges_empty); |
| 1583 }); |
| 1584 _ut.test('test_applyChanges_overriddenSource', () { |
| 1585 final __test = new AnalysisContextImplTest(); |
| 1586 runJUnitTest(__test, __test.test_applyChanges_overriddenSource); |
| 1587 }); |
| 1588 _ut.test('test_applyChanges_remove', () { |
| 1589 final __test = new AnalysisContextImplTest(); |
| 1590 runJUnitTest(__test, __test.test_applyChanges_remove); |
| 1591 }); |
| 1592 _ut.test('test_applyChanges_removeContainer', () { |
| 1593 final __test = new AnalysisContextImplTest(); |
| 1594 runJUnitTest(__test, __test.test_applyChanges_removeContainer); |
| 1595 }); |
| 1596 _ut.test('test_computeDocumentationComment_block', () { |
| 1597 final __test = new AnalysisContextImplTest(); |
| 1598 runJUnitTest(__test, __test.test_computeDocumentationComment_block); |
| 1599 }); |
| 1600 _ut.test('test_computeDocumentationComment_none', () { |
| 1601 final __test = new AnalysisContextImplTest(); |
| 1602 runJUnitTest(__test, __test.test_computeDocumentationComment_none); |
| 1603 }); |
| 1604 _ut.test('test_computeDocumentationComment_null', () { |
| 1605 final __test = new AnalysisContextImplTest(); |
| 1606 runJUnitTest(__test, __test.test_computeDocumentationComment_null); |
| 1607 }); |
| 1608 _ut.test('test_computeDocumentationComment_singleLine_multiple_EOL_n', ()
{ |
| 1609 final __test = new AnalysisContextImplTest(); |
| 1610 runJUnitTest(__test, __test.test_computeDocumentationComment_singleLine_
multiple_EOL_n); |
| 1611 }); |
| 1612 _ut.test('test_computeDocumentationComment_singleLine_multiple_EOL_rn', ()
{ |
| 1613 final __test = new AnalysisContextImplTest(); |
| 1614 runJUnitTest(__test, __test.test_computeDocumentationComment_singleLine_
multiple_EOL_rn); |
| 1615 }); |
| 1616 _ut.test('test_computeErrors_dart_none', () { |
| 1617 final __test = new AnalysisContextImplTest(); |
| 1618 runJUnitTest(__test, __test.test_computeErrors_dart_none); |
| 1619 }); |
| 1620 _ut.test('test_computeErrors_dart_part', () { |
| 1621 final __test = new AnalysisContextImplTest(); |
| 1622 runJUnitTest(__test, __test.test_computeErrors_dart_part); |
| 1623 }); |
| 1624 _ut.test('test_computeErrors_dart_some', () { |
| 1625 final __test = new AnalysisContextImplTest(); |
| 1626 runJUnitTest(__test, __test.test_computeErrors_dart_some); |
| 1627 }); |
| 1628 _ut.test('test_computeErrors_html_none', () { |
| 1629 final __test = new AnalysisContextImplTest(); |
| 1630 runJUnitTest(__test, __test.test_computeErrors_html_none); |
| 1631 }); |
| 1632 _ut.test('test_computeExportedLibraries_none', () { |
| 1633 final __test = new AnalysisContextImplTest(); |
| 1634 runJUnitTest(__test, __test.test_computeExportedLibraries_none); |
| 1635 }); |
| 1636 _ut.test('test_computeExportedLibraries_some', () { |
| 1637 final __test = new AnalysisContextImplTest(); |
| 1638 runJUnitTest(__test, __test.test_computeExportedLibraries_some); |
| 1639 }); |
| 1640 _ut.test('test_computeHtmlElement_nonHtml', () { |
| 1641 final __test = new AnalysisContextImplTest(); |
| 1642 runJUnitTest(__test, __test.test_computeHtmlElement_nonHtml); |
| 1643 }); |
| 1644 _ut.test('test_computeHtmlElement_valid', () { |
| 1645 final __test = new AnalysisContextImplTest(); |
| 1646 runJUnitTest(__test, __test.test_computeHtmlElement_valid); |
| 1647 }); |
| 1648 _ut.test('test_computeImportedLibraries_none', () { |
| 1649 final __test = new AnalysisContextImplTest(); |
| 1650 runJUnitTest(__test, __test.test_computeImportedLibraries_none); |
| 1651 }); |
| 1652 _ut.test('test_computeImportedLibraries_some', () { |
| 1653 final __test = new AnalysisContextImplTest(); |
| 1654 runJUnitTest(__test, __test.test_computeImportedLibraries_some); |
| 1655 }); |
| 1656 _ut.test('test_computeKindOf_html', () { |
| 1657 final __test = new AnalysisContextImplTest(); |
| 1658 runJUnitTest(__test, __test.test_computeKindOf_html); |
| 1659 }); |
| 1660 _ut.test('test_computeKindOf_library', () { |
| 1661 final __test = new AnalysisContextImplTest(); |
| 1662 runJUnitTest(__test, __test.test_computeKindOf_library); |
| 1663 }); |
| 1664 _ut.test('test_computeKindOf_libraryAndPart', () { |
| 1665 final __test = new AnalysisContextImplTest(); |
| 1666 runJUnitTest(__test, __test.test_computeKindOf_libraryAndPart); |
| 1667 }); |
| 1668 _ut.test('test_computeKindOf_part', () { |
| 1669 final __test = new AnalysisContextImplTest(); |
| 1670 runJUnitTest(__test, __test.test_computeKindOf_part); |
| 1671 }); |
| 1672 _ut.test('test_computeLibraryElement', () { |
| 1673 final __test = new AnalysisContextImplTest(); |
| 1674 runJUnitTest(__test, __test.test_computeLibraryElement); |
| 1675 }); |
| 1676 _ut.test('test_computeLineInfo_dart', () { |
| 1677 final __test = new AnalysisContextImplTest(); |
| 1678 runJUnitTest(__test, __test.test_computeLineInfo_dart); |
| 1679 }); |
| 1680 _ut.test('test_computeLineInfo_html', () { |
| 1681 final __test = new AnalysisContextImplTest(); |
| 1682 runJUnitTest(__test, __test.test_computeLineInfo_html); |
| 1683 }); |
| 1684 _ut.test('test_computeResolvableCompilationUnit_dart_exception', () { |
| 1685 final __test = new AnalysisContextImplTest(); |
| 1686 runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_dart_e
xception); |
| 1687 }); |
| 1688 _ut.test('test_computeResolvableCompilationUnit_html_exception', () { |
| 1689 final __test = new AnalysisContextImplTest(); |
| 1690 runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_html_e
xception); |
| 1691 }); |
| 1692 _ut.test('test_computeResolvableCompilationUnit_valid', () { |
| 1693 final __test = new AnalysisContextImplTest(); |
| 1694 runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_valid)
; |
| 1695 }); |
| 1696 _ut.test('test_dispose', () { |
| 1697 final __test = new AnalysisContextImplTest(); |
| 1698 runJUnitTest(__test, __test.test_dispose); |
| 1699 }); |
| 1700 _ut.test('test_exists_false', () { |
| 1701 final __test = new AnalysisContextImplTest(); |
| 1702 runJUnitTest(__test, __test.test_exists_false); |
| 1703 }); |
| 1704 _ut.test('test_exists_null', () { |
| 1705 final __test = new AnalysisContextImplTest(); |
| 1706 runJUnitTest(__test, __test.test_exists_null); |
| 1707 }); |
| 1708 _ut.test('test_exists_overridden', () { |
| 1709 final __test = new AnalysisContextImplTest(); |
| 1710 runJUnitTest(__test, __test.test_exists_overridden); |
| 1711 }); |
| 1712 _ut.test('test_exists_true', () { |
| 1713 final __test = new AnalysisContextImplTest(); |
| 1714 runJUnitTest(__test, __test.test_exists_true); |
| 1715 }); |
| 1716 _ut.test('test_getAnalysisOptions', () { |
| 1717 final __test = new AnalysisContextImplTest(); |
| 1718 runJUnitTest(__test, __test.test_getAnalysisOptions); |
| 1719 }); |
| 1720 _ut.test('test_getContents_fromSource', () { |
| 1721 final __test = new AnalysisContextImplTest(); |
| 1722 runJUnitTest(__test, __test.test_getContents_fromSource); |
| 1723 }); |
| 1724 _ut.test('test_getContents_overridden', () { |
| 1725 final __test = new AnalysisContextImplTest(); |
| 1726 runJUnitTest(__test, __test.test_getContents_overridden); |
| 1727 }); |
| 1728 _ut.test('test_getContents_unoverridden', () { |
| 1729 final __test = new AnalysisContextImplTest(); |
| 1730 runJUnitTest(__test, __test.test_getContents_unoverridden); |
| 1731 }); |
| 1732 _ut.test('test_getDeclaredVariables', () { |
| 1733 final __test = new AnalysisContextImplTest(); |
| 1734 runJUnitTest(__test, __test.test_getDeclaredVariables); |
| 1735 }); |
| 1736 _ut.test('test_getElement', () { |
| 1737 final __test = new AnalysisContextImplTest(); |
| 1738 runJUnitTest(__test, __test.test_getElement); |
| 1739 }); |
| 1740 _ut.test('test_getElement_constructor_named', () { |
| 1741 final __test = new AnalysisContextImplTest(); |
| 1742 runJUnitTest(__test, __test.test_getElement_constructor_named); |
| 1743 }); |
| 1744 _ut.test('test_getElement_constructor_unnamed', () { |
| 1745 final __test = new AnalysisContextImplTest(); |
| 1746 runJUnitTest(__test, __test.test_getElement_constructor_unnamed); |
| 1747 }); |
| 1748 _ut.test('test_getErrors_dart_none', () { |
| 1749 final __test = new AnalysisContextImplTest(); |
| 1750 runJUnitTest(__test, __test.test_getErrors_dart_none); |
| 1751 }); |
| 1752 _ut.test('test_getErrors_dart_some', () { |
| 1753 final __test = new AnalysisContextImplTest(); |
| 1754 runJUnitTest(__test, __test.test_getErrors_dart_some); |
| 1755 }); |
| 1756 _ut.test('test_getErrors_html_none', () { |
| 1757 final __test = new AnalysisContextImplTest(); |
| 1758 runJUnitTest(__test, __test.test_getErrors_html_none); |
| 1759 }); |
| 1760 _ut.test('test_getErrors_html_some', () { |
| 1761 final __test = new AnalysisContextImplTest(); |
| 1762 runJUnitTest(__test, __test.test_getErrors_html_some); |
| 1763 }); |
| 1764 _ut.test('test_getHtmlElement_dart', () { |
| 1765 final __test = new AnalysisContextImplTest(); |
| 1766 runJUnitTest(__test, __test.test_getHtmlElement_dart); |
| 1767 }); |
| 1768 _ut.test('test_getHtmlElement_html', () { |
| 1769 final __test = new AnalysisContextImplTest(); |
| 1770 runJUnitTest(__test, __test.test_getHtmlElement_html); |
| 1771 }); |
| 1772 _ut.test('test_getHtmlFilesReferencing_html', () { |
| 1773 final __test = new AnalysisContextImplTest(); |
| 1774 runJUnitTest(__test, __test.test_getHtmlFilesReferencing_html); |
| 1775 }); |
| 1776 _ut.test('test_getHtmlFilesReferencing_library', () { |
| 1777 final __test = new AnalysisContextImplTest(); |
| 1778 runJUnitTest(__test, __test.test_getHtmlFilesReferencing_library); |
| 1779 }); |
| 1780 _ut.test('test_getHtmlFilesReferencing_part', () { |
| 1781 final __test = new AnalysisContextImplTest(); |
| 1782 runJUnitTest(__test, __test.test_getHtmlFilesReferencing_part); |
| 1783 }); |
| 1784 _ut.test('test_getHtmlSources', () { |
| 1785 final __test = new AnalysisContextImplTest(); |
| 1786 runJUnitTest(__test, __test.test_getHtmlSources); |
| 1787 }); |
| 1788 _ut.test('test_getKindOf_html', () { |
| 1789 final __test = new AnalysisContextImplTest(); |
| 1790 runJUnitTest(__test, __test.test_getKindOf_html); |
| 1791 }); |
| 1792 _ut.test('test_getKindOf_library', () { |
| 1793 final __test = new AnalysisContextImplTest(); |
| 1794 runJUnitTest(__test, __test.test_getKindOf_library); |
| 1795 }); |
| 1796 _ut.test('test_getKindOf_part', () { |
| 1797 final __test = new AnalysisContextImplTest(); |
| 1798 runJUnitTest(__test, __test.test_getKindOf_part); |
| 1799 }); |
| 1800 _ut.test('test_getKindOf_unknown', () { |
| 1801 final __test = new AnalysisContextImplTest(); |
| 1802 runJUnitTest(__test, __test.test_getKindOf_unknown); |
| 1803 }); |
| 1804 _ut.test('test_getLaunchableClientLibrarySources', () { |
| 1805 final __test = new AnalysisContextImplTest(); |
| 1806 runJUnitTest(__test, __test.test_getLaunchableClientLibrarySources); |
| 1807 }); |
| 1808 _ut.test('test_getLaunchableServerLibrarySources', () { |
| 1809 final __test = new AnalysisContextImplTest(); |
| 1810 runJUnitTest(__test, __test.test_getLaunchableServerLibrarySources); |
| 1811 }); |
| 1812 _ut.test('test_getLibrariesContaining', () { |
| 1813 final __test = new AnalysisContextImplTest(); |
| 1814 runJUnitTest(__test, __test.test_getLibrariesContaining); |
| 1815 }); |
| 1816 _ut.test('test_getLibrariesDependingOn', () { |
| 1817 final __test = new AnalysisContextImplTest(); |
| 1818 runJUnitTest(__test, __test.test_getLibrariesDependingOn); |
| 1819 }); |
| 1820 _ut.test('test_getLibrariesReferencedFromHtml', () { |
| 1821 final __test = new AnalysisContextImplTest(); |
| 1822 runJUnitTest(__test, __test.test_getLibrariesReferencedFromHtml); |
| 1823 }); |
| 1824 _ut.test('test_getLibrariesReferencedFromHtml_no', () { |
| 1825 final __test = new AnalysisContextImplTest(); |
| 1826 runJUnitTest(__test, __test.test_getLibrariesReferencedFromHtml_no); |
| 1827 }); |
| 1828 _ut.test('test_getLibraryElement', () { |
| 1829 final __test = new AnalysisContextImplTest(); |
| 1830 runJUnitTest(__test, __test.test_getLibraryElement); |
| 1831 }); |
| 1832 _ut.test('test_getLibrarySources', () { |
| 1833 final __test = new AnalysisContextImplTest(); |
| 1834 runJUnitTest(__test, __test.test_getLibrarySources); |
| 1835 }); |
| 1836 _ut.test('test_getLineInfo', () { |
| 1837 final __test = new AnalysisContextImplTest(); |
| 1838 runJUnitTest(__test, __test.test_getLineInfo); |
| 1839 }); |
| 1840 _ut.test('test_getModificationStamp_fromSource', () { |
| 1841 final __test = new AnalysisContextImplTest(); |
| 1842 runJUnitTest(__test, __test.test_getModificationStamp_fromSource); |
| 1843 }); |
| 1844 _ut.test('test_getModificationStamp_overridden', () { |
| 1845 final __test = new AnalysisContextImplTest(); |
| 1846 runJUnitTest(__test, __test.test_getModificationStamp_overridden); |
| 1847 }); |
| 1848 _ut.test('test_getPublicNamespace_element', () { |
| 1849 final __test = new AnalysisContextImplTest(); |
| 1850 runJUnitTest(__test, __test.test_getPublicNamespace_element); |
| 1851 }); |
| 1852 _ut.test('test_getRefactoringUnsafeSources', () { |
| 1853 final __test = new AnalysisContextImplTest(); |
| 1854 runJUnitTest(__test, __test.test_getRefactoringUnsafeSources); |
| 1855 }); |
| 1856 _ut.test('test_getResolvedCompilationUnit_library', () { |
| 1857 final __test = new AnalysisContextImplTest(); |
| 1858 runJUnitTest(__test, __test.test_getResolvedCompilationUnit_library); |
| 1859 }); |
| 1860 _ut.test('test_getResolvedCompilationUnit_library_null', () { |
| 1861 final __test = new AnalysisContextImplTest(); |
| 1862 runJUnitTest(__test, __test.test_getResolvedCompilationUnit_library_null
); |
| 1863 }); |
| 1864 _ut.test('test_getResolvedCompilationUnit_source_dart', () { |
| 1865 final __test = new AnalysisContextImplTest(); |
| 1866 runJUnitTest(__test, __test.test_getResolvedCompilationUnit_source_dart)
; |
| 1867 }); |
| 1868 _ut.test('test_getResolvedCompilationUnit_source_html', () { |
| 1869 final __test = new AnalysisContextImplTest(); |
| 1870 runJUnitTest(__test, __test.test_getResolvedCompilationUnit_source_html)
; |
| 1871 }); |
| 1872 _ut.test('test_getResolvedHtmlUnit', () { |
| 1873 final __test = new AnalysisContextImplTest(); |
| 1874 runJUnitTest(__test, __test.test_getResolvedHtmlUnit); |
| 1875 }); |
| 1876 _ut.test('test_getSourceFactory', () { |
| 1877 final __test = new AnalysisContextImplTest(); |
| 1878 runJUnitTest(__test, __test.test_getSourceFactory); |
| 1879 }); |
| 1880 _ut.test('test_getStatistics', () { |
| 1881 final __test = new AnalysisContextImplTest(); |
| 1882 runJUnitTest(__test, __test.test_getStatistics); |
| 1883 }); |
| 1884 _ut.test('test_isClientLibrary_dart', () { |
| 1885 final __test = new AnalysisContextImplTest(); |
| 1886 runJUnitTest(__test, __test.test_isClientLibrary_dart); |
| 1887 }); |
| 1888 _ut.test('test_isClientLibrary_html', () { |
| 1889 final __test = new AnalysisContextImplTest(); |
| 1890 runJUnitTest(__test, __test.test_isClientLibrary_html); |
| 1891 }); |
| 1892 _ut.test('test_isServerLibrary_dart', () { |
| 1893 final __test = new AnalysisContextImplTest(); |
| 1894 runJUnitTest(__test, __test.test_isServerLibrary_dart); |
| 1895 }); |
| 1896 _ut.test('test_isServerLibrary_html', () { |
| 1897 final __test = new AnalysisContextImplTest(); |
| 1898 runJUnitTest(__test, __test.test_isServerLibrary_html); |
| 1899 }); |
| 1900 _ut.test('test_parseCompilationUnit_errors', () { |
| 1901 final __test = new AnalysisContextImplTest(); |
| 1902 runJUnitTest(__test, __test.test_parseCompilationUnit_errors); |
| 1903 }); |
| 1904 _ut.test('test_parseCompilationUnit_exception', () { |
| 1905 final __test = new AnalysisContextImplTest(); |
| 1906 runJUnitTest(__test, __test.test_parseCompilationUnit_exception); |
| 1907 }); |
| 1908 _ut.test('test_parseCompilationUnit_html', () { |
| 1909 final __test = new AnalysisContextImplTest(); |
| 1910 runJUnitTest(__test, __test.test_parseCompilationUnit_html); |
| 1911 }); |
| 1912 _ut.test('test_parseCompilationUnit_noErrors', () { |
| 1913 final __test = new AnalysisContextImplTest(); |
| 1914 runJUnitTest(__test, __test.test_parseCompilationUnit_noErrors); |
| 1915 }); |
| 1916 _ut.test('test_parseCompilationUnit_nonExistentSource', () { |
| 1917 final __test = new AnalysisContextImplTest(); |
| 1918 runJUnitTest(__test, __test.test_parseCompilationUnit_nonExistentSource)
; |
| 1919 }); |
| 1920 _ut.test('test_parseHtmlUnit_noErrors', () { |
| 1921 final __test = new AnalysisContextImplTest(); |
| 1922 runJUnitTest(__test, __test.test_parseHtmlUnit_noErrors); |
| 1923 }); |
| 1924 _ut.test('test_parseHtmlUnit_resolveDirectives', () { |
| 1925 final __test = new AnalysisContextImplTest(); |
| 1926 runJUnitTest(__test, __test.test_parseHtmlUnit_resolveDirectives); |
| 1927 }); |
| 1928 _ut.test('test_performAnalysisTask_IOException', () { |
| 1929 final __test = new AnalysisContextImplTest(); |
| 1930 runJUnitTest(__test, __test.test_performAnalysisTask_IOException); |
| 1931 }); |
| 1932 _ut.test('test_performAnalysisTask_addPart', () { |
| 1933 final __test = new AnalysisContextImplTest(); |
| 1934 runJUnitTest(__test, __test.test_performAnalysisTask_addPart); |
| 1935 }); |
| 1936 _ut.test('test_performAnalysisTask_changeLibraryContents', () { |
| 1937 final __test = new AnalysisContextImplTest(); |
| 1938 runJUnitTest(__test, __test.test_performAnalysisTask_changeLibraryConten
ts); |
| 1939 }); |
| 1940 _ut.test('test_performAnalysisTask_changeLibraryThenPartContents', () { |
| 1941 final __test = new AnalysisContextImplTest(); |
| 1942 runJUnitTest(__test, __test.test_performAnalysisTask_changeLibraryThenPa
rtContents); |
| 1943 }); |
| 1944 _ut.test('test_performAnalysisTask_changePartContents_makeItAPart', () { |
| 1945 final __test = new AnalysisContextImplTest(); |
| 1946 runJUnitTest(__test, __test.test_performAnalysisTask_changePartContents_
makeItAPart); |
| 1947 }); |
| 1948 _ut.test('test_performAnalysisTask_changePartContents_makeItNotPart', () { |
| 1949 final __test = new AnalysisContextImplTest(); |
| 1950 runJUnitTest(__test, __test.test_performAnalysisTask_changePartContents_
makeItNotPart); |
| 1951 }); |
| 1952 _ut.test('test_performAnalysisTask_changePartContents_noSemanticChanges',
() { |
| 1953 final __test = new AnalysisContextImplTest(); |
| 1954 runJUnitTest(__test, __test.test_performAnalysisTask_changePartContents_
noSemanticChanges); |
| 1955 }); |
| 1956 _ut.test('test_performAnalysisTask_importedLibraryAdd', () { |
| 1957 final __test = new AnalysisContextImplTest(); |
| 1958 runJUnitTest(__test, __test.test_performAnalysisTask_importedLibraryAdd)
; |
| 1959 }); |
| 1960 _ut.test('test_performAnalysisTask_importedLibraryAdd_html', () { |
| 1961 final __test = new AnalysisContextImplTest(); |
| 1962 runJUnitTest(__test, __test.test_performAnalysisTask_importedLibraryAdd_
html); |
| 1963 }); |
| 1964 _ut.test('test_performAnalysisTask_importedLibraryDelete', () { |
| 1965 final __test = new AnalysisContextImplTest(); |
| 1966 runJUnitTest(__test, __test.test_performAnalysisTask_importedLibraryDele
te); |
| 1967 }); |
| 1968 _ut.test('test_performAnalysisTask_missingPart', () { |
| 1969 final __test = new AnalysisContextImplTest(); |
| 1970 runJUnitTest(__test, __test.test_performAnalysisTask_missingPart); |
| 1971 }); |
| 1972 _ut.test('test_performAnalysisTask_modifiedAfterParse', () { |
| 1973 final __test = new AnalysisContextImplTest(); |
| 1974 runJUnitTest(__test, __test.test_performAnalysisTask_modifiedAfterParse)
; |
| 1975 }); |
| 1976 _ut.test('test_resolveCompilationUnit_import_relative', () { |
| 1977 final __test = new AnalysisContextImplTest(); |
| 1978 runJUnitTest(__test, __test.test_resolveCompilationUnit_import_relative)
; |
| 1979 }); |
| 1980 _ut.test('test_resolveCompilationUnit_import_relative_cyclic', () { |
| 1981 final __test = new AnalysisContextImplTest(); |
| 1982 runJUnitTest(__test, __test.test_resolveCompilationUnit_import_relative_
cyclic); |
| 1983 }); |
| 1984 _ut.test('test_resolveCompilationUnit_library', () { |
| 1985 final __test = new AnalysisContextImplTest(); |
| 1986 runJUnitTest(__test, __test.test_resolveCompilationUnit_library); |
| 1987 }); |
| 1988 _ut.test('test_resolveCompilationUnit_source', () { |
| 1989 final __test = new AnalysisContextImplTest(); |
| 1990 runJUnitTest(__test, __test.test_resolveCompilationUnit_source); |
| 1991 }); |
| 1992 _ut.test('test_resolveCompilationUnit_sourceChangeDuringResolution', () { |
| 1993 final __test = new AnalysisContextImplTest(); |
| 1994 runJUnitTest(__test, __test.test_resolveCompilationUnit_sourceChangeDuri
ngResolution); |
| 1995 }); |
| 1996 _ut.test('test_resolveHtmlUnit', () { |
| 1997 final __test = new AnalysisContextImplTest(); |
| 1998 runJUnitTest(__test, __test.test_resolveHtmlUnit); |
| 1999 }); |
| 2000 _ut.test('test_setAnalysisOptions', () { |
| 2001 final __test = new AnalysisContextImplTest(); |
| 2002 runJUnitTest(__test, __test.test_setAnalysisOptions); |
| 2003 }); |
| 2004 _ut.test('test_setAnalysisOptions_reduceAnalysisPriorityOrder', () { |
| 2005 final __test = new AnalysisContextImplTest(); |
| 2006 runJUnitTest(__test, __test.test_setAnalysisOptions_reduceAnalysisPriori
tyOrder); |
| 2007 }); |
| 2008 _ut.test('test_setAnalysisPriorityOrder_empty', () { |
| 2009 final __test = new AnalysisContextImplTest(); |
| 2010 runJUnitTest(__test, __test.test_setAnalysisPriorityOrder_empty); |
| 2011 }); |
| 2012 _ut.test('test_setAnalysisPriorityOrder_lessThanCacheSize', () { |
| 2013 final __test = new AnalysisContextImplTest(); |
| 2014 runJUnitTest(__test, __test.test_setAnalysisPriorityOrder_lessThanCacheS
ize); |
| 2015 }); |
| 2016 _ut.test('test_setAnalysisPriorityOrder_nonEmpty', () { |
| 2017 final __test = new AnalysisContextImplTest(); |
| 2018 runJUnitTest(__test, __test.test_setAnalysisPriorityOrder_nonEmpty); |
| 2019 }); |
| 2020 _ut.test('test_setChangedContents_libraryWithPart', () { |
| 2021 final __test = new AnalysisContextImplTest(); |
| 2022 runJUnitTest(__test, __test.test_setChangedContents_libraryWithPart); |
| 2023 }); |
| 2024 _ut.test('test_setChangedContents_notResolved', () { |
| 2025 final __test = new AnalysisContextImplTest(); |
| 2026 runJUnitTest(__test, __test.test_setChangedContents_notResolved); |
| 2027 }); |
| 2028 _ut.test('test_setContents_libraryWithPart', () { |
| 2029 final __test = new AnalysisContextImplTest(); |
| 2030 runJUnitTest(__test, __test.test_setContents_libraryWithPart); |
| 2031 }); |
| 2032 _ut.test('test_setContents_null', () { |
| 2033 final __test = new AnalysisContextImplTest(); |
| 2034 runJUnitTest(__test, __test.test_setContents_null); |
| 2035 }); |
| 2036 _ut.test('test_setSourceFactory', () { |
| 2037 final __test = new AnalysisContextImplTest(); |
| 2038 runJUnitTest(__test, __test.test_setSourceFactory); |
| 2039 }); |
| 2040 _ut.test('test_unreadableSource', () { |
| 2041 final __test = new AnalysisContextImplTest(); |
| 2042 runJUnitTest(__test, __test.test_unreadableSource); |
| 2043 }); |
| 2044 _ut.test('test_updateAnalysis', () { |
| 2045 final __test = new AnalysisContextImplTest(); |
| 2046 runJUnitTest(__test, __test.test_updateAnalysis); |
| 2047 }); |
| 2048 }); |
| 2049 } |
| 2050 |
| 2051 /** |
| 2052 * Returns `true` if there is an [AnalysisError] with [ErrorSeverity#ERROR] in |
| 2053 * the given [AnalysisErrorInfo]. |
| 2054 */ |
| 2055 static bool _hasAnalysisErrorWithErrorSeverity(AnalysisErrorInfo errorInfo) { |
| 2056 List<AnalysisError> errors = errorInfo.errors; |
| 2057 for (AnalysisError analysisError in errors) { |
| 2058 if (analysisError.errorCode.errorSeverity == ErrorSeverity.ERROR) { |
| 2059 return true; |
| 2060 } |
| 2061 } |
| 2062 return false; |
| 2063 } |
| 2064 } |
| 2065 |
| 2066 |
| 2067 class AnalysisContextImplTest_Source_exists_true extends TestSource { |
| 2068 @override |
| 2069 bool exists() => true; |
| 2070 } |
| 2071 |
| 2072 |
| 2073 class AnalysisContextImplTest_Source_getModificationStamp_fromSource extends Tes
tSource { |
| 2074 int stamp; |
| 2075 AnalysisContextImplTest_Source_getModificationStamp_fromSource(this.stamp); |
| 2076 @override |
| 2077 int get modificationStamp => stamp; |
| 2078 } |
| 2079 |
| 2080 |
| 2081 class AnalysisContextImplTest_Source_getModificationStamp_overridden extends Tes
tSource { |
| 2082 int stamp; |
| 2083 AnalysisContextImplTest_Source_getModificationStamp_overridden(this.stamp); |
| 2084 @override |
| 2085 int get modificationStamp => stamp; |
| 2086 } |
| 2087 |
| 2088 |
| 2089 class AnalysisOptionsImplTest extends EngineTestCase { |
| 2090 void test_AnalysisOptionsImpl_copy() { |
| 2091 bool booleanValue = true; |
| 2092 for (int i = 0; i < 2; i++, booleanValue = !booleanValue) { |
| 2093 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2094 options.analyzeAngular = booleanValue; |
| 2095 options.analyzeFunctionBodies = booleanValue; |
| 2096 options.analyzePolymer = booleanValue; |
| 2097 options.cacheSize = i; |
| 2098 options.dart2jsHint = booleanValue; |
| 2099 options.enableDeferredLoading = booleanValue; |
| 2100 options.generateSdkErrors = booleanValue; |
| 2101 options.hint = booleanValue; |
| 2102 options.incremental = booleanValue; |
| 2103 options.preserveComments = booleanValue; |
| 2104 AnalysisOptionsImpl copy = new AnalysisOptionsImpl.con1(options); |
| 2105 JUnitTestCase.assertEquals(options.analyzeAngular, copy.analyzeAngular); |
| 2106 JUnitTestCase.assertEquals(options.analyzeFunctionBodies, copy.analyzeFunc
tionBodies); |
| 2107 JUnitTestCase.assertEquals(options.analyzePolymer, copy.analyzePolymer); |
| 2108 JUnitTestCase.assertEquals(options.cacheSize, copy.cacheSize); |
| 2109 JUnitTestCase.assertEquals(options.dart2jsHint, copy.dart2jsHint); |
| 2110 JUnitTestCase.assertEquals(options.enableAsync, copy.enableAsync); |
| 2111 JUnitTestCase.assertEquals(options.enableDeferredLoading, copy.enableDefer
redLoading); |
| 2112 JUnitTestCase.assertEquals(options.enableEnum, copy.enableEnum); |
| 2113 JUnitTestCase.assertEquals(options.generateSdkErrors, copy.generateSdkErro
rs); |
| 2114 JUnitTestCase.assertEquals(options.hint, copy.hint); |
| 2115 JUnitTestCase.assertEquals(options.incremental, copy.incremental); |
| 2116 JUnitTestCase.assertEquals(options.preserveComments, copy.preserveComments
); |
| 2117 } |
| 2118 } |
| 2119 |
| 2120 void test_getAnalyzeAngular() { |
| 2121 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2122 bool value = !options.analyzeAngular; |
| 2123 options.analyzeAngular = value; |
| 2124 JUnitTestCase.assertEquals(value, options.analyzeAngular); |
| 2125 } |
| 2126 |
| 2127 void test_getAnalyzeFunctionBodies() { |
| 2128 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2129 bool value = !options.analyzeFunctionBodies; |
| 2130 options.analyzeFunctionBodies = value; |
| 2131 JUnitTestCase.assertEquals(value, options.analyzeFunctionBodies); |
| 2132 } |
| 2133 |
| 2134 void test_getAnalyzePolymer() { |
| 2135 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2136 bool value = !options.analyzePolymer; |
| 2137 options.analyzePolymer = value; |
| 2138 JUnitTestCase.assertEquals(value, options.analyzePolymer); |
| 2139 } |
| 2140 |
| 2141 void test_getCacheSize() { |
| 2142 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2143 JUnitTestCase.assertEquals(AnalysisOptionsImpl.DEFAULT_CACHE_SIZE, options.c
acheSize); |
| 2144 int value = options.cacheSize + 1; |
| 2145 options.cacheSize = value; |
| 2146 JUnitTestCase.assertEquals(value, options.cacheSize); |
| 2147 } |
| 2148 |
| 2149 void test_getDart2jsHint() { |
| 2150 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2151 bool value = !options.dart2jsHint; |
| 2152 options.dart2jsHint = value; |
| 2153 JUnitTestCase.assertEquals(value, options.dart2jsHint); |
| 2154 } |
| 2155 |
| 2156 void test_getEnableAsync() { |
| 2157 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2158 JUnitTestCase.assertEquals(AnalysisOptionsImpl.DEFAULT_ENABLE_ASYNC, options
.enableAsync); |
| 2159 bool value = !options.enableAsync; |
| 2160 options.enableAsync = value; |
| 2161 JUnitTestCase.assertEquals(value, options.enableAsync); |
| 2162 } |
| 2163 |
| 2164 void test_getEnableDeferredLoading() { |
| 2165 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2166 JUnitTestCase.assertEquals(AnalysisOptionsImpl.DEFAULT_ENABLE_DEFERRED_LOADI
NG, options.enableDeferredLoading); |
| 2167 bool value = !options.enableDeferredLoading; |
| 2168 options.enableDeferredLoading = value; |
| 2169 JUnitTestCase.assertEquals(value, options.enableDeferredLoading); |
| 2170 } |
| 2171 |
| 2172 void test_getEnableEnum() { |
| 2173 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2174 JUnitTestCase.assertEquals(AnalysisOptionsImpl.DEFAULT_ENABLE_ENUM, options.
enableEnum); |
| 2175 bool value = !options.enableEnum; |
| 2176 options.enableEnum = value; |
| 2177 JUnitTestCase.assertEquals(value, options.enableEnum); |
| 2178 } |
| 2179 |
| 2180 void test_getGenerateSdkErrors() { |
| 2181 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2182 bool value = !options.generateSdkErrors; |
| 2183 options.generateSdkErrors = value; |
| 2184 JUnitTestCase.assertEquals(value, options.generateSdkErrors); |
| 2185 } |
| 2186 |
| 2187 void test_getHint() { |
| 2188 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2189 bool value = !options.hint; |
| 2190 options.hint = value; |
| 2191 JUnitTestCase.assertEquals(value, options.hint); |
| 2192 } |
| 2193 |
| 2194 void test_getIncremental() { |
| 2195 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2196 bool value = !options.incremental; |
| 2197 options.incremental = value; |
| 2198 JUnitTestCase.assertEquals(value, options.incremental); |
| 2199 } |
| 2200 |
| 2201 void test_getPreserveComments() { |
| 2202 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2203 bool value = !options.preserveComments; |
| 2204 options.preserveComments = value; |
| 2205 JUnitTestCase.assertEquals(value, options.preserveComments); |
| 2206 } |
| 2207 |
| 2208 static dartSuite() { |
| 2209 _ut.group('AnalysisOptionsImplTest', () { |
| 2210 _ut.test('test_AnalysisOptionsImpl_copy', () { |
| 2211 final __test = new AnalysisOptionsImplTest(); |
| 2212 runJUnitTest(__test, __test.test_AnalysisOptionsImpl_copy); |
| 2213 }); |
| 2214 _ut.test('test_getAnalyzeAngular', () { |
| 2215 final __test = new AnalysisOptionsImplTest(); |
| 2216 runJUnitTest(__test, __test.test_getAnalyzeAngular); |
| 2217 }); |
| 2218 _ut.test('test_getAnalyzeFunctionBodies', () { |
| 2219 final __test = new AnalysisOptionsImplTest(); |
| 2220 runJUnitTest(__test, __test.test_getAnalyzeFunctionBodies); |
| 2221 }); |
| 2222 _ut.test('test_getAnalyzePolymer', () { |
| 2223 final __test = new AnalysisOptionsImplTest(); |
| 2224 runJUnitTest(__test, __test.test_getAnalyzePolymer); |
| 2225 }); |
| 2226 _ut.test('test_getCacheSize', () { |
| 2227 final __test = new AnalysisOptionsImplTest(); |
| 2228 runJUnitTest(__test, __test.test_getCacheSize); |
| 2229 }); |
| 2230 _ut.test('test_getDart2jsHint', () { |
| 2231 final __test = new AnalysisOptionsImplTest(); |
| 2232 runJUnitTest(__test, __test.test_getDart2jsHint); |
| 2233 }); |
| 2234 _ut.test('test_getEnableAsync', () { |
| 2235 final __test = new AnalysisOptionsImplTest(); |
| 2236 runJUnitTest(__test, __test.test_getEnableAsync); |
| 2237 }); |
| 2238 _ut.test('test_getEnableDeferredLoading', () { |
| 2239 final __test = new AnalysisOptionsImplTest(); |
| 2240 runJUnitTest(__test, __test.test_getEnableDeferredLoading); |
| 2241 }); |
| 2242 _ut.test('test_getEnableEnum', () { |
| 2243 final __test = new AnalysisOptionsImplTest(); |
| 2244 runJUnitTest(__test, __test.test_getEnableEnum); |
| 2245 }); |
| 2246 _ut.test('test_getGenerateSdkErrors', () { |
| 2247 final __test = new AnalysisOptionsImplTest(); |
| 2248 runJUnitTest(__test, __test.test_getGenerateSdkErrors); |
| 2249 }); |
| 2250 _ut.test('test_getHint', () { |
| 2251 final __test = new AnalysisOptionsImplTest(); |
| 2252 runJUnitTest(__test, __test.test_getHint); |
| 2253 }); |
| 2254 _ut.test('test_getIncremental', () { |
| 2255 final __test = new AnalysisOptionsImplTest(); |
| 2256 runJUnitTest(__test, __test.test_getIncremental); |
| 2257 }); |
| 2258 _ut.test('test_getPreserveComments', () { |
| 2259 final __test = new AnalysisOptionsImplTest(); |
| 2260 runJUnitTest(__test, __test.test_getPreserveComments); |
| 2261 }); |
| 2262 }); |
| 2263 } |
| 2264 } |
| 2265 |
| 2266 |
| 2267 class AnalysisTaskTest extends EngineTestCase { |
| 2268 void test_perform_exception() { |
| 2269 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 2270 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 2271 AnalysisTask task = new AnalysisTask_test_perform_exception(context); |
| 2272 task.perform(new TestTaskVisitor<Object>()); |
| 2273 } |
| 2274 |
| 2275 static dartSuite() { |
| 2276 _ut.group('AnalysisTaskTest', () { |
| 2277 _ut.test('test_perform_exception', () { |
| 2278 final __test = new AnalysisTaskTest(); |
| 2279 runJUnitTest(__test, __test.test_perform_exception); |
| 2280 }); |
| 2281 }); |
| 2282 } |
| 2283 } |
| 2284 |
| 2285 |
| 2286 class AnalysisTask_test_perform_exception extends AnalysisTask { |
| 2287 AnalysisTask_test_perform_exception(InternalAnalysisContext arg0) : super(arg0
); |
| 2288 @override |
| 2289 String get taskDescription => null; |
| 2290 @override |
| 2291 accept(AnalysisTaskVisitor visitor) { |
| 2292 JUnitTestCase.assertNotNull(exception); |
| 2293 return null; |
| 2294 } |
| 2295 @override |
| 2296 void internalPerform() { |
| 2297 throw new AnalysisException("Forced exception"); |
| 2298 } |
| 2299 } |
| 2300 |
| 2301 |
| 2302 class CompilationUnitMock extends TypedMock implements CompilationUnit { |
| 2303 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 2304 } |
| 2305 |
| 2306 |
| 2307 class DartEntryImplTest extends EngineTestCase { |
| 2308 void set state2(DataDescriptor descriptor) { |
| 2309 DartEntryImpl entry = new DartEntryImpl(); |
| 2310 JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getState(descriptor)); |
| 2311 entry.setState(descriptor, CacheState.FLUSHED); |
| 2312 JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getState(descriptor)); |
| 2313 } |
| 2314 |
| 2315 void set state3(DataDescriptor descriptor) { |
| 2316 Source source = new TestSource(); |
| 2317 DartEntryImpl entry = new DartEntryImpl(); |
| 2318 JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getStateInLibrary(desc
riptor, source)); |
| 2319 entry.setStateInLibrary(descriptor, source, CacheState.FLUSHED); |
| 2320 JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getStateInLibrary(descrip
tor, source)); |
| 2321 } |
| 2322 |
| 2323 void test_creation() { |
| 2324 Source librarySource = new TestSource(); |
| 2325 DartEntryImpl entry = new DartEntryImpl(); |
| 2326 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.CONT
ENT)); |
| 2327 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELEMEN
T)); |
| 2328 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXPORT
ED_LIBRARIES)); |
| 2329 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMPORT
ED_LIBRARIES)); |
| 2330 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INCLUD
ED_PARTS)); |
| 2331 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_CLI
ENT)); |
| 2332 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_LAU
NCHABLE)); |
| 2333 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.LINE
_INFO)); |
| 2334 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSE_
ERRORS)); |
| 2335 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSED
_UNIT)); |
| 2336 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUBLIC
_NAMESPACE)); |
| 2337 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCAN_E
RRORS)); |
| 2338 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOURCE
_KIND)); |
| 2339 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOKEN_
STREAM)); |
| 2340 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.HINTS, librarySource)); |
| 2341 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.RESOLUTION_ERRORS, librarySource)); |
| 2342 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.RESOLVED_UNIT, librarySource)); |
| 2343 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.VERIFICATION_ERRORS, librarySource)); |
| 2344 } |
| 2345 |
| 2346 void test_getAllErrors() { |
| 2347 Source source = new TestSource(); |
| 2348 DartEntryImpl entry = new DartEntryImpl(); |
| 2349 EngineTestCase.assertLength(0, entry.allErrors); |
| 2350 entry.setValue(DartEntry.SCAN_ERRORS, <AnalysisError> [new AnalysisError.con
1(source, ScannerErrorCode.UNTERMINATED_STRING_LITERAL, [])]); |
| 2351 entry.setValue(DartEntry.PARSE_ERRORS, <AnalysisError> [new AnalysisError.co
n1(source, ParserErrorCode.ABSTRACT_CLASS_MEMBER, [])]); |
| 2352 entry.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, source, <AnalysisError>
[new AnalysisError.con1(source, CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_E
XCEPTION, [])]); |
| 2353 entry.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, source, <AnalysisErro
r> [new AnalysisError.con1(source, StaticWarningCode.CASE_BLOCK_NOT_TERMINATED,
[])]); |
| 2354 entry.setValueInLibrary(DartEntry.HINTS, source, <AnalysisError> [new Analys
isError.con1(source, HintCode.DEAD_CODE, [])]); |
| 2355 EngineTestCase.assertLength(5, entry.allErrors); |
| 2356 } |
| 2357 |
| 2358 void test_getResolvableCompilationUnit_none() { |
| 2359 DartEntryImpl entry = new DartEntryImpl(); |
| 2360 JUnitTestCase.assertNull(entry.resolvableCompilationUnit); |
| 2361 } |
| 2362 |
| 2363 void test_getResolvableCompilationUnit_parsed_accessed() { |
| 2364 String importUri = "f1.dart"; |
| 2365 Source importSource = new TestSource(importUri); |
| 2366 ImportDirective importDirective = AstFactory.importDirective3(importUri, nul
l, []); |
| 2367 importDirective.source = importSource; |
| 2368 importDirective.uriContent = importUri; |
| 2369 String exportUri = "f2.dart"; |
| 2370 Source exportSource = new TestSource(exportUri); |
| 2371 ExportDirective exportDirective = AstFactory.exportDirective2(exportUri, [])
; |
| 2372 exportDirective.source = exportSource; |
| 2373 exportDirective.uriContent = exportUri; |
| 2374 String partUri = "f3.dart"; |
| 2375 Source partSource = new TestSource(partUri); |
| 2376 PartDirective partDirective = AstFactory.partDirective2(partUri); |
| 2377 partDirective.source = partSource; |
| 2378 partDirective.uriContent = partUri; |
| 2379 CompilationUnit unit = AstFactory.compilationUnit3([importDirective, exportD
irective, partDirective]); |
| 2380 DartEntryImpl entry = new DartEntryImpl(); |
| 2381 entry.setValue(DartEntry.PARSED_UNIT, unit); |
| 2382 entry.getValue(DartEntry.PARSED_UNIT); |
| 2383 CompilationUnit result = entry.resolvableCompilationUnit; |
| 2384 JUnitTestCase.assertNotSame(unit, result); |
| 2385 NodeList<Directive> directives = result.directives; |
| 2386 ImportDirective resultImportDirective = directives[0] as ImportDirective; |
| 2387 JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); |
| 2388 JUnitTestCase.assertSame(importSource, resultImportDirective.source); |
| 2389 ExportDirective resultExportDirective = directives[1] as ExportDirective; |
| 2390 JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); |
| 2391 JUnitTestCase.assertSame(exportSource, resultExportDirective.source); |
| 2392 PartDirective resultPartDirective = directives[2] as PartDirective; |
| 2393 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); |
| 2394 JUnitTestCase.assertSame(partSource, resultPartDirective.source); |
| 2395 } |
| 2396 |
| 2397 void test_getResolvableCompilationUnit_parsed_notAccessed() { |
| 2398 CompilationUnit unit = AstFactory.compilationUnit(); |
| 2399 DartEntryImpl entry = new DartEntryImpl(); |
| 2400 entry.setValue(DartEntry.PARSED_UNIT, unit); |
| 2401 JUnitTestCase.assertSame(unit, entry.resolvableCompilationUnit); |
| 2402 } |
| 2403 |
| 2404 void test_getResolvableCompilationUnit_resolved() { |
| 2405 String importUri = "f1.dart"; |
| 2406 Source importSource = new TestSource(importUri); |
| 2407 ImportDirective importDirective = AstFactory.importDirective3(importUri, nul
l, []); |
| 2408 importDirective.source = importSource; |
| 2409 importDirective.uriContent = importUri; |
| 2410 String exportUri = "f2.dart"; |
| 2411 Source exportSource = new TestSource(exportUri); |
| 2412 ExportDirective exportDirective = AstFactory.exportDirective2(exportUri, [])
; |
| 2413 exportDirective.source = exportSource; |
| 2414 exportDirective.uriContent = exportUri; |
| 2415 String partUri = "f3.dart"; |
| 2416 Source partSource = new TestSource(partUri); |
| 2417 PartDirective partDirective = AstFactory.partDirective2(partUri); |
| 2418 partDirective.source = partSource; |
| 2419 partDirective.uriContent = partUri; |
| 2420 CompilationUnit unit = AstFactory.compilationUnit3([importDirective, exportD
irective, partDirective]); |
| 2421 DartEntryImpl entry = new DartEntryImpl(); |
| 2422 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, new TestSource("lib.dart"),
unit); |
| 2423 CompilationUnit result = entry.resolvableCompilationUnit; |
| 2424 JUnitTestCase.assertNotSame(unit, result); |
| 2425 NodeList<Directive> directives = result.directives; |
| 2426 ImportDirective resultImportDirective = directives[0] as ImportDirective; |
| 2427 JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); |
| 2428 JUnitTestCase.assertSame(importSource, resultImportDirective.source); |
| 2429 ExportDirective resultExportDirective = directives[1] as ExportDirective; |
| 2430 JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); |
| 2431 JUnitTestCase.assertSame(exportSource, resultExportDirective.source); |
| 2432 PartDirective resultPartDirective = directives[2] as PartDirective; |
| 2433 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); |
| 2434 JUnitTestCase.assertSame(partSource, resultPartDirective.source); |
| 2435 } |
| 2436 |
| 2437 void test_getStateInLibrary_invalid_element() { |
| 2438 DartEntryImpl entry = new DartEntryImpl(); |
| 2439 try { |
| 2440 entry.getStateInLibrary(DartEntry.ELEMENT, new TestSource()); |
| 2441 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); |
| 2442 } on IllegalArgumentException catch (exception) { |
| 2443 } |
| 2444 } |
| 2445 |
| 2446 void test_getState_invalid_resolutionErrors() { |
| 2447 DartEntryImpl entry = new DartEntryImpl(); |
| 2448 try { |
| 2449 entry.getState(DartEntry.RESOLUTION_ERRORS); |
| 2450 JUnitTestCase.fail("Expected IllegalArgumentException for RESOLUTION_ERROR
S"); |
| 2451 } on IllegalArgumentException catch (exception) { |
| 2452 } |
| 2453 } |
| 2454 |
| 2455 void test_getState_invalid_verificationErrors() { |
| 2456 DartEntryImpl entry = new DartEntryImpl(); |
| 2457 try { |
| 2458 entry.getState(DartEntry.VERIFICATION_ERRORS); |
| 2459 JUnitTestCase.fail("Expected IllegalArgumentException for VERIFICATION_ERR
ORS"); |
| 2460 } on IllegalArgumentException catch (exception) { |
| 2461 } |
| 2462 } |
| 2463 |
| 2464 void test_getValueInLibrary_invalid_element() { |
| 2465 DartEntryImpl entry = new DartEntryImpl(); |
| 2466 try { |
| 2467 entry.getValueInLibrary(DartEntry.ELEMENT, new TestSource()); |
| 2468 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); |
| 2469 } on IllegalArgumentException catch (exception) { |
| 2470 } |
| 2471 } |
| 2472 |
| 2473 void test_getValueInLibrary_invalid_resolutionErrors_multiple() { |
| 2474 Source source1 = new TestSource(); |
| 2475 Source source2 = new TestSource(); |
| 2476 Source source3 = new TestSource(); |
| 2477 DartEntryImpl entry = new DartEntryImpl(); |
| 2478 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.compila
tionUnit()); |
| 2479 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source2, AstFactory.compila
tionUnit()); |
| 2480 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source3, AstFactory.compila
tionUnit()); |
| 2481 try { |
| 2482 entry.getValueInLibrary(DartEntry.ELEMENT, source3); |
| 2483 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); |
| 2484 } on IllegalArgumentException catch (exception) { |
| 2485 } |
| 2486 } |
| 2487 |
| 2488 void test_getValue_containingLibraries() { |
| 2489 Source testSource = new TestSource(); |
| 2490 DartEntryImpl entry = new DartEntryImpl(); |
| 2491 List<Source> value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); |
| 2492 EngineTestCase.assertLength(0, value); |
| 2493 entry.addContainingLibrary(testSource); |
| 2494 value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); |
| 2495 EngineTestCase.assertLength(1, value); |
| 2496 JUnitTestCase.assertEquals(testSource, value[0]); |
| 2497 entry.removeContainingLibrary(testSource); |
| 2498 value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); |
| 2499 EngineTestCase.assertLength(0, value); |
| 2500 } |
| 2501 |
| 2502 void test_getValue_invalid_resolutionErrors() { |
| 2503 DartEntryImpl entry = new DartEntryImpl(); |
| 2504 try { |
| 2505 entry.getValue(DartEntry.RESOLUTION_ERRORS); |
| 2506 JUnitTestCase.fail("Expected IllegalArgumentException for RESOLUTION_ERROR
S"); |
| 2507 } on IllegalArgumentException catch (exception) { |
| 2508 } |
| 2509 } |
| 2510 |
| 2511 void test_getValue_invalid_verificationErrors() { |
| 2512 DartEntryImpl entry = new DartEntryImpl(); |
| 2513 try { |
| 2514 entry.getValue(DartEntry.VERIFICATION_ERRORS); |
| 2515 JUnitTestCase.fail("Expected IllegalArgumentException for VERIFICATION_ERR
ORS"); |
| 2516 } on IllegalArgumentException catch (exception) { |
| 2517 } |
| 2518 } |
| 2519 |
| 2520 void test_getWritableCopy() { |
| 2521 DartEntryImpl entry = new DartEntryImpl(); |
| 2522 DartEntryImpl copy = entry.writableCopy; |
| 2523 JUnitTestCase.assertNotNull(copy); |
| 2524 JUnitTestCase.assertNotSame(entry, copy); |
| 2525 } |
| 2526 |
| 2527 void test_hasInvalidData_false() { |
| 2528 DartEntryImpl entry = new DartEntryImpl(); |
| 2529 entry.recordScanError(new CaughtException(new AnalysisException(), null)); |
| 2530 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.ELEMENT)); |
| 2531 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIES)
); |
| 2532 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.HINTS)); |
| 2533 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IMPORTED_LIBRARIES)
); |
| 2534 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.INCLUDED_PARTS)); |
| 2535 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IS_CLIENT)); |
| 2536 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IS_LAUNCHABLE)); |
| 2537 JUnitTestCase.assertFalse(entry.hasInvalidData(SourceEntry.LINE_INFO)); |
| 2538 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PARSE_ERRORS)); |
| 2539 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PARSED_UNIT)); |
| 2540 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PUBLIC_NAMESPACE)); |
| 2541 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.SOURCE_KIND)); |
| 2542 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.RESOLUTION_ERRORS))
; |
| 2543 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.RESOLVED_UNIT)); |
| 2544 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.VERIFICATION_ERRORS
)); |
| 2545 } |
| 2546 |
| 2547 void test_hasInvalidData_true() { |
| 2548 DartEntryImpl entry = new DartEntryImpl(); |
| 2549 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.ELEMENT)); |
| 2550 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIES))
; |
| 2551 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.HINTS)); |
| 2552 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IMPORTED_LIBRARIES))
; |
| 2553 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.INCLUDED_PARTS)); |
| 2554 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IS_CLIENT)); |
| 2555 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IS_LAUNCHABLE)); |
| 2556 JUnitTestCase.assertTrue(entry.hasInvalidData(SourceEntry.LINE_INFO)); |
| 2557 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PARSE_ERRORS)); |
| 2558 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PARSED_UNIT)); |
| 2559 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PUBLIC_NAMESPACE)); |
| 2560 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.SOURCE_KIND)); |
| 2561 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.RESOLUTION_ERRORS)); |
| 2562 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.RESOLVED_UNIT)); |
| 2563 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.VERIFICATION_ERRORS)
); |
| 2564 } |
| 2565 |
| 2566 void test_invalidateAllInformation() { |
| 2567 DartEntryImpl entry = _entryWithValidState(); |
| 2568 entry.invalidateAllInformation(); |
| 2569 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELEMEN
T)); |
| 2570 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXPORT
ED_LIBRARIES)); |
| 2571 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMPORT
ED_LIBRARIES)); |
| 2572 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INCLUD
ED_PARTS)); |
| 2573 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_CLI
ENT)); |
| 2574 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_LAU
NCHABLE)); |
| 2575 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.LINE
_INFO)); |
| 2576 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSE_
ERRORS)); |
| 2577 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSED
_UNIT)); |
| 2578 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUBLIC
_NAMESPACE)); |
| 2579 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCAN_E
RRORS)); |
| 2580 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOKEN_
STREAM)); |
| 2581 } |
| 2582 |
| 2583 void test_invalidateAllResolutionInformation() { |
| 2584 DartEntryImpl entry = _entryWithValidState(); |
| 2585 entry.invalidateAllResolutionInformation(false); |
| 2586 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELEMEN
T)); |
| 2587 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_CLI
ENT)); |
| 2588 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_LAU
NCHABLE)); |
| 2589 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LINE_I
NFO)); |
| 2590 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE_ER
RORS)); |
| 2591 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSED_U
NIT)); |
| 2592 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUBLIC
_NAMESPACE)); |
| 2593 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.EXPORTED
_LIBRARIES)); |
| 2594 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IMPORTED
_LIBRARIES)); |
| 2595 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.INCLUDED
_PARTS)); |
| 2596 } |
| 2597 |
| 2598 void test_invalidateAllResolutionInformation_includingUris() { |
| 2599 DartEntryImpl entry = _entryWithValidState(); |
| 2600 entry.invalidateAllResolutionInformation(true); |
| 2601 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELEMEN
T)); |
| 2602 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_CLI
ENT)); |
| 2603 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_LAU
NCHABLE)); |
| 2604 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LINE_I
NFO)); |
| 2605 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE_ER
RORS)); |
| 2606 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSED_U
NIT)); |
| 2607 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUBLIC
_NAMESPACE)); |
| 2608 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXPORT
ED_LIBRARIES)); |
| 2609 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMPORT
ED_LIBRARIES)); |
| 2610 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INCLUD
ED_PARTS)); |
| 2611 } |
| 2612 |
| 2613 void test_isClient() { |
| 2614 DartEntryImpl entry = new DartEntryImpl(); |
| 2615 // true |
| 2616 entry.setValue(DartEntry.IS_CLIENT, true); |
| 2617 JUnitTestCase.assertTrue(entry.getValue(DartEntry.IS_CLIENT)); |
| 2618 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_CLIEN
T)); |
| 2619 // invalidate |
| 2620 entry.setState(DartEntry.IS_CLIENT, CacheState.INVALID); |
| 2621 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_CLI
ENT)); |
| 2622 // false |
| 2623 entry.setValue(DartEntry.IS_CLIENT, false); |
| 2624 JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_CLIENT)); |
| 2625 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_CLIEN
T)); |
| 2626 } |
| 2627 |
| 2628 void test_isLaunchable() { |
| 2629 DartEntryImpl entry = new DartEntryImpl(); |
| 2630 // true |
| 2631 entry.setValue(DartEntry.IS_LAUNCHABLE, true); |
| 2632 JUnitTestCase.assertTrue(entry.getValue(DartEntry.IS_LAUNCHABLE)); |
| 2633 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 2634 // invalidate |
| 2635 entry.setState(DartEntry.IS_LAUNCHABLE, CacheState.INVALID); |
| 2636 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_LAU
NCHABLE)); |
| 2637 // false |
| 2638 entry.setValue(DartEntry.IS_LAUNCHABLE, false); |
| 2639 JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_LAUNCHABLE)); |
| 2640 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 2641 } |
| 2642 |
| 2643 void test_recordBuildElementErrorInLibrary() { |
| 2644 // TODO(brianwilkerson) This test should set the state for two libraries, re
cord an error in one |
| 2645 // library, then verify that the data for the other library is still valid. |
| 2646 Source source = new TestSource(); |
| 2647 DartEntryImpl entry = new DartEntryImpl(); |
| 2648 entry.recordBuildElementErrorInLibrary(source, new CaughtException(new Analy
sisException(), null)); |
| 2649 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.CONT
ENT)); |
| 2650 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEMENT)
); |
| 2651 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXPORT
ED_LIBRARIES)); |
| 2652 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMPORT
ED_LIBRARIES)); |
| 2653 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INCLUD
ED_PARTS)); |
| 2654 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CLIEN
T)); |
| 2655 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 2656 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.LINE
_INFO)); |
| 2657 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSE_
ERRORS)); |
| 2658 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSED
_UNIT)); |
| 2659 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUBLIC
_NAMESPACE)); |
| 2660 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCAN_E
RRORS)); |
| 2661 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOURCE
_KIND)); |
| 2662 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOKEN_
STREAM)); |
| 2663 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.HINTS, source)); |
| 2664 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.RESOLUTION_ERRORS, source)); |
| 2665 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.RESOLVED_UNIT, source)); |
| 2666 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.VERIFICATION_ERRORS, source)); |
| 2667 } |
| 2668 |
| 2669 void test_recordContentError() { |
| 2670 // Source source = new TestSource(); |
| 2671 DartEntryImpl entry = new DartEntryImpl(); |
| 2672 entry.recordContentError(new CaughtException(new AnalysisException(), null))
; |
| 2673 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(SourceEntry.CONTEN
T)); |
| 2674 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEMENT)
); |
| 2675 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.EXPORTED
_LIBRARIES)); |
| 2676 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IMPORTED
_LIBRARIES)); |
| 2677 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.INCLUDED
_PARTS)); |
| 2678 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CLIEN
T)); |
| 2679 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 2680 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(SourceEntry.LINE_I
NFO)); |
| 2681 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE_ER
RORS)); |
| 2682 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSED_U
NIT)); |
| 2683 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLIC_N
AMESPACE)); |
| 2684 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SCAN_ERR
ORS)); |
| 2685 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SOURCE_K
IND)); |
| 2686 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.TOKEN_ST
REAM)); |
| 2687 } |
| 2688 |
| 2689 void test_recordHintErrorInLibrary() { |
| 2690 // TODO(brianwilkerson) This test should set the state for two libraries, re
cord an error in one |
| 2691 // library, then verify that the data for the other library is still valid. |
| 2692 Source source = new TestSource(); |
| 2693 DartEntryImpl entry = new DartEntryImpl(); |
| 2694 entry.recordHintErrorInLibrary(source, new CaughtException(new AnalysisExcep
tion(), null)); |
| 2695 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.CONT
ENT)); |
| 2696 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELEMEN
T)); |
| 2697 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXPORT
ED_LIBRARIES)); |
| 2698 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMPORT
ED_LIBRARIES)); |
| 2699 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INCLUD
ED_PARTS)); |
| 2700 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_CLI
ENT)); |
| 2701 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_LAU
NCHABLE)); |
| 2702 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.LINE
_INFO)); |
| 2703 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSE_
ERRORS)); |
| 2704 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSED
_UNIT)); |
| 2705 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUBLIC
_NAMESPACE)); |
| 2706 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCAN_E
RRORS)); |
| 2707 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOURCE
_KIND)); |
| 2708 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOKEN_
STREAM)); |
| 2709 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.HINTS, source)); |
| 2710 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.RESOLUTION_ERRORS, source)); |
| 2711 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.RESOLVED_UNIT, source)); |
| 2712 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.VERIFICATION_ERRORS, source)); |
| 2713 } |
| 2714 |
| 2715 void test_recordParseError() { |
| 2716 // Source source = new TestSource(); |
| 2717 DartEntryImpl entry = new DartEntryImpl(); |
| 2718 entry.recordParseError(new CaughtException(new AnalysisException(), null)); |
| 2719 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.CONT
ENT)); |
| 2720 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEMENT)
); |
| 2721 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.EXPORTED
_LIBRARIES)); |
| 2722 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IMPORTED
_LIBRARIES)); |
| 2723 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.INCLUDED
_PARTS)); |
| 2724 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CLIEN
T)); |
| 2725 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 2726 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.LINE
_INFO)); |
| 2727 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE_ER
RORS)); |
| 2728 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSED_U
NIT)); |
| 2729 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLIC_N
AMESPACE)); |
| 2730 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCAN_E
RRORS)); |
| 2731 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SOURCE_K
IND)); |
| 2732 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOKEN_
STREAM)); |
| 2733 } |
| 2734 |
| 2735 void test_recordParseInProcess() { |
| 2736 DartEntryImpl entry = new DartEntryImpl(); |
| 2737 entry.recordParseInProcess(); |
| 2738 JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.PAR
SE_ERRORS)); |
| 2739 JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.PAR
SED_UNIT)); |
| 2740 JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.SOU
RCE_KIND)); |
| 2741 } |
| 2742 |
| 2743 void test_recordResolutionError() { |
| 2744 // Source source = new TestSource(); |
| 2745 DartEntryImpl entry = new DartEntryImpl(); |
| 2746 entry.recordResolutionError(new CaughtException(new AnalysisException(), nul
l)); |
| 2747 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.CONT
ENT)); |
| 2748 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEMENT)
); |
| 2749 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXPORT
ED_LIBRARIES)); |
| 2750 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMPORT
ED_LIBRARIES)); |
| 2751 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INCLUD
ED_PARTS)); |
| 2752 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CLIEN
T)); |
| 2753 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 2754 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.LINE
_INFO)); |
| 2755 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSE_
ERRORS)); |
| 2756 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSED
_UNIT)); |
| 2757 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLIC_N
AMESPACE)); |
| 2758 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCAN_E
RRORS)); |
| 2759 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOURCE
_KIND)); |
| 2760 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOKEN_
STREAM)); |
| 2761 } |
| 2762 |
| 2763 void test_recordResolutionErrorInLibrary() { |
| 2764 // TODO(brianwilkerson) This test should set the state for two libraries, re
cord an error in one |
| 2765 // library, then verify that the data for the other library is still valid. |
| 2766 Source source = new TestSource(); |
| 2767 DartEntryImpl entry = new DartEntryImpl(); |
| 2768 entry.recordResolutionErrorInLibrary(source, new CaughtException(new Analysi
sException(), null)); |
| 2769 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.CONT
ENT)); |
| 2770 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEMENT)
); |
| 2771 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXPORT
ED_LIBRARIES)); |
| 2772 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMPORT
ED_LIBRARIES)); |
| 2773 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INCLUD
ED_PARTS)); |
| 2774 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CLIEN
T)); |
| 2775 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 2776 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.LINE
_INFO)); |
| 2777 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSE_
ERRORS)); |
| 2778 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSED
_UNIT)); |
| 2779 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLIC_N
AMESPACE)); |
| 2780 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCAN_E
RRORS)); |
| 2781 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOURCE
_KIND)); |
| 2782 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOKEN_
STREAM)); |
| 2783 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.HINTS, source)); |
| 2784 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.RESOLUTION_ERRORS, source)); |
| 2785 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.RESOLVED_UNIT, source)); |
| 2786 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.VERIFICATION_ERRORS, source)); |
| 2787 } |
| 2788 |
| 2789 void test_recordScanError() { |
| 2790 // Source source = new TestSource(); |
| 2791 DartEntryImpl entry = new DartEntryImpl(); |
| 2792 entry.recordScanError(new CaughtException(new AnalysisException(), null)); |
| 2793 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.CONT
ENT)); |
| 2794 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.ELEMENT)
); |
| 2795 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.EXPORTED
_LIBRARIES)); |
| 2796 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IMPORTED
_LIBRARIES)); |
| 2797 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.INCLUDED
_PARTS)); |
| 2798 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_CLIEN
T)); |
| 2799 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 2800 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(SourceEntry.LINE_I
NFO)); |
| 2801 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSE_ER
RORS)); |
| 2802 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PARSED_U
NIT)); |
| 2803 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.PUBLIC_N
AMESPACE)); |
| 2804 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SCAN_ERR
ORS)); |
| 2805 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.SOURCE_K
IND)); |
| 2806 JUnitTestCase.assertSame(CacheState.ERROR, entry.getState(DartEntry.TOKEN_ST
REAM)); |
| 2807 } |
| 2808 |
| 2809 void test_recordScanInProcess() { |
| 2810 DartEntryImpl entry = new DartEntryImpl(); |
| 2811 entry.recordScanInProcess(); |
| 2812 JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(SourceEntry.L
INE_INFO)); |
| 2813 JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.SCA
N_ERRORS)); |
| 2814 JUnitTestCase.assertSame(CacheState.IN_PROCESS, entry.getState(DartEntry.TOK
EN_STREAM)); |
| 2815 } |
| 2816 |
| 2817 void test_recordVerificationErrorInLibrary() { |
| 2818 // TODO(brianwilkerson) This test should set the state for two libraries, re
cord an error in one |
| 2819 // library, then verify that the data for the other library is still valid. |
| 2820 Source source = new TestSource(); |
| 2821 DartEntryImpl entry = new DartEntryImpl(); |
| 2822 entry.recordVerificationErrorInLibrary(source, new CaughtException(new Analy
sisException(), null)); |
| 2823 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.CONT
ENT)); |
| 2824 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.ELEMEN
T)); |
| 2825 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.EXPORT
ED_LIBRARIES)); |
| 2826 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IMPORT
ED_LIBRARIES)); |
| 2827 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.INCLUD
ED_PARTS)); |
| 2828 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_CLI
ENT)); |
| 2829 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.IS_LAU
NCHABLE)); |
| 2830 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(SourceEntry.LINE
_INFO)); |
| 2831 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSE_
ERRORS)); |
| 2832 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PARSED
_UNIT)); |
| 2833 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.PUBLIC
_NAMESPACE)); |
| 2834 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SCAN_E
RRORS)); |
| 2835 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.SOURCE
_KIND)); |
| 2836 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(DartEntry.TOKEN_
STREAM)); |
| 2837 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.HINTS, source)); |
| 2838 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.RESOLUTION_ERRORS, source)); |
| 2839 JUnitTestCase.assertSame(CacheState.INVALID, entry.getStateInLibrary(DartEnt
ry.RESOLVED_UNIT, source)); |
| 2840 JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry
.VERIFICATION_ERRORS, source)); |
| 2841 } |
| 2842 |
| 2843 void test_removeResolution_multiple_first() { |
| 2844 Source source1 = new TestSource(); |
| 2845 Source source2 = new TestSource(); |
| 2846 Source source3 = new TestSource(); |
| 2847 DartEntryImpl entry = new DartEntryImpl(); |
| 2848 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.compila
tionUnit()); |
| 2849 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source2, AstFactory.compila
tionUnit()); |
| 2850 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source3, AstFactory.compila
tionUnit()); |
| 2851 entry.removeResolution(source1); |
| 2852 } |
| 2853 |
| 2854 void test_removeResolution_multiple_last() { |
| 2855 Source source1 = new TestSource(); |
| 2856 Source source2 = new TestSource(); |
| 2857 Source source3 = new TestSource(); |
| 2858 DartEntryImpl entry = new DartEntryImpl(); |
| 2859 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.compila
tionUnit()); |
| 2860 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source2, AstFactory.compila
tionUnit()); |
| 2861 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source3, AstFactory.compila
tionUnit()); |
| 2862 entry.removeResolution(source3); |
| 2863 } |
| 2864 |
| 2865 void test_removeResolution_multiple_middle() { |
| 2866 Source source1 = new TestSource(); |
| 2867 Source source2 = new TestSource(); |
| 2868 Source source3 = new TestSource(); |
| 2869 DartEntryImpl entry = new DartEntryImpl(); |
| 2870 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.compila
tionUnit()); |
| 2871 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source2, AstFactory.compila
tionUnit()); |
| 2872 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source3, AstFactory.compila
tionUnit()); |
| 2873 entry.removeResolution(source2); |
| 2874 } |
| 2875 |
| 2876 void test_removeResolution_single() { |
| 2877 Source source1 = new TestSource(); |
| 2878 DartEntryImpl entry = new DartEntryImpl(); |
| 2879 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source1, AstFactory.compila
tionUnit()); |
| 2880 entry.removeResolution(source1); |
| 2881 } |
| 2882 |
| 2883 void test_resolutionState() { |
| 2884 DartEntryImpl entry1 = new DartEntryImpl(); |
| 2885 Source libSrc1 = new TestSource("/test1.dart"); |
| 2886 Source libSrc2 = new TestSource("/test2.dart"); |
| 2887 ParserErrorCode errCode = ParserErrorCode.DIRECTIVE_AFTER_DECLARATION; |
| 2888 List<AnalysisError> errors1 = <AnalysisError> [new AnalysisError.con2(libSrc
1, 0, 10, errCode, [])]; |
| 2889 List<AnalysisError> errors2 = <AnalysisError> [new AnalysisError.con2(libSrc
2, 0, 20, errCode, [])]; |
| 2890 entry1.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, libSrc1, errors1); |
| 2891 entry1.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, libSrc2, errors2); |
| 2892 TestDartEntryImpl entry2 = new TestDartEntryImpl(); |
| 2893 entry2.copyFrom(entry1); |
| 2894 EngineTestCase.assertExactElementsInArray(entry2.allErrors, [errors1[0], err
ors2[0]]); |
| 2895 entry1.removeResolution(libSrc2); |
| 2896 EngineTestCase.assertExactElementsInArray(entry1.allErrors, [errors1[0]]); |
| 2897 entry2.removeResolution(libSrc1); |
| 2898 EngineTestCase.assertExactElementsInArray(entry2.allErrors, [errors2[0]]); |
| 2899 entry2.removeResolution(libSrc2); |
| 2900 EngineTestCase.assertExactElementsInArray(entry2.allErrors, []); |
| 2901 } |
| 2902 |
| 2903 void test_setState_element() { |
| 2904 state2 = DartEntry.ELEMENT; |
| 2905 } |
| 2906 |
| 2907 void test_setState_exportedLibraries() { |
| 2908 state2 = DartEntry.EXPORTED_LIBRARIES; |
| 2909 } |
| 2910 |
| 2911 void test_setState_hints() { |
| 2912 state3 = DartEntry.HINTS; |
| 2913 } |
| 2914 |
| 2915 void test_setState_importedLibraries() { |
| 2916 state2 = DartEntry.IMPORTED_LIBRARIES; |
| 2917 } |
| 2918 |
| 2919 void test_setState_includedParts() { |
| 2920 state2 = DartEntry.INCLUDED_PARTS; |
| 2921 } |
| 2922 |
| 2923 void test_setState_invalid_element() { |
| 2924 DartEntryImpl entry = new DartEntryImpl(); |
| 2925 try { |
| 2926 entry.setStateInLibrary(DartEntry.ELEMENT, null, CacheState.FLUSHED); |
| 2927 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); |
| 2928 } on IllegalArgumentException catch (exception) { |
| 2929 } |
| 2930 } |
| 2931 |
| 2932 void test_setState_invalid_resolutionErrors() { |
| 2933 DartEntryImpl entry = new DartEntryImpl(); |
| 2934 try { |
| 2935 entry.setState(DartEntry.RESOLUTION_ERRORS, CacheState.FLUSHED); |
| 2936 JUnitTestCase.fail("Expected IllegalArgumentException for RESOLUTION_ERROR
S"); |
| 2937 } on IllegalArgumentException catch (exception) { |
| 2938 } |
| 2939 } |
| 2940 |
| 2941 void test_setState_invalid_validState() { |
| 2942 DartEntryImpl entry = new DartEntryImpl(); |
| 2943 try { |
| 2944 entry.setState(SourceEntry.LINE_INFO, CacheState.VALID); |
| 2945 JUnitTestCase.fail("Expected IllegalArgumentException for a state of VALID
"); |
| 2946 } on IllegalArgumentException catch (exception) { |
| 2947 } |
| 2948 } |
| 2949 |
| 2950 void test_setState_invalid_verificationErrors() { |
| 2951 DartEntryImpl entry = new DartEntryImpl(); |
| 2952 try { |
| 2953 entry.setState(DartEntry.VERIFICATION_ERRORS, CacheState.FLUSHED); |
| 2954 JUnitTestCase.fail("Expected IllegalArgumentException for VERIFICATION_ERR
ORS"); |
| 2955 } on IllegalArgumentException catch (exception) { |
| 2956 } |
| 2957 } |
| 2958 |
| 2959 void test_setState_isClient() { |
| 2960 state2 = DartEntry.IS_CLIENT; |
| 2961 } |
| 2962 |
| 2963 void test_setState_isLaunchable() { |
| 2964 state2 = DartEntry.IS_LAUNCHABLE; |
| 2965 } |
| 2966 |
| 2967 void test_setState_lineInfo() { |
| 2968 state2 = SourceEntry.LINE_INFO; |
| 2969 } |
| 2970 |
| 2971 void test_setState_parseErrors() { |
| 2972 state2 = DartEntry.PARSE_ERRORS; |
| 2973 } |
| 2974 |
| 2975 void test_setState_parsedUnit() { |
| 2976 state2 = DartEntry.PARSED_UNIT; |
| 2977 } |
| 2978 |
| 2979 void test_setState_publicNamespace() { |
| 2980 state2 = DartEntry.PUBLIC_NAMESPACE; |
| 2981 } |
| 2982 |
| 2983 void test_setState_resolutionErrors() { |
| 2984 state3 = DartEntry.RESOLUTION_ERRORS; |
| 2985 } |
| 2986 |
| 2987 void test_setState_resolvedUnit() { |
| 2988 state3 = DartEntry.RESOLVED_UNIT; |
| 2989 } |
| 2990 |
| 2991 void test_setState_scanErrors() { |
| 2992 state2 = DartEntry.SCAN_ERRORS; |
| 2993 } |
| 2994 |
| 2995 void test_setState_sourceKind() { |
| 2996 state2 = DartEntry.SOURCE_KIND; |
| 2997 } |
| 2998 |
| 2999 void test_setState_tokenStream() { |
| 3000 state2 = DartEntry.TOKEN_STREAM; |
| 3001 } |
| 3002 |
| 3003 void test_setState_verificationErrors() { |
| 3004 state3 = DartEntry.VERIFICATION_ERRORS; |
| 3005 } |
| 3006 |
| 3007 void test_setValue_element() { |
| 3008 _setValue2(DartEntry.ELEMENT, new LibraryElementImpl.forNode(null, AstFactor
y.libraryIdentifier2(["lib"]))); |
| 3009 } |
| 3010 |
| 3011 void test_setValue_exportedLibraries() { |
| 3012 _setValue2(DartEntry.EXPORTED_LIBRARIES, <Source> [new TestSource()]); |
| 3013 } |
| 3014 |
| 3015 void test_setValue_hints() { |
| 3016 _setValue3(DartEntry.HINTS, <AnalysisError> [new AnalysisError.con1(null, Hi
ntCode.DEAD_CODE, [])]); |
| 3017 } |
| 3018 |
| 3019 void test_setValue_importedLibraries() { |
| 3020 _setValue2(DartEntry.IMPORTED_LIBRARIES, <Source> [new TestSource()]); |
| 3021 } |
| 3022 |
| 3023 void test_setValue_includedParts() { |
| 3024 _setValue2(DartEntry.INCLUDED_PARTS, <Source> [new TestSource()]); |
| 3025 } |
| 3026 |
| 3027 void test_setValue_isClient() { |
| 3028 _setValue2(DartEntry.IS_CLIENT, true); |
| 3029 } |
| 3030 |
| 3031 void test_setValue_isLaunchable() { |
| 3032 _setValue2(DartEntry.IS_LAUNCHABLE, true); |
| 3033 } |
| 3034 |
| 3035 void test_setValue_lineInfo() { |
| 3036 _setValue2(SourceEntry.LINE_INFO, new LineInfo(<int> [0])); |
| 3037 } |
| 3038 |
| 3039 void test_setValue_parseErrors() { |
| 3040 _setValue2(DartEntry.PARSE_ERRORS, <AnalysisError> [new AnalysisError.con1(n
ull, ParserErrorCode.ABSTRACT_CLASS_MEMBER, [])]); |
| 3041 } |
| 3042 |
| 3043 void test_setValue_parsedUnit() { |
| 3044 _setValue2(DartEntry.PARSED_UNIT, AstFactory.compilationUnit()); |
| 3045 } |
| 3046 |
| 3047 void test_setValue_publicNamespace() { |
| 3048 _setValue2(DartEntry.PUBLIC_NAMESPACE, new Namespace(new HashMap<String, Ele
ment>())); |
| 3049 } |
| 3050 |
| 3051 void test_setValue_resolutionErrors() { |
| 3052 _setValue3(DartEntry.RESOLUTION_ERRORS, <AnalysisError> [new AnalysisError.c
on1(null, CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION, [])]); |
| 3053 } |
| 3054 |
| 3055 void test_setValue_resolvedUnit() { |
| 3056 _setValue3(DartEntry.RESOLVED_UNIT, AstFactory.compilationUnit()); |
| 3057 } |
| 3058 |
| 3059 void test_setValue_scanErrors() { |
| 3060 _setValue2(DartEntry.SCAN_ERRORS, <AnalysisError> [new AnalysisError.con1(nu
ll, ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT, [])]); |
| 3061 } |
| 3062 |
| 3063 void test_setValue_sourceKind() { |
| 3064 _setValue2(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); |
| 3065 } |
| 3066 |
| 3067 void test_setValue_tokenStream() { |
| 3068 _setValue2(DartEntry.TOKEN_STREAM, new Token(TokenType.LT, 5)); |
| 3069 } |
| 3070 |
| 3071 void test_setValue_verificationErrors() { |
| 3072 _setValue3(DartEntry.VERIFICATION_ERRORS, <AnalysisError> [new AnalysisError
.con1(null, StaticWarningCode.CASE_BLOCK_NOT_TERMINATED, [])]); |
| 3073 } |
| 3074 |
| 3075 DartEntryImpl _entryWithValidState() { |
| 3076 DartEntryImpl entry = new DartEntryImpl(); |
| 3077 entry.setValue(DartEntry.ELEMENT, null); |
| 3078 entry.setValue(DartEntry.EXPORTED_LIBRARIES, null); |
| 3079 entry.setValue(DartEntry.IMPORTED_LIBRARIES, null); |
| 3080 entry.setValue(DartEntry.INCLUDED_PARTS, null); |
| 3081 entry.setValue(DartEntry.IS_CLIENT, true); |
| 3082 entry.setValue(DartEntry.IS_LAUNCHABLE, true); |
| 3083 entry.setValue(SourceEntry.LINE_INFO, null); |
| 3084 entry.setValue(DartEntry.PARSE_ERRORS, null); |
| 3085 entry.setValue(DartEntry.PARSED_UNIT, null); |
| 3086 entry.setValue(DartEntry.PUBLIC_NAMESPACE, null); |
| 3087 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.ELEMENT)
); |
| 3088 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.EXPORTED
_LIBRARIES)); |
| 3089 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IMPORTED
_LIBRARIES)); |
| 3090 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.INCLUDED
_PARTS)); |
| 3091 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_CLIEN
T)); |
| 3092 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.IS_LAUNC
HABLE)); |
| 3093 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LINE_I
NFO)); |
| 3094 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSE_ER
RORS)); |
| 3095 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PARSED_U
NIT)); |
| 3096 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(DartEntry.PUBLIC_N
AMESPACE)); |
| 3097 return entry; |
| 3098 } |
| 3099 |
| 3100 void _setValue2(DataDescriptor descriptor, Object newValue) { |
| 3101 DartEntryImpl entry = new DartEntryImpl(); |
| 3102 Object value = entry.getValue(descriptor); |
| 3103 JUnitTestCase.assertNotSame(value, newValue); |
| 3104 entry.setValue(descriptor, newValue); |
| 3105 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(descriptor)); |
| 3106 JUnitTestCase.assertSame(newValue, entry.getValue(descriptor)); |
| 3107 } |
| 3108 |
| 3109 void _setValue3(DataDescriptor descriptor, Object newValue) { |
| 3110 Source source = new TestSource(); |
| 3111 DartEntryImpl entry = new DartEntryImpl(); |
| 3112 Object value = entry.getValueInLibrary(descriptor, source); |
| 3113 JUnitTestCase.assertNotSame(value, newValue); |
| 3114 entry.setValueInLibrary(descriptor, source, newValue); |
| 3115 JUnitTestCase.assertSame(CacheState.VALID, entry.getStateInLibrary(descripto
r, source)); |
| 3116 JUnitTestCase.assertSame(newValue, entry.getValueInLibrary(descriptor, sourc
e)); |
| 3117 } |
| 3118 |
| 3119 static dartSuite() { |
| 3120 _ut.group('DartEntryImplTest', () { |
| 3121 _ut.test('test_creation', () { |
| 3122 final __test = new DartEntryImplTest(); |
| 3123 runJUnitTest(__test, __test.test_creation); |
| 3124 }); |
| 3125 _ut.test('test_getAllErrors', () { |
| 3126 final __test = new DartEntryImplTest(); |
| 3127 runJUnitTest(__test, __test.test_getAllErrors); |
| 3128 }); |
| 3129 _ut.test('test_getResolvableCompilationUnit_none', () { |
| 3130 final __test = new DartEntryImplTest(); |
| 3131 runJUnitTest(__test, __test.test_getResolvableCompilationUnit_none); |
| 3132 }); |
| 3133 _ut.test('test_getResolvableCompilationUnit_parsed_accessed', () { |
| 3134 final __test = new DartEntryImplTest(); |
| 3135 runJUnitTest(__test, __test.test_getResolvableCompilationUnit_parsed_acc
essed); |
| 3136 }); |
| 3137 _ut.test('test_getResolvableCompilationUnit_parsed_notAccessed', () { |
| 3138 final __test = new DartEntryImplTest(); |
| 3139 runJUnitTest(__test, __test.test_getResolvableCompilationUnit_parsed_not
Accessed); |
| 3140 }); |
| 3141 _ut.test('test_getResolvableCompilationUnit_resolved', () { |
| 3142 final __test = new DartEntryImplTest(); |
| 3143 runJUnitTest(__test, __test.test_getResolvableCompilationUnit_resolved); |
| 3144 }); |
| 3145 _ut.test('test_getStateInLibrary_invalid_element', () { |
| 3146 final __test = new DartEntryImplTest(); |
| 3147 runJUnitTest(__test, __test.test_getStateInLibrary_invalid_element); |
| 3148 }); |
| 3149 _ut.test('test_getState_invalid_resolutionErrors', () { |
| 3150 final __test = new DartEntryImplTest(); |
| 3151 runJUnitTest(__test, __test.test_getState_invalid_resolutionErrors); |
| 3152 }); |
| 3153 _ut.test('test_getState_invalid_verificationErrors', () { |
| 3154 final __test = new DartEntryImplTest(); |
| 3155 runJUnitTest(__test, __test.test_getState_invalid_verificationErrors); |
| 3156 }); |
| 3157 _ut.test('test_getValueInLibrary_invalid_element', () { |
| 3158 final __test = new DartEntryImplTest(); |
| 3159 runJUnitTest(__test, __test.test_getValueInLibrary_invalid_element); |
| 3160 }); |
| 3161 _ut.test('test_getValueInLibrary_invalid_resolutionErrors_multiple', () { |
| 3162 final __test = new DartEntryImplTest(); |
| 3163 runJUnitTest(__test, __test.test_getValueInLibrary_invalid_resolutionErr
ors_multiple); |
| 3164 }); |
| 3165 _ut.test('test_getValue_containingLibraries', () { |
| 3166 final __test = new DartEntryImplTest(); |
| 3167 runJUnitTest(__test, __test.test_getValue_containingLibraries); |
| 3168 }); |
| 3169 _ut.test('test_getValue_invalid_resolutionErrors', () { |
| 3170 final __test = new DartEntryImplTest(); |
| 3171 runJUnitTest(__test, __test.test_getValue_invalid_resolutionErrors); |
| 3172 }); |
| 3173 _ut.test('test_getValue_invalid_verificationErrors', () { |
| 3174 final __test = new DartEntryImplTest(); |
| 3175 runJUnitTest(__test, __test.test_getValue_invalid_verificationErrors); |
| 3176 }); |
| 3177 _ut.test('test_getWritableCopy', () { |
| 3178 final __test = new DartEntryImplTest(); |
| 3179 runJUnitTest(__test, __test.test_getWritableCopy); |
| 3180 }); |
| 3181 _ut.test('test_hasInvalidData_false', () { |
| 3182 final __test = new DartEntryImplTest(); |
| 3183 runJUnitTest(__test, __test.test_hasInvalidData_false); |
| 3184 }); |
| 3185 _ut.test('test_hasInvalidData_true', () { |
| 3186 final __test = new DartEntryImplTest(); |
| 3187 runJUnitTest(__test, __test.test_hasInvalidData_true); |
| 3188 }); |
| 3189 _ut.test('test_invalidateAllInformation', () { |
| 3190 final __test = new DartEntryImplTest(); |
| 3191 runJUnitTest(__test, __test.test_invalidateAllInformation); |
| 3192 }); |
| 3193 _ut.test('test_invalidateAllResolutionInformation', () { |
| 3194 final __test = new DartEntryImplTest(); |
| 3195 runJUnitTest(__test, __test.test_invalidateAllResolutionInformation); |
| 3196 }); |
| 3197 _ut.test('test_invalidateAllResolutionInformation_includingUris', () { |
| 3198 final __test = new DartEntryImplTest(); |
| 3199 runJUnitTest(__test, __test.test_invalidateAllResolutionInformation_incl
udingUris); |
| 3200 }); |
| 3201 _ut.test('test_isClient', () { |
| 3202 final __test = new DartEntryImplTest(); |
| 3203 runJUnitTest(__test, __test.test_isClient); |
| 3204 }); |
| 3205 _ut.test('test_isLaunchable', () { |
| 3206 final __test = new DartEntryImplTest(); |
| 3207 runJUnitTest(__test, __test.test_isLaunchable); |
| 3208 }); |
| 3209 _ut.test('test_recordBuildElementErrorInLibrary', () { |
| 3210 final __test = new DartEntryImplTest(); |
| 3211 runJUnitTest(__test, __test.test_recordBuildElementErrorInLibrary); |
| 3212 }); |
| 3213 _ut.test('test_recordContentError', () { |
| 3214 final __test = new DartEntryImplTest(); |
| 3215 runJUnitTest(__test, __test.test_recordContentError); |
| 3216 }); |
| 3217 _ut.test('test_recordHintErrorInLibrary', () { |
| 3218 final __test = new DartEntryImplTest(); |
| 3219 runJUnitTest(__test, __test.test_recordHintErrorInLibrary); |
| 3220 }); |
| 3221 _ut.test('test_recordParseError', () { |
| 3222 final __test = new DartEntryImplTest(); |
| 3223 runJUnitTest(__test, __test.test_recordParseError); |
| 3224 }); |
| 3225 _ut.test('test_recordParseInProcess', () { |
| 3226 final __test = new DartEntryImplTest(); |
| 3227 runJUnitTest(__test, __test.test_recordParseInProcess); |
| 3228 }); |
| 3229 _ut.test('test_recordResolutionError', () { |
| 3230 final __test = new DartEntryImplTest(); |
| 3231 runJUnitTest(__test, __test.test_recordResolutionError); |
| 3232 }); |
| 3233 _ut.test('test_recordResolutionErrorInLibrary', () { |
| 3234 final __test = new DartEntryImplTest(); |
| 3235 runJUnitTest(__test, __test.test_recordResolutionErrorInLibrary); |
| 3236 }); |
| 3237 _ut.test('test_recordScanError', () { |
| 3238 final __test = new DartEntryImplTest(); |
| 3239 runJUnitTest(__test, __test.test_recordScanError); |
| 3240 }); |
| 3241 _ut.test('test_recordScanInProcess', () { |
| 3242 final __test = new DartEntryImplTest(); |
| 3243 runJUnitTest(__test, __test.test_recordScanInProcess); |
| 3244 }); |
| 3245 _ut.test('test_recordVerificationErrorInLibrary', () { |
| 3246 final __test = new DartEntryImplTest(); |
| 3247 runJUnitTest(__test, __test.test_recordVerificationErrorInLibrary); |
| 3248 }); |
| 3249 _ut.test('test_removeResolution_multiple_first', () { |
| 3250 final __test = new DartEntryImplTest(); |
| 3251 runJUnitTest(__test, __test.test_removeResolution_multiple_first); |
| 3252 }); |
| 3253 _ut.test('test_removeResolution_multiple_last', () { |
| 3254 final __test = new DartEntryImplTest(); |
| 3255 runJUnitTest(__test, __test.test_removeResolution_multiple_last); |
| 3256 }); |
| 3257 _ut.test('test_removeResolution_multiple_middle', () { |
| 3258 final __test = new DartEntryImplTest(); |
| 3259 runJUnitTest(__test, __test.test_removeResolution_multiple_middle); |
| 3260 }); |
| 3261 _ut.test('test_removeResolution_single', () { |
| 3262 final __test = new DartEntryImplTest(); |
| 3263 runJUnitTest(__test, __test.test_removeResolution_single); |
| 3264 }); |
| 3265 _ut.test('test_resolutionState', () { |
| 3266 final __test = new DartEntryImplTest(); |
| 3267 runJUnitTest(__test, __test.test_resolutionState); |
| 3268 }); |
| 3269 _ut.test('test_setState_element', () { |
| 3270 final __test = new DartEntryImplTest(); |
| 3271 runJUnitTest(__test, __test.test_setState_element); |
| 3272 }); |
| 3273 _ut.test('test_setState_exportedLibraries', () { |
| 3274 final __test = new DartEntryImplTest(); |
| 3275 runJUnitTest(__test, __test.test_setState_exportedLibraries); |
| 3276 }); |
| 3277 _ut.test('test_setState_hints', () { |
| 3278 final __test = new DartEntryImplTest(); |
| 3279 runJUnitTest(__test, __test.test_setState_hints); |
| 3280 }); |
| 3281 _ut.test('test_setState_importedLibraries', () { |
| 3282 final __test = new DartEntryImplTest(); |
| 3283 runJUnitTest(__test, __test.test_setState_importedLibraries); |
| 3284 }); |
| 3285 _ut.test('test_setState_includedParts', () { |
| 3286 final __test = new DartEntryImplTest(); |
| 3287 runJUnitTest(__test, __test.test_setState_includedParts); |
| 3288 }); |
| 3289 _ut.test('test_setState_invalid_element', () { |
| 3290 final __test = new DartEntryImplTest(); |
| 3291 runJUnitTest(__test, __test.test_setState_invalid_element); |
| 3292 }); |
| 3293 _ut.test('test_setState_invalid_resolutionErrors', () { |
| 3294 final __test = new DartEntryImplTest(); |
| 3295 runJUnitTest(__test, __test.test_setState_invalid_resolutionErrors); |
| 3296 }); |
| 3297 _ut.test('test_setState_invalid_validState', () { |
| 3298 final __test = new DartEntryImplTest(); |
| 3299 runJUnitTest(__test, __test.test_setState_invalid_validState); |
| 3300 }); |
| 3301 _ut.test('test_setState_invalid_verificationErrors', () { |
| 3302 final __test = new DartEntryImplTest(); |
| 3303 runJUnitTest(__test, __test.test_setState_invalid_verificationErrors); |
| 3304 }); |
| 3305 _ut.test('test_setState_isClient', () { |
| 3306 final __test = new DartEntryImplTest(); |
| 3307 runJUnitTest(__test, __test.test_setState_isClient); |
| 3308 }); |
| 3309 _ut.test('test_setState_isLaunchable', () { |
| 3310 final __test = new DartEntryImplTest(); |
| 3311 runJUnitTest(__test, __test.test_setState_isLaunchable); |
| 3312 }); |
| 3313 _ut.test('test_setState_lineInfo', () { |
| 3314 final __test = new DartEntryImplTest(); |
| 3315 runJUnitTest(__test, __test.test_setState_lineInfo); |
| 3316 }); |
| 3317 _ut.test('test_setState_parseErrors', () { |
| 3318 final __test = new DartEntryImplTest(); |
| 3319 runJUnitTest(__test, __test.test_setState_parseErrors); |
| 3320 }); |
| 3321 _ut.test('test_setState_parsedUnit', () { |
| 3322 final __test = new DartEntryImplTest(); |
| 3323 runJUnitTest(__test, __test.test_setState_parsedUnit); |
| 3324 }); |
| 3325 _ut.test('test_setState_publicNamespace', () { |
| 3326 final __test = new DartEntryImplTest(); |
| 3327 runJUnitTest(__test, __test.test_setState_publicNamespace); |
| 3328 }); |
| 3329 _ut.test('test_setState_resolutionErrors', () { |
| 3330 final __test = new DartEntryImplTest(); |
| 3331 runJUnitTest(__test, __test.test_setState_resolutionErrors); |
| 3332 }); |
| 3333 _ut.test('test_setState_resolvedUnit', () { |
| 3334 final __test = new DartEntryImplTest(); |
| 3335 runJUnitTest(__test, __test.test_setState_resolvedUnit); |
| 3336 }); |
| 3337 _ut.test('test_setState_scanErrors', () { |
| 3338 final __test = new DartEntryImplTest(); |
| 3339 runJUnitTest(__test, __test.test_setState_scanErrors); |
| 3340 }); |
| 3341 _ut.test('test_setState_sourceKind', () { |
| 3342 final __test = new DartEntryImplTest(); |
| 3343 runJUnitTest(__test, __test.test_setState_sourceKind); |
| 3344 }); |
| 3345 _ut.test('test_setState_tokenStream', () { |
| 3346 final __test = new DartEntryImplTest(); |
| 3347 runJUnitTest(__test, __test.test_setState_tokenStream); |
| 3348 }); |
| 3349 _ut.test('test_setState_verificationErrors', () { |
| 3350 final __test = new DartEntryImplTest(); |
| 3351 runJUnitTest(__test, __test.test_setState_verificationErrors); |
| 3352 }); |
| 3353 _ut.test('test_setValue_element', () { |
| 3354 final __test = new DartEntryImplTest(); |
| 3355 runJUnitTest(__test, __test.test_setValue_element); |
| 3356 }); |
| 3357 _ut.test('test_setValue_exportedLibraries', () { |
| 3358 final __test = new DartEntryImplTest(); |
| 3359 runJUnitTest(__test, __test.test_setValue_exportedLibraries); |
| 3360 }); |
| 3361 _ut.test('test_setValue_hints', () { |
| 3362 final __test = new DartEntryImplTest(); |
| 3363 runJUnitTest(__test, __test.test_setValue_hints); |
| 3364 }); |
| 3365 _ut.test('test_setValue_importedLibraries', () { |
| 3366 final __test = new DartEntryImplTest(); |
| 3367 runJUnitTest(__test, __test.test_setValue_importedLibraries); |
| 3368 }); |
| 3369 _ut.test('test_setValue_includedParts', () { |
| 3370 final __test = new DartEntryImplTest(); |
| 3371 runJUnitTest(__test, __test.test_setValue_includedParts); |
| 3372 }); |
| 3373 _ut.test('test_setValue_isClient', () { |
| 3374 final __test = new DartEntryImplTest(); |
| 3375 runJUnitTest(__test, __test.test_setValue_isClient); |
| 3376 }); |
| 3377 _ut.test('test_setValue_isLaunchable', () { |
| 3378 final __test = new DartEntryImplTest(); |
| 3379 runJUnitTest(__test, __test.test_setValue_isLaunchable); |
| 3380 }); |
| 3381 _ut.test('test_setValue_lineInfo', () { |
| 3382 final __test = new DartEntryImplTest(); |
| 3383 runJUnitTest(__test, __test.test_setValue_lineInfo); |
| 3384 }); |
| 3385 _ut.test('test_setValue_parseErrors', () { |
| 3386 final __test = new DartEntryImplTest(); |
| 3387 runJUnitTest(__test, __test.test_setValue_parseErrors); |
| 3388 }); |
| 3389 _ut.test('test_setValue_parsedUnit', () { |
| 3390 final __test = new DartEntryImplTest(); |
| 3391 runJUnitTest(__test, __test.test_setValue_parsedUnit); |
| 3392 }); |
| 3393 _ut.test('test_setValue_publicNamespace', () { |
| 3394 final __test = new DartEntryImplTest(); |
| 3395 runJUnitTest(__test, __test.test_setValue_publicNamespace); |
| 3396 }); |
| 3397 _ut.test('test_setValue_resolutionErrors', () { |
| 3398 final __test = new DartEntryImplTest(); |
| 3399 runJUnitTest(__test, __test.test_setValue_resolutionErrors); |
| 3400 }); |
| 3401 _ut.test('test_setValue_resolvedUnit', () { |
| 3402 final __test = new DartEntryImplTest(); |
| 3403 runJUnitTest(__test, __test.test_setValue_resolvedUnit); |
| 3404 }); |
| 3405 _ut.test('test_setValue_scanErrors', () { |
| 3406 final __test = new DartEntryImplTest(); |
| 3407 runJUnitTest(__test, __test.test_setValue_scanErrors); |
| 3408 }); |
| 3409 _ut.test('test_setValue_sourceKind', () { |
| 3410 final __test = new DartEntryImplTest(); |
| 3411 runJUnitTest(__test, __test.test_setValue_sourceKind); |
| 3412 }); |
| 3413 _ut.test('test_setValue_tokenStream', () { |
| 3414 final __test = new DartEntryImplTest(); |
| 3415 runJUnitTest(__test, __test.test_setValue_tokenStream); |
| 3416 }); |
| 3417 _ut.test('test_setValue_verificationErrors', () { |
| 3418 final __test = new DartEntryImplTest(); |
| 3419 runJUnitTest(__test, __test.test_setValue_verificationErrors); |
| 3420 }); |
| 3421 }); |
| 3422 } |
| 3423 } |
| 3424 |
| 3425 |
| 3426 class GenerateDartErrorsTaskTest extends EngineTestCase { |
| 3427 void test_accept() { |
| 3428 GenerateDartErrorsTask task = new GenerateDartErrorsTask(null, null, 0, null
, null); |
| 3429 JUnitTestCase.assertTrue(task.accept(new GenerateDartErrorsTaskTestTV_accept
())); |
| 3430 } |
| 3431 |
| 3432 void test_getException() { |
| 3433 GenerateDartErrorsTask task = new GenerateDartErrorsTask(null, null, 0, null
, null); |
| 3434 JUnitTestCase.assertNull(task.exception); |
| 3435 } |
| 3436 |
| 3437 void test_getLibraryElement() { |
| 3438 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 3439 LibraryElement element = ElementFactory.library(context, "lib"); |
| 3440 GenerateDartErrorsTask task = new GenerateDartErrorsTask(context, null, 0, n
ull, element); |
| 3441 JUnitTestCase.assertSame(element, task.libraryElement); |
| 3442 } |
| 3443 |
| 3444 void test_getSource() { |
| 3445 Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test.da
rt")); |
| 3446 GenerateDartErrorsTask task = new GenerateDartErrorsTask(null, source, 0, nu
ll, null); |
| 3447 JUnitTestCase.assertSame(source, task.source); |
| 3448 } |
| 3449 |
| 3450 void test_perform() { |
| 3451 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 3452 Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test.da
rt")); |
| 3453 ChangeSet changeSet = new ChangeSet(); |
| 3454 changeSet.addedSource(source); |
| 3455 context.applyChanges(changeSet); |
| 3456 context.setContents(source, EngineTestCase.createSource(["library lib;", "cl
ass A {", " int f = new A();", "}"])); |
| 3457 LibraryElement libraryElement = context.computeLibraryElement(source); |
| 3458 CompilationUnit unit = context.getResolvedCompilationUnit(source, libraryEle
ment); |
| 3459 GenerateDartErrorsTask task = new GenerateDartErrorsTask(context, source, co
ntext.getModificationStamp(source), unit, libraryElement); |
| 3460 task.perform(new GenerateDartErrorsTaskTestTV_perform(libraryElement, source
)); |
| 3461 } |
| 3462 |
| 3463 void test_perform_validateDirectives() { |
| 3464 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 3465 Source source = new FileBasedSource.con1(FileUtilities2.createFile("/test.da
rt")); |
| 3466 ChangeSet changeSet = new ChangeSet(); |
| 3467 changeSet.addedSource(source); |
| 3468 context.applyChanges(changeSet); |
| 3469 // TODO(scheglov) "import" causes second error reported |
| 3470 // context.setContents(source, EngineTestCase.createSource([ |
| 3471 // "library lib;", |
| 3472 // "import 'invaliduri^.dart';", |
| 3473 // "export '\${a}lib3.dart';", |
| 3474 // "part '/does/not/exist.dart';", |
| 3475 // "class A {}"])); |
| 3476 context.setContents(source, EngineTestCase.createSource([ |
| 3477 "library lib;", |
| 3478 "part '/does/not/exist.dart';", |
| 3479 "class A {}"])); |
| 3480 LibraryElement libraryElement = context.computeLibraryElement(source); |
| 3481 CompilationUnit unit = context.getResolvedCompilationUnit(source, libraryEle
ment); |
| 3482 GenerateDartErrorsTask task = new GenerateDartErrorsTask(context, source, co
ntext.getModificationStamp(source), unit, libraryElement); |
| 3483 task.perform(new GenerateDartErrorsTaskTestTV_perform_validateDirectives(lib
raryElement, source)); |
| 3484 } |
| 3485 |
| 3486 static dartSuite() { |
| 3487 _ut.group('GenerateDartErrorsTaskTest', () { |
| 3488 _ut.test('test_accept', () { |
| 3489 final __test = new GenerateDartErrorsTaskTest(); |
| 3490 runJUnitTest(__test, __test.test_accept); |
| 3491 }); |
| 3492 _ut.test('test_getException', () { |
| 3493 final __test = new GenerateDartErrorsTaskTest(); |
| 3494 runJUnitTest(__test, __test.test_getException); |
| 3495 }); |
| 3496 _ut.test('test_getLibraryElement', () { |
| 3497 final __test = new GenerateDartErrorsTaskTest(); |
| 3498 runJUnitTest(__test, __test.test_getLibraryElement); |
| 3499 }); |
| 3500 _ut.test('test_getSource', () { |
| 3501 final __test = new GenerateDartErrorsTaskTest(); |
| 3502 runJUnitTest(__test, __test.test_getSource); |
| 3503 }); |
| 3504 _ut.test('test_perform', () { |
| 3505 final __test = new GenerateDartErrorsTaskTest(); |
| 3506 runJUnitTest(__test, __test.test_perform); |
| 3507 }); |
| 3508 _ut.test('test_perform_validateDirectives', () { |
| 3509 final __test = new GenerateDartErrorsTaskTest(); |
| 3510 runJUnitTest(__test, __test.test_perform_validateDirectives); |
| 3511 }); |
| 3512 }); |
| 3513 } |
| 3514 } |
| 3515 |
| 3516 |
| 3517 class GenerateDartErrorsTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 3518 @override |
| 3519 bool visitGenerateDartErrorsTask(GenerateDartErrorsTask task) => true; |
| 3520 } |
| 3521 |
| 3522 |
| 3523 class GenerateDartErrorsTaskTestTV_perform extends TestTaskVisitor<bool> { |
| 3524 LibraryElement libraryElement; |
| 3525 Source source; |
| 3526 GenerateDartErrorsTaskTestTV_perform(this.libraryElement, this.source); |
| 3527 @override |
| 3528 bool visitGenerateDartErrorsTask(GenerateDartErrorsTask task) { |
| 3529 CaughtException exception = task.exception; |
| 3530 if (exception != null) { |
| 3531 throw exception; |
| 3532 } |
| 3533 JUnitTestCase.assertSame(libraryElement, task.libraryElement); |
| 3534 JUnitTestCase.assertSame(source, task.source); |
| 3535 List<AnalysisError> errors = task.errors; |
| 3536 EngineTestCase.assertLength(1, errors); |
| 3537 return true; |
| 3538 } |
| 3539 } |
| 3540 |
| 3541 |
| 3542 class GenerateDartErrorsTaskTestTV_perform_validateDirectives extends TestTaskVi
sitor<bool> { |
| 3543 LibraryElement libraryElement; |
| 3544 Source source; |
| 3545 GenerateDartErrorsTaskTestTV_perform_validateDirectives(this.libraryElement, t
his.source); |
| 3546 @override |
| 3547 bool visitGenerateDartErrorsTask(GenerateDartErrorsTask task) { |
| 3548 CaughtException exception = task.exception; |
| 3549 if (exception != null) { |
| 3550 throw exception; |
| 3551 } |
| 3552 JUnitTestCase.assertSame(libraryElement, task.libraryElement); |
| 3553 JUnitTestCase.assertSame(source, task.source); |
| 3554 List<AnalysisError> errors = task.errors; |
| 3555 EngineTestCase.assertLength(1, errors); |
| 3556 JUnitTestCase.assertSame(CompileTimeErrorCode.URI_DOES_NOT_EXIST, errors[0].
errorCode); |
| 3557 return true; |
| 3558 } |
| 3559 } |
| 3560 |
| 3561 class GenerateDartHintsTaskTest extends EngineTestCase { |
| 3562 void test_accept() { |
| 3563 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); |
| 3564 JUnitTestCase.assertTrue(task.accept(new GenerateDartHintsTaskTestTV_accept(
))); |
| 3565 } |
| 3566 void test_getException() { |
| 3567 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); |
| 3568 JUnitTestCase.assertNull(task.exception); |
| 3569 } |
| 3570 void test_getHintMap() { |
| 3571 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); |
| 3572 JUnitTestCase.assertNull(task.hintMap); |
| 3573 } |
| 3574 void test_getLibraryElement() { |
| 3575 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 3576 LibraryElement element = ElementFactory.library(context, "lib"); |
| 3577 GenerateDartHintsTask task = new GenerateDartHintsTask(context, null, elemen
t); |
| 3578 JUnitTestCase.assertSame(element, task.libraryElement); |
| 3579 } |
| 3580 void test_perform() { |
| 3581 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 3582 ChangeSet changeSet = new ChangeSet(); |
| 3583 Source librarySource = new FileBasedSource.con1(FileUtilities2.createFile("/
test.dart")); |
| 3584 changeSet.addedSource(librarySource); |
| 3585 Source unusedSource = new FileBasedSource.con1(FileUtilities2.createFile("/u
nused.dart")); |
| 3586 changeSet.addedSource(unusedSource); |
| 3587 Source partSource = new FileBasedSource.con1(FileUtilities2.createFile("/par
t.dart")); |
| 3588 changeSet.addedSource(partSource); |
| 3589 context.applyChanges(changeSet); |
| 3590 context.setContents(librarySource, EngineTestCase.createSource([ |
| 3591 "library lib;", |
| 3592 "import 'unused.dart';", |
| 3593 "part 'part.dart';"])); |
| 3594 context.setContents(unusedSource, EngineTestCase.createSource(["library unus
ed;"])); |
| 3595 context.setContents(partSource, EngineTestCase.createSource(["part of lib;"]
)); |
| 3596 List<TimestampedData<CompilationUnit>> units = new List<TimestampedData>(2); |
| 3597 units[0] = new TimestampedData<CompilationUnit>(context.getModificationStamp
(librarySource), context.resolveCompilationUnit2(librarySource, librarySource)); |
| 3598 units[1] = new TimestampedData<CompilationUnit>(context.getModificationStamp
(partSource), context.resolveCompilationUnit2(partSource, librarySource)); |
| 3599 GenerateDartHintsTask task = new GenerateDartHintsTask(context, units, conte
xt.computeLibraryElement(librarySource)); |
| 3600 task.perform(new GenerateDartHintsTaskTestTV_perform(librarySource, partSour
ce)); |
| 3601 } |
| 3602 static dartSuite() { |
| 3603 _ut.group('GenerateDartHintsTaskTest', () { |
| 3604 _ut.test('test_accept', () { |
| 3605 final __test = new GenerateDartHintsTaskTest(); |
| 3606 runJUnitTest(__test, __test.test_accept); |
| 3607 }); |
| 3608 _ut.test('test_getException', () { |
| 3609 final __test = new GenerateDartHintsTaskTest(); |
| 3610 runJUnitTest(__test, __test.test_getException); |
| 3611 }); |
| 3612 _ut.test('test_getHintMap', () { |
| 3613 final __test = new GenerateDartHintsTaskTest(); |
| 3614 runJUnitTest(__test, __test.test_getHintMap); |
| 3615 }); |
| 3616 _ut.test('test_getLibraryElement', () { |
| 3617 final __test = new GenerateDartHintsTaskTest(); |
| 3618 runJUnitTest(__test, __test.test_getLibraryElement); |
| 3619 }); |
| 3620 _ut.test('test_perform', () { |
| 3621 final __test = new GenerateDartHintsTaskTest(); |
| 3622 runJUnitTest(__test, __test.test_perform); |
| 3623 }); |
| 3624 }); |
| 3625 } |
| 3626 } |
| 3627 |
| 3628 |
| 3629 class GenerateDartHintsTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 3630 @override |
| 3631 bool visitGenerateDartHintsTask(GenerateDartHintsTask task) => true; |
| 3632 } |
| 3633 |
| 3634 |
| 3635 class GenerateDartHintsTaskTestTV_perform extends TestTaskVisitor<bool> { |
| 3636 Source librarySource; |
| 3637 Source partSource; |
| 3638 GenerateDartHintsTaskTestTV_perform(this.librarySource, this.partSource); |
| 3639 @override |
| 3640 bool visitGenerateDartHintsTask(GenerateDartHintsTask task) { |
| 3641 CaughtException exception = task.exception; |
| 3642 if (exception != null) { |
| 3643 throw exception; |
| 3644 } |
| 3645 JUnitTestCase.assertNotNull(task.libraryElement); |
| 3646 HashMap<Source, TimestampedData<List<AnalysisError>>> hintMap = task.hintMap
; |
| 3647 EngineTestCase.assertSizeOfMap(2, hintMap); |
| 3648 EngineTestCase.assertLength(1, hintMap[librarySource].data); |
| 3649 EngineTestCase.assertLength(0, hintMap[partSource].data); |
| 3650 return true; |
| 3651 } |
| 3652 } |
| 3653 |
| 3654 |
| 3655 class GetContentTaskTest extends EngineTestCase { |
| 3656 void test_accept() { |
| 3657 Source source = new TestSource('/test.dart', ''); |
| 3658 GetContentTask task = new GetContentTask(null, source); |
| 3659 JUnitTestCase.assertTrue(task.accept(new GetContentTaskTestTV_accept())); |
| 3660 } |
| 3661 |
| 3662 void test_getException() { |
| 3663 Source source = new TestSource('/test.dart', ''); |
| 3664 GetContentTask task = new GetContentTask(null, source); |
| 3665 JUnitTestCase.assertNull(task.exception); |
| 3666 } |
| 3667 |
| 3668 void test_getModificationTime() { |
| 3669 Source source = new TestSource('/test.dart', ''); |
| 3670 GetContentTask task = new GetContentTask(null, source); |
| 3671 JUnitTestCase.assertEquals(-1, task.modificationTime); |
| 3672 } |
| 3673 |
| 3674 void test_getSource() { |
| 3675 Source source = new TestSource('/test.dart', ''); |
| 3676 GetContentTask task = new GetContentTask(null, source); |
| 3677 JUnitTestCase.assertSame(source, task.source); |
| 3678 } |
| 3679 |
| 3680 void test_perform_exception() { |
| 3681 TestSource source = new TestSource(); |
| 3682 source.generateExceptionOnRead = true; |
| 3683 // final InternalAnalysisContext context = new AnalysisContextImpl(); |
| 3684 // context.setSourceFactory(new SourceFactory(new FileUriResolver())); |
| 3685 GetContentTask task = new GetContentTask(null, source); |
| 3686 task.perform(new GetContentTaskTestTV_perform_exception()); |
| 3687 } |
| 3688 |
| 3689 void test_perform_valid() { |
| 3690 Source source = new TestSource('/test.dart', 'class A {}'); |
| 3691 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 3692 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 3693 GetContentTask task = new GetContentTask(context, source); |
| 3694 task.perform(new GetContentTaskTestTV_perform_valid(context, source)); |
| 3695 } |
| 3696 |
| 3697 static dartSuite() { |
| 3698 _ut.group('GetContentTaskTest', () { |
| 3699 _ut.test('test_accept', () { |
| 3700 final __test = new GetContentTaskTest(); |
| 3701 runJUnitTest(__test, __test.test_accept); |
| 3702 }); |
| 3703 _ut.test('test_getException', () { |
| 3704 final __test = new GetContentTaskTest(); |
| 3705 runJUnitTest(__test, __test.test_getException); |
| 3706 }); |
| 3707 _ut.test('test_getModificationTime', () { |
| 3708 final __test = new GetContentTaskTest(); |
| 3709 runJUnitTest(__test, __test.test_getModificationTime); |
| 3710 }); |
| 3711 _ut.test('test_getSource', () { |
| 3712 final __test = new GetContentTaskTest(); |
| 3713 runJUnitTest(__test, __test.test_getSource); |
| 3714 }); |
| 3715 _ut.test('test_perform_exception', () { |
| 3716 final __test = new GetContentTaskTest(); |
| 3717 runJUnitTest(__test, __test.test_perform_exception); |
| 3718 }); |
| 3719 _ut.test('test_perform_valid', () { |
| 3720 final __test = new GetContentTaskTest(); |
| 3721 runJUnitTest(__test, __test.test_perform_valid); |
| 3722 }); |
| 3723 }); |
| 3724 } |
| 3725 } |
| 3726 |
| 3727 |
| 3728 class GetContentTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 3729 @override |
| 3730 bool visitGetContentTask(GetContentTask task) => true; |
| 3731 } |
| 3732 |
| 3733 |
| 3734 class GetContentTaskTestTV_perform_exception extends TestTaskVisitor<bool> { |
| 3735 @override |
| 3736 bool visitGetContentTask(GetContentTask task) { |
| 3737 JUnitTestCase.assertNotNull(task.exception); |
| 3738 return true; |
| 3739 } |
| 3740 } |
| 3741 |
| 3742 |
| 3743 class GetContentTaskTestTV_perform_valid extends TestTaskVisitor<bool> { |
| 3744 InternalAnalysisContext context; |
| 3745 Source source; |
| 3746 GetContentTaskTestTV_perform_valid(this.context, this.source); |
| 3747 @override |
| 3748 bool visitGetContentTask(GetContentTask task) { |
| 3749 CaughtException exception = task.exception; |
| 3750 if (exception != null) { |
| 3751 throw exception; |
| 3752 } |
| 3753 JUnitTestCase.assertEquals(context.getModificationStamp(source), task.modifi
cationTime); |
| 3754 JUnitTestCase.assertSame(source, task.source); |
| 3755 return true; |
| 3756 } |
| 3757 } |
| 3758 |
| 3759 |
| 3760 class HtmlEntryImplTest extends EngineTestCase { |
| 3761 void set state(DataDescriptor descriptor) { |
| 3762 HtmlEntryImpl entry = new HtmlEntryImpl(); |
| 3763 JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getState(descriptor)); |
| 3764 entry.setState(descriptor, CacheState.FLUSHED); |
| 3765 JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getState(descriptor)); |
| 3766 } |
| 3767 |
| 3768 void test_creation() { |
| 3769 HtmlEntryImpl entry = new HtmlEntryImpl(); |
| 3770 JUnitTestCase.assertNotNull(entry); |
| 3771 } |
| 3772 |
| 3773 void test_getAllErrors() { |
| 3774 Source source = new TestSource(); |
| 3775 HtmlEntryImpl entry = new HtmlEntryImpl(); |
| 3776 EngineTestCase.assertLength(0, entry.allErrors); |
| 3777 entry.setValue(HtmlEntry.PARSE_ERRORS, <AnalysisError> [new AnalysisError.co
n1(source, ParserErrorCode.EXPECTED_TOKEN, [";"])]); |
| 3778 entry.setValue(HtmlEntry.RESOLUTION_ERRORS, <AnalysisError> [new AnalysisErr
or.con1(source, HtmlWarningCode.INVALID_URI, ["-"])]); |
| 3779 entry.setValue(HtmlEntry.ANGULAR_ERRORS, <AnalysisError> [new AnalysisError.
con1(source, AngularCode.INVALID_REPEAT_SYNTAX, ["-"])]); |
| 3780 entry.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, <AnalysisError> [new Analysis
Error.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, ["-"])]); |
| 3781 entry.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, <AnalysisError> [new Ana
lysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, ["-"])]); |
| 3782 entry.setValue(HtmlEntry.HINTS, <AnalysisError> [new AnalysisError.con1(sour
ce, HintCode.DEAD_CODE, [])]); |
| 3783 EngineTestCase.assertLength(6, entry.allErrors); |
| 3784 } |
| 3785 void test_getWritableCopy() { |
| 3786 HtmlEntryImpl entry = new HtmlEntryImpl(); |
| 3787 HtmlEntryImpl copy = entry.writableCopy; |
| 3788 JUnitTestCase.assertNotNull(copy); |
| 3789 JUnitTestCase.assertNotSame(entry, copy); |
| 3790 } |
| 3791 |
| 3792 void test_invalidateAllResolutionInformation() { |
| 3793 HtmlEntryImpl entry = _entryWithValidState(); |
| 3794 entry.invalidateAllResolutionInformation(false); |
| 3795 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGULAR_
APPLICATION)); |
| 3796 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGULAR_
COMPONENT)); |
| 3797 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ANGULA
R_ENTRY)); |
| 3798 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ANGULA
R_ERRORS)); |
| 3799 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.POLYME
R_BUILD_ERRORS)); |
| 3800 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.POLYME
R_RESOLUTION_ERRORS)); |
| 3801 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ELEMEN
T)); |
| 3802 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.HINTS)
); |
| 3803 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LINE_I
NFO)); |
| 3804 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE_ER
RORS)); |
| 3805 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSED_U
NIT)); |
| 3806 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.REFERENC
ED_LIBRARIES)); |
| 3807 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.RESOLU
TION_ERRORS)); |
| 3808 } |
| 3809 |
| 3810 void test_invalidateAllResolutionInformation_includingUris() { |
| 3811 HtmlEntryImpl entry = _entryWithValidState(); |
| 3812 entry.invalidateAllResolutionInformation(true); |
| 3813 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGULAR_
APPLICATION)); |
| 3814 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGULAR_
COMPONENT)); |
| 3815 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ANGULA
R_ENTRY)); |
| 3816 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ANGULA
R_ERRORS)); |
| 3817 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.POLYME
R_BUILD_ERRORS)); |
| 3818 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.POLYME
R_RESOLUTION_ERRORS)); |
| 3819 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.ELEMEN
T)); |
| 3820 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.HINTS)
); |
| 3821 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LINE_I
NFO)); |
| 3822 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE_ER
RORS)); |
| 3823 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSED_U
NIT)); |
| 3824 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.REFERE
NCED_LIBRARIES)); |
| 3825 JUnitTestCase.assertSame(CacheState.INVALID, entry.getState(HtmlEntry.RESOLU
TION_ERRORS)); |
| 3826 } |
| 3827 |
| 3828 void test_setState_angularErrors() { |
| 3829 state = HtmlEntry.ANGULAR_ERRORS; |
| 3830 } |
| 3831 |
| 3832 void test_setState_element() { |
| 3833 state = HtmlEntry.ELEMENT; |
| 3834 } |
| 3835 |
| 3836 void test_setState_hints() { |
| 3837 state = HtmlEntry.HINTS; |
| 3838 } |
| 3839 |
| 3840 void test_setState_lineInfo() { |
| 3841 state = SourceEntry.LINE_INFO; |
| 3842 } |
| 3843 |
| 3844 void test_setState_parseErrors() { |
| 3845 state = HtmlEntry.PARSE_ERRORS; |
| 3846 } |
| 3847 |
| 3848 void test_setState_parsedUnit() { |
| 3849 state = HtmlEntry.PARSED_UNIT; |
| 3850 } |
| 3851 |
| 3852 void test_setState_polymerBuildErrors() { |
| 3853 state = HtmlEntry.POLYMER_BUILD_ERRORS; |
| 3854 } |
| 3855 |
| 3856 void test_setState_polymerResolutionErrors() { |
| 3857 state = HtmlEntry.POLYMER_RESOLUTION_ERRORS; |
| 3858 } |
| 3859 |
| 3860 void test_setState_referencedLibraries() { |
| 3861 state = HtmlEntry.REFERENCED_LIBRARIES; |
| 3862 } |
| 3863 |
| 3864 void test_setState_resolutionErrors() { |
| 3865 state = HtmlEntry.RESOLUTION_ERRORS; |
| 3866 } |
| 3867 |
| 3868 void test_setValue_angularErrors() { |
| 3869 _setValue(HtmlEntry.ANGULAR_ERRORS, <AnalysisError> [new AnalysisError.con1(
null, AngularCode.INVALID_REPEAT_SYNTAX, ["-"])]); |
| 3870 } |
| 3871 |
| 3872 void test_setValue_element() { |
| 3873 _setValue(HtmlEntry.ELEMENT, new HtmlElementImpl(null, "test.html")); |
| 3874 } |
| 3875 |
| 3876 void test_setValue_hints() { |
| 3877 _setValue(HtmlEntry.HINTS, <AnalysisError> [new AnalysisError.con1(null, Hin
tCode.DEAD_CODE, [])]); |
| 3878 } |
| 3879 |
| 3880 void test_setValue_illegal() { |
| 3881 HtmlEntryImpl entry = new HtmlEntryImpl(); |
| 3882 try { |
| 3883 entry.setValue(DartEntry.ELEMENT, null); |
| 3884 JUnitTestCase.fail("Expected IllegalArgumentException for DartEntry.ELEMEN
T"); |
| 3885 } on IllegalArgumentException catch (exception) { |
| 3886 } |
| 3887 } |
| 3888 |
| 3889 void test_setValue_lineInfo() { |
| 3890 _setValue(SourceEntry.LINE_INFO, new LineInfo(<int> [0])); |
| 3891 } |
| 3892 |
| 3893 void test_setValue_parseErrors() { |
| 3894 _setValue(HtmlEntry.PARSE_ERRORS, <AnalysisError> [new AnalysisError.con1(nu
ll, HtmlWarningCode.INVALID_URI, ["-"])]); |
| 3895 } |
| 3896 |
| 3897 void test_setValue_parsedUnit() { |
| 3898 _setValue(HtmlEntry.PARSED_UNIT, new ht.HtmlUnit(null, null, null)); |
| 3899 } |
| 3900 |
| 3901 void test_setValue_polymerBuildErrors() { |
| 3902 _setValue(HtmlEntry.POLYMER_BUILD_ERRORS, <AnalysisError> [new AnalysisError
.con1(null, PolymerCode.INVALID_ATTRIBUTE_NAME, ["-"])]); |
| 3903 } |
| 3904 |
| 3905 void test_setValue_polymerResolutionErrors() { |
| 3906 _setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, <AnalysisError> [new Analysis
Error.con1(null, PolymerCode.INVALID_ATTRIBUTE_NAME, ["-"])]); |
| 3907 } |
| 3908 |
| 3909 void test_setValue_referencedLibraries() { |
| 3910 _setValue(HtmlEntry.REFERENCED_LIBRARIES, <Source> [new TestSource()]); |
| 3911 } |
| 3912 |
| 3913 void test_setValue_resolutionErrors() { |
| 3914 _setValue(HtmlEntry.RESOLUTION_ERRORS, <AnalysisError> [new AnalysisError.co
n1(null, HtmlWarningCode.INVALID_URI, ["-"])]); |
| 3915 } |
| 3916 |
| 3917 HtmlEntryImpl _entryWithValidState() { |
| 3918 HtmlEntryImpl entry = new HtmlEntryImpl(); |
| 3919 entry.setValue(HtmlEntry.ANGULAR_ERRORS, null); |
| 3920 entry.setValue(HtmlEntry.ELEMENT, null); |
| 3921 entry.setValue(HtmlEntry.HINTS, null); |
| 3922 entry.setValue(SourceEntry.LINE_INFO, null); |
| 3923 entry.setValue(HtmlEntry.PARSE_ERRORS, null); |
| 3924 entry.setValue(HtmlEntry.PARSED_UNIT, null); |
| 3925 entry.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, null); |
| 3926 entry.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, null); |
| 3927 entry.setValue(HtmlEntry.REFERENCED_LIBRARIES, null); |
| 3928 entry.setValue(HtmlEntry.RESOLUTION_ERRORS, null); |
| 3929 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ANGULAR_
ERRORS)); |
| 3930 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.ELEMENT)
); |
| 3931 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.HINTS)); |
| 3932 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(SourceEntry.LINE_I
NFO)); |
| 3933 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSE_ER
RORS)); |
| 3934 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.PARSED_U
NIT)); |
| 3935 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.POLYMER_
BUILD_ERRORS)); |
| 3936 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.POLYMER_
RESOLUTION_ERRORS)); |
| 3937 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.REFERENC
ED_LIBRARIES)); |
| 3938 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(HtmlEntry.RESOLUTI
ON_ERRORS)); |
| 3939 return entry; |
| 3940 } |
| 3941 |
| 3942 void _setValue(DataDescriptor descriptor, Object newValue) { |
| 3943 HtmlEntryImpl entry = new HtmlEntryImpl(); |
| 3944 Object value = entry.getValue(descriptor); |
| 3945 JUnitTestCase.assertNotSame(value, newValue); |
| 3946 entry.setValue(descriptor, newValue); |
| 3947 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(descriptor)); |
| 3948 JUnitTestCase.assertSame(newValue, entry.getValue(descriptor)); |
| 3949 } |
| 3950 |
| 3951 static dartSuite() { |
| 3952 _ut.group('HtmlEntryImplTest', () { |
| 3953 _ut.test('test_creation', () { |
| 3954 final __test = new HtmlEntryImplTest(); |
| 3955 runJUnitTest(__test, __test.test_creation); |
| 3956 }); |
| 3957 _ut.test('test_getAllErrors', () { |
| 3958 final __test = new HtmlEntryImplTest(); |
| 3959 runJUnitTest(__test, __test.test_getAllErrors); |
| 3960 }); |
| 3961 _ut.test('test_getWritableCopy', () { |
| 3962 final __test = new HtmlEntryImplTest(); |
| 3963 runJUnitTest(__test, __test.test_getWritableCopy); |
| 3964 }); |
| 3965 _ut.test('test_invalidateAllResolutionInformation', () { |
| 3966 final __test = new HtmlEntryImplTest(); |
| 3967 runJUnitTest(__test, __test.test_invalidateAllResolutionInformation); |
| 3968 }); |
| 3969 _ut.test('test_invalidateAllResolutionInformation_includingUris', () { |
| 3970 final __test = new HtmlEntryImplTest(); |
| 3971 runJUnitTest(__test, __test.test_invalidateAllResolutionInformation_incl
udingUris); |
| 3972 }); |
| 3973 _ut.test('test_setState_angularErrors', () { |
| 3974 final __test = new HtmlEntryImplTest(); |
| 3975 runJUnitTest(__test, __test.test_setState_angularErrors); |
| 3976 }); |
| 3977 _ut.test('test_setState_element', () { |
| 3978 final __test = new HtmlEntryImplTest(); |
| 3979 runJUnitTest(__test, __test.test_setState_element); |
| 3980 }); |
| 3981 _ut.test('test_setState_hints', () { |
| 3982 final __test = new HtmlEntryImplTest(); |
| 3983 runJUnitTest(__test, __test.test_setState_hints); |
| 3984 }); |
| 3985 _ut.test('test_setState_lineInfo', () { |
| 3986 final __test = new HtmlEntryImplTest(); |
| 3987 runJUnitTest(__test, __test.test_setState_lineInfo); |
| 3988 }); |
| 3989 _ut.test('test_setState_parseErrors', () { |
| 3990 final __test = new HtmlEntryImplTest(); |
| 3991 runJUnitTest(__test, __test.test_setState_parseErrors); |
| 3992 }); |
| 3993 _ut.test('test_setState_parsedUnit', () { |
| 3994 final __test = new HtmlEntryImplTest(); |
| 3995 runJUnitTest(__test, __test.test_setState_parsedUnit); |
| 3996 }); |
| 3997 _ut.test('test_setState_polymerBuildErrors', () { |
| 3998 final __test = new HtmlEntryImplTest(); |
| 3999 runJUnitTest(__test, __test.test_setState_polymerBuildErrors); |
| 4000 }); |
| 4001 _ut.test('test_setState_polymerResolutionErrors', () { |
| 4002 final __test = new HtmlEntryImplTest(); |
| 4003 runJUnitTest(__test, __test.test_setState_polymerResolutionErrors); |
| 4004 }); |
| 4005 _ut.test('test_setState_referencedLibraries', () { |
| 4006 final __test = new HtmlEntryImplTest(); |
| 4007 runJUnitTest(__test, __test.test_setState_referencedLibraries); |
| 4008 }); |
| 4009 _ut.test('test_setState_resolutionErrors', () { |
| 4010 final __test = new HtmlEntryImplTest(); |
| 4011 runJUnitTest(__test, __test.test_setState_resolutionErrors); |
| 4012 }); |
| 4013 _ut.test('test_setValue_angularErrors', () { |
| 4014 final __test = new HtmlEntryImplTest(); |
| 4015 runJUnitTest(__test, __test.test_setValue_angularErrors); |
| 4016 }); |
| 4017 _ut.test('test_setValue_element', () { |
| 4018 final __test = new HtmlEntryImplTest(); |
| 4019 runJUnitTest(__test, __test.test_setValue_element); |
| 4020 }); |
| 4021 _ut.test('test_setValue_hints', () { |
| 4022 final __test = new HtmlEntryImplTest(); |
| 4023 runJUnitTest(__test, __test.test_setValue_hints); |
| 4024 }); |
| 4025 _ut.test('test_setValue_illegal', () { |
| 4026 final __test = new HtmlEntryImplTest(); |
| 4027 runJUnitTest(__test, __test.test_setValue_illegal); |
| 4028 }); |
| 4029 _ut.test('test_setValue_lineInfo', () { |
| 4030 final __test = new HtmlEntryImplTest(); |
| 4031 runJUnitTest(__test, __test.test_setValue_lineInfo); |
| 4032 }); |
| 4033 _ut.test('test_setValue_parseErrors', () { |
| 4034 final __test = new HtmlEntryImplTest(); |
| 4035 runJUnitTest(__test, __test.test_setValue_parseErrors); |
| 4036 }); |
| 4037 _ut.test('test_setValue_parsedUnit', () { |
| 4038 final __test = new HtmlEntryImplTest(); |
| 4039 runJUnitTest(__test, __test.test_setValue_parsedUnit); |
| 4040 }); |
| 4041 _ut.test('test_setValue_polymerBuildErrors', () { |
| 4042 final __test = new HtmlEntryImplTest(); |
| 4043 runJUnitTest(__test, __test.test_setValue_polymerBuildErrors); |
| 4044 }); |
| 4045 _ut.test('test_setValue_polymerResolutionErrors', () { |
| 4046 final __test = new HtmlEntryImplTest(); |
| 4047 runJUnitTest(__test, __test.test_setValue_polymerResolutionErrors); |
| 4048 }); |
| 4049 _ut.test('test_setValue_referencedLibraries', () { |
| 4050 final __test = new HtmlEntryImplTest(); |
| 4051 runJUnitTest(__test, __test.test_setValue_referencedLibraries); |
| 4052 }); |
| 4053 _ut.test('test_setValue_resolutionErrors', () { |
| 4054 final __test = new HtmlEntryImplTest(); |
| 4055 runJUnitTest(__test, __test.test_setValue_resolutionErrors); |
| 4056 }); |
| 4057 }); |
| 4058 } |
| 4059 } |
| 4060 |
| 4061 |
| 4062 class IncrementalAnalysisCacheTest extends JUnitTestCase { |
| 4063 Source _source = new TestSource(); |
| 4064 DartEntryImpl _entry = new DartEntryImpl(); |
| 4065 CompilationUnit _unit = new CompilationUnitMock(); |
| 4066 IncrementalAnalysisCache _result; |
| 4067 @override |
| 4068 void setUp() { |
| 4069 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, _unit); |
| 4070 } |
| 4071 void test_cacheResult() { |
| 4072 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4073 CompilationUnit newUnit = new CompilationUnitMock(); |
| 4074 _result = IncrementalAnalysisCache.cacheResult(cache, newUnit); |
| 4075 JUnitTestCase.assertNotNull(_result); |
| 4076 JUnitTestCase.assertSame(_source, _result.source); |
| 4077 JUnitTestCase.assertSame(newUnit, _result.resolvedUnit); |
| 4078 JUnitTestCase.assertEquals("hbazlo", _result.oldContents); |
| 4079 JUnitTestCase.assertEquals("hbazlo", _result.newContents); |
| 4080 JUnitTestCase.assertEquals(0, _result.offset); |
| 4081 JUnitTestCase.assertEquals(0, _result.oldLength); |
| 4082 JUnitTestCase.assertEquals(0, _result.newLength); |
| 4083 } |
| 4084 void test_cacheResult_noCache() { |
| 4085 IncrementalAnalysisCache cache = null; |
| 4086 CompilationUnit newUnit = new CompilationUnitMock(); |
| 4087 _result = IncrementalAnalysisCache.cacheResult(cache, newUnit); |
| 4088 JUnitTestCase.assertNull(_result); |
| 4089 } |
| 4090 void test_cacheResult_noCacheNoResult() { |
| 4091 IncrementalAnalysisCache cache = null; |
| 4092 CompilationUnit newUnit = null; |
| 4093 _result = IncrementalAnalysisCache.cacheResult(cache, newUnit); |
| 4094 JUnitTestCase.assertNull(_result); |
| 4095 } |
| 4096 void test_cacheResult_noResult() { |
| 4097 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4098 CompilationUnit newUnit = null; |
| 4099 _result = IncrementalAnalysisCache.cacheResult(cache, newUnit); |
| 4100 JUnitTestCase.assertNull(_result); |
| 4101 } |
| 4102 void test_clear_differentSource() { |
| 4103 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4104 Source otherSource = new TestSource("blat.dart", "blat"); |
| 4105 _result = IncrementalAnalysisCache.clear(cache, otherSource); |
| 4106 JUnitTestCase.assertSame(cache, _result); |
| 4107 } |
| 4108 void test_clear_nullCache() { |
| 4109 IncrementalAnalysisCache cache = null; |
| 4110 _result = IncrementalAnalysisCache.clear(cache, _source); |
| 4111 JUnitTestCase.assertNull(_result); |
| 4112 } |
| 4113 void test_clear_sameSource() { |
| 4114 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4115 _result = IncrementalAnalysisCache.clear(cache, _source); |
| 4116 JUnitTestCase.assertNull(_result); |
| 4117 } |
| 4118 void test_update_append() { |
| 4119 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4120 DartEntryImpl newEntry = new DartEntryImpl(); |
| 4121 _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbazxlo
", 4, 0, 1, newEntry); |
| 4122 JUnitTestCase.assertNotNull(_result); |
| 4123 JUnitTestCase.assertSame(_source, _result.source); |
| 4124 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4125 JUnitTestCase.assertEquals("hello", _result.oldContents); |
| 4126 JUnitTestCase.assertEquals("hbazxlo", _result.newContents); |
| 4127 JUnitTestCase.assertEquals(1, _result.offset); |
| 4128 JUnitTestCase.assertEquals(2, _result.oldLength); |
| 4129 JUnitTestCase.assertEquals(4, _result.newLength); |
| 4130 } |
| 4131 void test_update_appendToCachedResult() { |
| 4132 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4133 CompilationUnit newUnit = new CompilationUnitMock(); |
| 4134 cache = IncrementalAnalysisCache.cacheResult(cache, newUnit); |
| 4135 JUnitTestCase.assertNotNull(cache); |
| 4136 DartEntryImpl newEntry = new DartEntryImpl(); |
| 4137 _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbazxlo
", 4, 0, 1, newEntry); |
| 4138 JUnitTestCase.assertNotNull(_result); |
| 4139 JUnitTestCase.assertSame(_source, _result.source); |
| 4140 JUnitTestCase.assertSame(newUnit, _result.resolvedUnit); |
| 4141 JUnitTestCase.assertEquals("hbazlo", _result.oldContents); |
| 4142 JUnitTestCase.assertEquals("hbazxlo", _result.newContents); |
| 4143 JUnitTestCase.assertEquals(4, _result.offset); |
| 4144 JUnitTestCase.assertEquals(0, _result.oldLength); |
| 4145 JUnitTestCase.assertEquals(1, _result.newLength); |
| 4146 } |
| 4147 void test_update_appendWithNewResolvedUnit() { |
| 4148 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4149 DartEntryImpl newEntry = new DartEntryImpl(); |
| 4150 CompilationUnit newUnit = new CompilationUnitMock(); |
| 4151 newEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, newUnit); |
| 4152 _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbazxlo
", 4, 0, 1, newEntry); |
| 4153 JUnitTestCase.assertNotNull(_result); |
| 4154 JUnitTestCase.assertSame(_source, _result.source); |
| 4155 JUnitTestCase.assertSame(newUnit, _result.resolvedUnit); |
| 4156 JUnitTestCase.assertEquals("hbazlo", _result.oldContents); |
| 4157 JUnitTestCase.assertEquals("hbazxlo", _result.newContents); |
| 4158 JUnitTestCase.assertEquals(4, _result.offset); |
| 4159 JUnitTestCase.assertEquals(0, _result.oldLength); |
| 4160 JUnitTestCase.assertEquals(1, _result.newLength); |
| 4161 } |
| 4162 void test_update_appendWithNoNewResolvedUnit() { |
| 4163 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4164 DartEntryImpl newEntry = new DartEntryImpl(); |
| 4165 _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbazxlo
", 4, 0, 1, newEntry); |
| 4166 JUnitTestCase.assertNotNull(_result); |
| 4167 JUnitTestCase.assertSame(_source, _result.source); |
| 4168 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4169 JUnitTestCase.assertEquals("hello", _result.oldContents); |
| 4170 JUnitTestCase.assertEquals("hbazxlo", _result.newContents); |
| 4171 JUnitTestCase.assertEquals(1, _result.offset); |
| 4172 JUnitTestCase.assertEquals(2, _result.oldLength); |
| 4173 JUnitTestCase.assertEquals(4, _result.newLength); |
| 4174 } |
| 4175 void test_update_delete() { |
| 4176 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4177 DartEntryImpl newEntry = new DartEntryImpl(); |
| 4178 _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hzlo",
1, 2, 0, newEntry); |
| 4179 JUnitTestCase.assertNotNull(_result); |
| 4180 JUnitTestCase.assertSame(_source, _result.source); |
| 4181 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4182 JUnitTestCase.assertEquals("hello", _result.oldContents); |
| 4183 JUnitTestCase.assertEquals("hzlo", _result.newContents); |
| 4184 JUnitTestCase.assertEquals(1, _result.offset); |
| 4185 JUnitTestCase.assertEquals(2, _result.oldLength); |
| 4186 JUnitTestCase.assertEquals(1, _result.newLength); |
| 4187 } |
| 4188 void test_update_insert_nonContiguous_after() { |
| 4189 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4190 DartEntryImpl newEntry = new DartEntryImpl(); |
| 4191 _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbazlox
", 6, 0, 1, newEntry); |
| 4192 JUnitTestCase.assertNull(_result); |
| 4193 } |
| 4194 void test_update_insert_nonContiguous_before() { |
| 4195 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4196 DartEntryImpl newEntry = new DartEntryImpl(); |
| 4197 _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "xhbazlo
", 0, 0, 1, newEntry); |
| 4198 JUnitTestCase.assertNull(_result); |
| 4199 } |
| 4200 void test_update_newSource_entry() { |
| 4201 Source oldSource = new TestSource("blat.dart", "blat"); |
| 4202 DartEntryImpl oldEntry = new DartEntryImpl(); |
| 4203 CompilationUnit oldUnit = new CompilationUnitMock(); |
| 4204 oldEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, oldUnit); |
| 4205 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, oldSo
urce, "hello", "hbazlo", 1, 2, 3, oldEntry); |
| 4206 JUnitTestCase.assertSame(oldSource, cache.source); |
| 4207 JUnitTestCase.assertSame(oldUnit, cache.resolvedUnit); |
| 4208 _result = IncrementalAnalysisCache.update(cache, _source, "foo", "foobz", 3,
0, 2, _entry); |
| 4209 JUnitTestCase.assertNotNull(_result); |
| 4210 JUnitTestCase.assertSame(_source, _result.source); |
| 4211 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4212 JUnitTestCase.assertEquals("foo", _result.oldContents); |
| 4213 JUnitTestCase.assertEquals("foobz", _result.newContents); |
| 4214 JUnitTestCase.assertEquals(3, _result.offset); |
| 4215 JUnitTestCase.assertEquals(0, _result.oldLength); |
| 4216 JUnitTestCase.assertEquals(2, _result.newLength); |
| 4217 } |
| 4218 void test_update_newSource_noEntry() { |
| 4219 Source oldSource = new TestSource("blat.dart", "blat"); |
| 4220 DartEntryImpl oldEntry = new DartEntryImpl(); |
| 4221 CompilationUnit oldUnit = new CompilationUnitMock(); |
| 4222 oldEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, oldUnit); |
| 4223 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, oldSo
urce, "hello", "hbazlo", 1, 2, 3, oldEntry); |
| 4224 JUnitTestCase.assertSame(oldSource, cache.source); |
| 4225 JUnitTestCase.assertSame(oldUnit, cache.resolvedUnit); |
| 4226 _result = IncrementalAnalysisCache.update(cache, _source, "foo", "foobar", 3
, 0, 3, null); |
| 4227 JUnitTestCase.assertNull(_result); |
| 4228 } |
| 4229 void test_update_noCache_entry() { |
| 4230 _result = IncrementalAnalysisCache.update(null, _source, "hello", "hbazlo",
1, 2, 3, _entry); |
| 4231 JUnitTestCase.assertNotNull(_result); |
| 4232 JUnitTestCase.assertSame(_source, _result.source); |
| 4233 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4234 JUnitTestCase.assertEquals("hello", _result.oldContents); |
| 4235 JUnitTestCase.assertEquals("hbazlo", _result.newContents); |
| 4236 JUnitTestCase.assertEquals(1, _result.offset); |
| 4237 JUnitTestCase.assertEquals(2, _result.oldLength); |
| 4238 JUnitTestCase.assertEquals(3, _result.newLength); |
| 4239 JUnitTestCase.assertTrue(_result.hasWork); |
| 4240 } |
| 4241 void test_update_noCache_entry_noOldSource_append() { |
| 4242 _result = IncrementalAnalysisCache.update(null, _source, null, "hellxo", 4,
0, 1, _entry); |
| 4243 JUnitTestCase.assertNotNull(_result); |
| 4244 JUnitTestCase.assertSame(_source, _result.source); |
| 4245 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4246 JUnitTestCase.assertEquals("hello", _result.oldContents); |
| 4247 JUnitTestCase.assertEquals("hellxo", _result.newContents); |
| 4248 JUnitTestCase.assertEquals(4, _result.offset); |
| 4249 JUnitTestCase.assertEquals(0, _result.oldLength); |
| 4250 JUnitTestCase.assertEquals(1, _result.newLength); |
| 4251 JUnitTestCase.assertTrue(_result.hasWork); |
| 4252 } |
| 4253 void test_update_noCache_entry_noOldSource_delete() { |
| 4254 _result = IncrementalAnalysisCache.update(null, _source, null, "helo", 4, 1,
0, _entry); |
| 4255 JUnitTestCase.assertNull(_result); |
| 4256 } |
| 4257 void test_update_noCache_entry_noOldSource_replace() { |
| 4258 _result = IncrementalAnalysisCache.update(null, _source, null, "helxo", 4, 1
, 1, _entry); |
| 4259 JUnitTestCase.assertNull(_result); |
| 4260 } |
| 4261 void test_update_noCache_noEntry() { |
| 4262 _result = IncrementalAnalysisCache.update(null, _source, "hello", "hbazlo",
1, 2, 3, null); |
| 4263 JUnitTestCase.assertNull(_result); |
| 4264 } |
| 4265 void test_update_replace() { |
| 4266 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4267 _result = IncrementalAnalysisCache.update(cache, _source, "hbazlo", "hbarrlo
", 3, 1, 2, null); |
| 4268 JUnitTestCase.assertNotNull(_result); |
| 4269 JUnitTestCase.assertSame(_source, _result.source); |
| 4270 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4271 JUnitTestCase.assertEquals("hello", _result.oldContents); |
| 4272 JUnitTestCase.assertEquals("hbarrlo", _result.newContents); |
| 4273 JUnitTestCase.assertEquals(1, _result.offset); |
| 4274 JUnitTestCase.assertEquals(2, _result.oldLength); |
| 4275 JUnitTestCase.assertEquals(4, _result.newLength); |
| 4276 } |
| 4277 void test_verifyStructure_invalidUnit() { |
| 4278 String oldCode = "main() {foo;}"; |
| 4279 String newCode = "main() {boo;}"; |
| 4280 CompilationUnit badUnit = _parse("main() {bad;}"); |
| 4281 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, badUnit); |
| 4282 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, oldCode, newCode, 8, 1, 1, _entry); |
| 4283 CompilationUnit newUnit = _parse(newCode); |
| 4284 _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUnit); |
| 4285 JUnitTestCase.assertNull(_result); |
| 4286 } |
| 4287 void test_verifyStructure_noCache() { |
| 4288 IncrementalAnalysisCache cache = null; |
| 4289 CompilationUnit newUnit = new CompilationUnitMock(); |
| 4290 _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUnit); |
| 4291 JUnitTestCase.assertNull(_result); |
| 4292 } |
| 4293 void test_verifyStructure_noCacheNoUnit() { |
| 4294 IncrementalAnalysisCache cache = null; |
| 4295 CompilationUnit newUnit = null; |
| 4296 _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUnit); |
| 4297 JUnitTestCase.assertNull(_result); |
| 4298 } |
| 4299 void test_verifyStructure_noUnit() { |
| 4300 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4301 CompilationUnit newUnit = null; |
| 4302 _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUnit); |
| 4303 JUnitTestCase.assertSame(cache, _result); |
| 4304 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4305 } |
| 4306 void test_verifyStructure_otherSource() { |
| 4307 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, "hello", "hbazlo", 1, 2, 3, _entry); |
| 4308 CompilationUnit newUnit = new CompilationUnitMock(); |
| 4309 Source otherSource = new TestSource("blat.dart", "blat"); |
| 4310 _result = IncrementalAnalysisCache.verifyStructure(cache, otherSource, newUn
it); |
| 4311 JUnitTestCase.assertSame(cache, _result); |
| 4312 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 4313 } |
| 4314 void test_verifyStructure_validUnit() { |
| 4315 String oldCode = "main() {foo;}"; |
| 4316 String newCode = "main() {boo;}"; |
| 4317 CompilationUnit goodUnit = _parse(newCode); |
| 4318 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, goodUnit); |
| 4319 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, _sour
ce, oldCode, newCode, 1, 2, 3, _entry); |
| 4320 CompilationUnit newUnit = _parse(newCode); |
| 4321 _result = IncrementalAnalysisCache.verifyStructure(cache, _source, newUnit); |
| 4322 JUnitTestCase.assertSame(cache, _result); |
| 4323 JUnitTestCase.assertSame(goodUnit, _result.resolvedUnit); |
| 4324 } |
| 4325 CompilationUnit _parse(String code) { |
| 4326 Scanner scanner = new Scanner(_source, new CharSequenceReader(code), Analysi
sErrorListener.NULL_LISTENER); |
| 4327 Parser parser = new Parser(_source, AnalysisErrorListener.NULL_LISTENER); |
| 4328 return parser.parseCompilationUnit(scanner.tokenize()); |
| 4329 } |
| 4330 static dartSuite() { |
| 4331 _ut.group('IncrementalAnalysisCacheTest', () { |
| 4332 _ut.test('test_cacheResult', () { |
| 4333 final __test = new IncrementalAnalysisCacheTest(); |
| 4334 runJUnitTest(__test, __test.test_cacheResult); |
| 4335 }); |
| 4336 _ut.test('test_cacheResult_noCache', () { |
| 4337 final __test = new IncrementalAnalysisCacheTest(); |
| 4338 runJUnitTest(__test, __test.test_cacheResult_noCache); |
| 4339 }); |
| 4340 _ut.test('test_cacheResult_noCacheNoResult', () { |
| 4341 final __test = new IncrementalAnalysisCacheTest(); |
| 4342 runJUnitTest(__test, __test.test_cacheResult_noCacheNoResult); |
| 4343 }); |
| 4344 _ut.test('test_cacheResult_noResult', () { |
| 4345 final __test = new IncrementalAnalysisCacheTest(); |
| 4346 runJUnitTest(__test, __test.test_cacheResult_noResult); |
| 4347 }); |
| 4348 _ut.test('test_clear_differentSource', () { |
| 4349 final __test = new IncrementalAnalysisCacheTest(); |
| 4350 runJUnitTest(__test, __test.test_clear_differentSource); |
| 4351 }); |
| 4352 _ut.test('test_clear_nullCache', () { |
| 4353 final __test = new IncrementalAnalysisCacheTest(); |
| 4354 runJUnitTest(__test, __test.test_clear_nullCache); |
| 4355 }); |
| 4356 _ut.test('test_clear_sameSource', () { |
| 4357 final __test = new IncrementalAnalysisCacheTest(); |
| 4358 runJUnitTest(__test, __test.test_clear_sameSource); |
| 4359 }); |
| 4360 _ut.test('test_update_append', () { |
| 4361 final __test = new IncrementalAnalysisCacheTest(); |
| 4362 runJUnitTest(__test, __test.test_update_append); |
| 4363 }); |
| 4364 _ut.test('test_update_appendToCachedResult', () { |
| 4365 final __test = new IncrementalAnalysisCacheTest(); |
| 4366 runJUnitTest(__test, __test.test_update_appendToCachedResult); |
| 4367 }); |
| 4368 _ut.test('test_update_appendWithNewResolvedUnit', () { |
| 4369 final __test = new IncrementalAnalysisCacheTest(); |
| 4370 runJUnitTest(__test, __test.test_update_appendWithNewResolvedUnit); |
| 4371 }); |
| 4372 _ut.test('test_update_appendWithNoNewResolvedUnit', () { |
| 4373 final __test = new IncrementalAnalysisCacheTest(); |
| 4374 runJUnitTest(__test, __test.test_update_appendWithNoNewResolvedUnit); |
| 4375 }); |
| 4376 _ut.test('test_update_delete', () { |
| 4377 final __test = new IncrementalAnalysisCacheTest(); |
| 4378 runJUnitTest(__test, __test.test_update_delete); |
| 4379 }); |
| 4380 _ut.test('test_update_insert_nonContiguous_after', () { |
| 4381 final __test = new IncrementalAnalysisCacheTest(); |
| 4382 runJUnitTest(__test, __test.test_update_insert_nonContiguous_after); |
| 4383 }); |
| 4384 _ut.test('test_update_insert_nonContiguous_before', () { |
| 4385 final __test = new IncrementalAnalysisCacheTest(); |
| 4386 runJUnitTest(__test, __test.test_update_insert_nonContiguous_before); |
| 4387 }); |
| 4388 _ut.test('test_update_newSource_entry', () { |
| 4389 final __test = new IncrementalAnalysisCacheTest(); |
| 4390 runJUnitTest(__test, __test.test_update_newSource_entry); |
| 4391 }); |
| 4392 _ut.test('test_update_newSource_noEntry', () { |
| 4393 final __test = new IncrementalAnalysisCacheTest(); |
| 4394 runJUnitTest(__test, __test.test_update_newSource_noEntry); |
| 4395 }); |
| 4396 _ut.test('test_update_noCache_entry', () { |
| 4397 final __test = new IncrementalAnalysisCacheTest(); |
| 4398 runJUnitTest(__test, __test.test_update_noCache_entry); |
| 4399 }); |
| 4400 _ut.test('test_update_noCache_entry_noOldSource_append', () { |
| 4401 final __test = new IncrementalAnalysisCacheTest(); |
| 4402 runJUnitTest(__test, __test.test_update_noCache_entry_noOldSource_append
); |
| 4403 }); |
| 4404 _ut.test('test_update_noCache_entry_noOldSource_delete', () { |
| 4405 final __test = new IncrementalAnalysisCacheTest(); |
| 4406 runJUnitTest(__test, __test.test_update_noCache_entry_noOldSource_delete
); |
| 4407 }); |
| 4408 _ut.test('test_update_noCache_entry_noOldSource_replace', () { |
| 4409 final __test = new IncrementalAnalysisCacheTest(); |
| 4410 runJUnitTest(__test, __test.test_update_noCache_entry_noOldSource_replac
e); |
| 4411 }); |
| 4412 _ut.test('test_update_noCache_noEntry', () { |
| 4413 final __test = new IncrementalAnalysisCacheTest(); |
| 4414 runJUnitTest(__test, __test.test_update_noCache_noEntry); |
| 4415 }); |
| 4416 _ut.test('test_update_replace', () { |
| 4417 final __test = new IncrementalAnalysisCacheTest(); |
| 4418 runJUnitTest(__test, __test.test_update_replace); |
| 4419 }); |
| 4420 _ut.test('test_verifyStructure_invalidUnit', () { |
| 4421 final __test = new IncrementalAnalysisCacheTest(); |
| 4422 runJUnitTest(__test, __test.test_verifyStructure_invalidUnit); |
| 4423 }); |
| 4424 _ut.test('test_verifyStructure_noCache', () { |
| 4425 final __test = new IncrementalAnalysisCacheTest(); |
| 4426 runJUnitTest(__test, __test.test_verifyStructure_noCache); |
| 4427 }); |
| 4428 _ut.test('test_verifyStructure_noCacheNoUnit', () { |
| 4429 final __test = new IncrementalAnalysisCacheTest(); |
| 4430 runJUnitTest(__test, __test.test_verifyStructure_noCacheNoUnit); |
| 4431 }); |
| 4432 _ut.test('test_verifyStructure_noUnit', () { |
| 4433 final __test = new IncrementalAnalysisCacheTest(); |
| 4434 runJUnitTest(__test, __test.test_verifyStructure_noUnit); |
| 4435 }); |
| 4436 _ut.test('test_verifyStructure_otherSource', () { |
| 4437 final __test = new IncrementalAnalysisCacheTest(); |
| 4438 runJUnitTest(__test, __test.test_verifyStructure_otherSource); |
| 4439 }); |
| 4440 _ut.test('test_verifyStructure_validUnit', () { |
| 4441 final __test = new IncrementalAnalysisCacheTest(); |
| 4442 runJUnitTest(__test, __test.test_verifyStructure_validUnit); |
| 4443 }); |
| 4444 }); |
| 4445 } |
| 4446 } |
| 4447 |
| 4448 |
| 4449 |
| 4450 class IncrementalAnalysisTaskTest extends EngineTestCase { |
| 4451 void test_accept() { |
| 4452 IncrementalAnalysisTask task = new IncrementalAnalysisTask(null, null); |
| 4453 JUnitTestCase.assertTrue(task.accept(new IncrementalAnalysisTaskTestTV_accep
t())); |
| 4454 } |
| 4455 void test_perform() { |
| 4456 // main() {} String foo; |
| 4457 // main() {String} String foo; |
| 4458 CompilationUnit newUnit = _assertTask("main() {", "", "String", "} String fo
o;"); |
| 4459 NodeList<CompilationUnitMember> declarations = newUnit.declarations; |
| 4460 FunctionDeclaration main = declarations[0] as FunctionDeclaration; |
| 4461 JUnitTestCase.assertEquals("main", main.name.name); |
| 4462 BlockFunctionBody body = main.functionExpression.body as BlockFunctionBody; |
| 4463 ExpressionStatement statement = body.block.statements[0] as ExpressionStatem
ent; |
| 4464 JUnitTestCase.assertEquals("String;", statement.toSource()); |
| 4465 SimpleIdentifier identifier = statement.expression as SimpleIdentifier; |
| 4466 JUnitTestCase.assertEquals("String", identifier.name); |
| 4467 JUnitTestCase.assertNotNull(identifier.staticElement); |
| 4468 TopLevelVariableDeclaration fooDecl = declarations[1] as TopLevelVariableDec
laration; |
| 4469 SimpleIdentifier fooName = fooDecl.variables.variables[0].name; |
| 4470 JUnitTestCase.assertEquals("foo", fooName.name); |
| 4471 JUnitTestCase.assertNotNull(fooName.staticElement); |
| 4472 } |
| 4473 CompilationUnit _assertTask(String prefix, String removed, String added, Strin
g suffix) { |
| 4474 String oldCode = EngineTestCase.createSource(["${prefix}${removed}${suffix}"
]); |
| 4475 String newCode = EngineTestCase.createSource(["${prefix}${added}${suffix}"])
; |
| 4476 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 4477 Source source = new TestSource("/test.dart", oldCode); |
| 4478 DartEntryImpl entry = new DartEntryImpl(); |
| 4479 CompilationUnit oldUnit = context.resolveCompilationUnit2(source, source); |
| 4480 JUnitTestCase.assertNotNull(oldUnit); |
| 4481 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source, oldUnit); |
| 4482 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update(null, sourc
e, oldCode, newCode, prefix.length, removed.length, added.length, entry); |
| 4483 JUnitTestCase.assertNotNull(cache); |
| 4484 IncrementalAnalysisTask task = new IncrementalAnalysisTask(context, cache); |
| 4485 CompilationUnit newUnit = task.perform(new IncrementalAnalysisTaskTestTV_ass
ertTask(task)); |
| 4486 JUnitTestCase.assertNotNull(newUnit); |
| 4487 return newUnit; |
| 4488 } |
| 4489 static dartSuite() { |
| 4490 _ut.group('IncrementalAnalysisTaskTest', () { |
| 4491 _ut.test('test_accept', () { |
| 4492 final __test = new IncrementalAnalysisTaskTest(); |
| 4493 runJUnitTest(__test, __test.test_accept); |
| 4494 }); |
| 4495 _ut.test('test_perform', () { |
| 4496 final __test = new IncrementalAnalysisTaskTest(); |
| 4497 runJUnitTest(__test, __test.test_perform); |
| 4498 }); |
| 4499 }); |
| 4500 } |
| 4501 } |
| 4502 |
| 4503 |
| 4504 class IncrementalAnalysisTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 4505 @override |
| 4506 bool visitIncrementalAnalysisTask(IncrementalAnalysisTask task) => true; |
| 4507 } |
| 4508 |
| 4509 |
| 4510 class IncrementalAnalysisTaskTestTV_assertTask extends TestTaskVisitor<Compilati
onUnit> { |
| 4511 IncrementalAnalysisTask task; |
| 4512 IncrementalAnalysisTaskTestTV_assertTask(this.task); |
| 4513 @override |
| 4514 CompilationUnit visitIncrementalAnalysisTask(IncrementalAnalysisTask increment
alAnalysisTask) => task.compilationUnit; |
| 4515 } |
| 4516 |
| 4517 |
| 4518 class InstrumentedAnalysisContextImplTest extends EngineTestCase { |
| 4519 void test_addSourceInfo() { |
| 4520 List<bool> invoked = [false]; |
| 4521 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_addSourceInfo(invoked)); |
| 4522 context.addSourceInfo(null, null); |
| 4523 JUnitTestCase.assertTrue(invoked[0]); |
| 4524 } |
| 4525 void test_applyChanges() { |
| 4526 List<bool> invoked = [false]; |
| 4527 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_applyChanges(invoked)); |
| 4528 context.applyChanges(null); |
| 4529 JUnitTestCase.assertTrue(invoked[0]); |
| 4530 } |
| 4531 void test_computeDocumentationComment() { |
| 4532 List<bool> invoked = [false]; |
| 4533 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeDocumentationComment(invoked)); |
| 4534 context.computeDocumentationComment(null); |
| 4535 JUnitTestCase.assertTrue(invoked[0]); |
| 4536 } |
| 4537 void test_computeErrors() { |
| 4538 List<bool> invoked = [false]; |
| 4539 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeErrors(invoked)); |
| 4540 context.computeErrors(null); |
| 4541 JUnitTestCase.assertTrue(invoked[0]); |
| 4542 } |
| 4543 void test_computeExportedLibraries() { |
| 4544 List<bool> invoked = [false]; |
| 4545 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeExportedLibraries(invoked)); |
| 4546 context.computeExportedLibraries(null); |
| 4547 JUnitTestCase.assertTrue(invoked[0]); |
| 4548 } |
| 4549 void test_computeHtmlElement() { |
| 4550 List<bool> invoked = [false]; |
| 4551 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeHtmlElement(invoked)); |
| 4552 context.computeHtmlElement(null); |
| 4553 JUnitTestCase.assertTrue(invoked[0]); |
| 4554 } |
| 4555 void test_computeImportedLibraries() { |
| 4556 List<bool> invoked = [false]; |
| 4557 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeImportedLibraries(invoked)); |
| 4558 context.computeImportedLibraries(null); |
| 4559 JUnitTestCase.assertTrue(invoked[0]); |
| 4560 } |
| 4561 void test_computeKindOf() { |
| 4562 List<bool> invoked = [false]; |
| 4563 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeKindOf(invoked)); |
| 4564 context.computeKindOf(null); |
| 4565 JUnitTestCase.assertTrue(invoked[0]); |
| 4566 } |
| 4567 void test_computeLibraryElement() { |
| 4568 List<bool> invoked = [false]; |
| 4569 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeLibraryElement(invoked)); |
| 4570 context.computeLibraryElement(null); |
| 4571 JUnitTestCase.assertTrue(invoked[0]); |
| 4572 } |
| 4573 void test_computeLineInfo() { |
| 4574 List<bool> invoked = [false]; |
| 4575 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeLineInfo(invoked)); |
| 4576 context.computeLineInfo(null); |
| 4577 JUnitTestCase.assertTrue(invoked[0]); |
| 4578 } |
| 4579 void test_computeResolvableCompilationUnit() { |
| 4580 List<bool> invoked = [false]; |
| 4581 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_computeResolvableCompilationUnit(invoked)); |
| 4582 context.computeResolvableCompilationUnit(null); |
| 4583 JUnitTestCase.assertTrue(invoked[0]); |
| 4584 } |
| 4585 void test_creation() { |
| 4586 JUnitTestCase.assertNotNull(new InstrumentedAnalysisContextImpl()); |
| 4587 } |
| 4588 void test_dispose() { |
| 4589 List<bool> invoked = [false]; |
| 4590 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_dispose(invoked)); |
| 4591 context.dispose(); |
| 4592 JUnitTestCase.assertTrue(invoked[0]); |
| 4593 } |
| 4594 void test_exists() { |
| 4595 List<bool> invoked = [false]; |
| 4596 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_exists(invoked)); |
| 4597 context.exists(null); |
| 4598 JUnitTestCase.assertTrue(invoked[0]); |
| 4599 } |
| 4600 void test_extractContext() { |
| 4601 List<bool> invoked = [false]; |
| 4602 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_extractContext(invoked)); |
| 4603 context.extractContext(null); |
| 4604 JUnitTestCase.assertTrue(invoked[0]); |
| 4605 } |
| 4606 void test_extractContextInto() { |
| 4607 List<bool> invoked = [false]; |
| 4608 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_extractContextInto(invoked)); |
| 4609 context.extractContextInto(null, null); |
| 4610 JUnitTestCase.assertTrue(invoked[0]); |
| 4611 } |
| 4612 void test_getAnalysisOptions() { |
| 4613 List<bool> invoked = [false]; |
| 4614 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getAnalysisOptions(invoked)); |
| 4615 context.analysisOptions; |
| 4616 JUnitTestCase.assertTrue(invoked[0]); |
| 4617 } |
| 4618 void test_getAngularApplicationWithHtml() { |
| 4619 List<bool> invoked = [false]; |
| 4620 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getAngularApplicationWithHtml(invoked)); |
| 4621 context.getAngularApplicationWithHtml(null); |
| 4622 JUnitTestCase.assertTrue(invoked[0]); |
| 4623 } |
| 4624 void test_getCompilationUnitElement() { |
| 4625 List<bool> invoked = [false]; |
| 4626 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getCompilationUnitElement(invoked)); |
| 4627 context.getCompilationUnitElement(null, null); |
| 4628 JUnitTestCase.assertTrue(invoked[0]); |
| 4629 } |
| 4630 void test_getContents() { |
| 4631 List<bool> invoked = [false]; |
| 4632 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getContents(invoked)); |
| 4633 context.getContents(null); |
| 4634 JUnitTestCase.assertTrue(invoked[0]); |
| 4635 } |
| 4636 // void test_getContentsToReceiver() { |
| 4637 // List<bool> invoked = [false]; |
| 4638 // InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextI
mpl.con1(new TestAnalysisContext_test_getContentsToReceiver(invoked)); |
| 4639 // context.getContentsToReceiver(null, null); |
| 4640 // JUnitTestCase.assertTrue(invoked[0]); |
| 4641 // } |
| 4642 void test_getElement() { |
| 4643 List<bool> invoked = [false]; |
| 4644 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getElement(invoked)); |
| 4645 context.getElement(null); |
| 4646 JUnitTestCase.assertTrue(invoked[0]); |
| 4647 } |
| 4648 void test_getErrors() { |
| 4649 List<bool> invoked = [false]; |
| 4650 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getErrors(invoked)); |
| 4651 context.getErrors(null); |
| 4652 JUnitTestCase.assertTrue(invoked[0]); |
| 4653 } |
| 4654 void test_getHtmlElement() { |
| 4655 List<bool> invoked = [false]; |
| 4656 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getHtmlElement(invoked)); |
| 4657 context.getHtmlElement(null); |
| 4658 JUnitTestCase.assertTrue(invoked[0]); |
| 4659 } |
| 4660 void test_getHtmlFilesReferencing() { |
| 4661 List<bool> invoked = [false]; |
| 4662 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getHtmlFilesReferencing(invoked)); |
| 4663 context.getHtmlFilesReferencing(null); |
| 4664 JUnitTestCase.assertTrue(invoked[0]); |
| 4665 } |
| 4666 void test_getHtmlSources() { |
| 4667 List<bool> invoked = [false]; |
| 4668 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getHtmlSources(invoked)); |
| 4669 context.htmlSources; |
| 4670 JUnitTestCase.assertTrue(invoked[0]); |
| 4671 } |
| 4672 void test_getKindOf() { |
| 4673 List<bool> invoked = [false]; |
| 4674 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getKindOf(invoked)); |
| 4675 context.getKindOf(null); |
| 4676 JUnitTestCase.assertTrue(invoked[0]); |
| 4677 } |
| 4678 void test_getLaunchableClientLibrarySources() { |
| 4679 List<bool> invoked = [false]; |
| 4680 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getLaunchableClientLibrarySources(invoked)); |
| 4681 context.launchableClientLibrarySources; |
| 4682 JUnitTestCase.assertTrue(invoked[0]); |
| 4683 } |
| 4684 void test_getLaunchableServerLibrarySources() { |
| 4685 List<bool> invoked = [false]; |
| 4686 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getLaunchableServerLibrarySources(invoked)); |
| 4687 context.launchableServerLibrarySources; |
| 4688 JUnitTestCase.assertTrue(invoked[0]); |
| 4689 } |
| 4690 void test_getLibrariesContaining() { |
| 4691 List<bool> invoked = [false]; |
| 4692 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getLibrariesContaining(invoked)); |
| 4693 context.getLibrariesContaining(null); |
| 4694 JUnitTestCase.assertTrue(invoked[0]); |
| 4695 } |
| 4696 void test_getLibrariesDependingOn() { |
| 4697 List<bool> invoked = [false]; |
| 4698 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getLibrariesDependingOn(invoked)); |
| 4699 context.getLibrariesDependingOn(null); |
| 4700 JUnitTestCase.assertTrue(invoked[0]); |
| 4701 } |
| 4702 void test_getLibrariesReferencedFromHtml() { |
| 4703 List<bool> invoked = [false]; |
| 4704 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getLibrariesReferencedFromHtml(invoked)); |
| 4705 context.getLibrariesReferencedFromHtml(null); |
| 4706 JUnitTestCase.assertTrue(invoked[0]); |
| 4707 } |
| 4708 void test_getLibraryElement() { |
| 4709 List<bool> invoked = [false]; |
| 4710 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getLibraryElement(invoked)); |
| 4711 context.getLibraryElement(null); |
| 4712 JUnitTestCase.assertTrue(invoked[0]); |
| 4713 } |
| 4714 void test_getLibrarySources() { |
| 4715 List<bool> invoked = [false]; |
| 4716 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getLibrarySources(invoked)); |
| 4717 context.librarySources; |
| 4718 JUnitTestCase.assertTrue(invoked[0]); |
| 4719 } |
| 4720 void test_getLineInfo() { |
| 4721 List<bool> invoked = [false]; |
| 4722 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getLineInfo(invoked)); |
| 4723 context.getLineInfo(null); |
| 4724 JUnitTestCase.assertTrue(invoked[0]); |
| 4725 } |
| 4726 void test_getModificationStamp() { |
| 4727 List<bool> invoked = [false]; |
| 4728 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getModificationStamp(invoked)); |
| 4729 context.getModificationStamp(null); |
| 4730 JUnitTestCase.assertTrue(invoked[0]); |
| 4731 } |
| 4732 void test_getPublicNamespace() { |
| 4733 List<bool> invoked = [false]; |
| 4734 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getPublicNamespace(invoked)); |
| 4735 context.getPublicNamespace(null); |
| 4736 JUnitTestCase.assertTrue(invoked[0]); |
| 4737 } |
| 4738 void test_getRefactoringUnsafeSources() { |
| 4739 List<bool> invoked = [false]; |
| 4740 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getRefactoringUnsafeSources(invoked)); |
| 4741 context.refactoringUnsafeSources; |
| 4742 JUnitTestCase.assertTrue(invoked[0]); |
| 4743 } |
| 4744 void test_getResolvedCompilationUnit_element() { |
| 4745 List<bool> invoked = [false]; |
| 4746 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getResolvedCompilationUnit_element(invoked))
; |
| 4747 context.getResolvedCompilationUnit(null, null); |
| 4748 JUnitTestCase.assertTrue(invoked[0]); |
| 4749 } |
| 4750 void test_getResolvedCompilationUnit_source() { |
| 4751 List<bool> invoked = [false]; |
| 4752 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getResolvedCompilationUnit_source(invoked)); |
| 4753 context.getResolvedCompilationUnit2(null, null); |
| 4754 JUnitTestCase.assertTrue(invoked[0]); |
| 4755 } |
| 4756 void test_getResolvedHtmlUnit() { |
| 4757 List<bool> invoked = [false]; |
| 4758 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getResolvedHtmlUnit(invoked)); |
| 4759 context.getResolvedHtmlUnit(null); |
| 4760 JUnitTestCase.assertTrue(invoked[0]); |
| 4761 } |
| 4762 void test_getSourceFactory() { |
| 4763 List<bool> invoked = [false]; |
| 4764 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getSourceFactory(invoked)); |
| 4765 context.sourceFactory; |
| 4766 JUnitTestCase.assertTrue(invoked[0]); |
| 4767 } |
| 4768 void test_getStatistics() { |
| 4769 List<bool> invoked = [false]; |
| 4770 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getStatistics(invoked)); |
| 4771 context.statistics; |
| 4772 JUnitTestCase.assertTrue(invoked[0]); |
| 4773 } |
| 4774 void test_getTypeProvider() { |
| 4775 List<bool> invoked = [false]; |
| 4776 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_getTypeProvider(invoked)); |
| 4777 context.typeProvider; |
| 4778 JUnitTestCase.assertTrue(invoked[0]); |
| 4779 } |
| 4780 void test_isClientLibrary() { |
| 4781 List<bool> invoked = [false]; |
| 4782 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_isClientLibrary(invoked)); |
| 4783 context.isClientLibrary(null); |
| 4784 JUnitTestCase.assertTrue(invoked[0]); |
| 4785 } |
| 4786 void test_isDisposed() { |
| 4787 List<bool> invoked = [false]; |
| 4788 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_isDisposed(invoked)); |
| 4789 context.isDisposed; |
| 4790 JUnitTestCase.assertTrue(invoked[0]); |
| 4791 } |
| 4792 void test_isServerLibrary() { |
| 4793 List<bool> invoked = [false]; |
| 4794 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_isServerLibrary(invoked)); |
| 4795 context.isServerLibrary(null); |
| 4796 JUnitTestCase.assertTrue(invoked[0]); |
| 4797 } |
| 4798 void test_mergeContext() { |
| 4799 List<bool> invoked = [false]; |
| 4800 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_mergeContext(invoked)); |
| 4801 context.mergeContext(new InstrumentedAnalysisContextImpl.con1(new TestAnalys
isContext())); |
| 4802 JUnitTestCase.assertTrue(invoked[0]); |
| 4803 } |
| 4804 void test_parseCompilationUnit() { |
| 4805 List<bool> invoked = [false]; |
| 4806 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_parseCompilationUnit(invoked)); |
| 4807 context.parseCompilationUnit(null); |
| 4808 JUnitTestCase.assertTrue(invoked[0]); |
| 4809 } |
| 4810 void test_parseHtmlUnit() { |
| 4811 List<bool> invoked = [false]; |
| 4812 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_parseHtmlUnit(invoked)); |
| 4813 context.parseHtmlUnit(null); |
| 4814 JUnitTestCase.assertTrue(invoked[0]); |
| 4815 } |
| 4816 void test_performAnalysisTask() { |
| 4817 List<bool> invoked = [false]; |
| 4818 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_performAnalysisTask(invoked)); |
| 4819 context.performAnalysisTask(); |
| 4820 JUnitTestCase.assertTrue(invoked[0]); |
| 4821 } |
| 4822 void test_recordLibraryElements() { |
| 4823 List<bool> invoked = [false]; |
| 4824 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_recordLibraryElements(invoked)); |
| 4825 context.recordLibraryElements(null); |
| 4826 JUnitTestCase.assertTrue(invoked[0]); |
| 4827 } |
| 4828 void test_resolveCompilationUnit() { |
| 4829 List<bool> invoked = [false]; |
| 4830 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_resolveCompilationUnit(invoked)); |
| 4831 context.resolveCompilationUnit2(null, null); |
| 4832 JUnitTestCase.assertTrue(invoked[0]); |
| 4833 } |
| 4834 void test_resolveCompilationUnit_element() { |
| 4835 List<bool> invoked = [false]; |
| 4836 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_resolveCompilationUnit_element(invoked)); |
| 4837 context.resolveCompilationUnit(null, null); |
| 4838 JUnitTestCase.assertTrue(invoked[0]); |
| 4839 } |
| 4840 void test_resolveHtmlUnit() { |
| 4841 List<bool> invoked = [false]; |
| 4842 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_resolveHtmlUnit(invoked)); |
| 4843 context.resolveHtmlUnit(null); |
| 4844 JUnitTestCase.assertTrue(invoked[0]); |
| 4845 } |
| 4846 void test_setAnalysisOptions() { |
| 4847 List<bool> invoked = [false]; |
| 4848 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_setAnalysisOptions(invoked)); |
| 4849 context.analysisOptions = null; |
| 4850 JUnitTestCase.assertTrue(invoked[0]); |
| 4851 } |
| 4852 void test_setAnalysisPriorityOrder() { |
| 4853 List<bool> invoked = [false]; |
| 4854 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_setAnalysisPriorityOrder(invoked)); |
| 4855 context.analysisPriorityOrder = null; |
| 4856 JUnitTestCase.assertTrue(invoked[0]); |
| 4857 } |
| 4858 void test_setChangedContents() { |
| 4859 List<bool> invoked = [false]; |
| 4860 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_setChangedContents(invoked)); |
| 4861 context.setChangedContents(null, null, 0, 0, 0); |
| 4862 JUnitTestCase.assertTrue(invoked[0]); |
| 4863 } |
| 4864 void test_setContents() { |
| 4865 List<bool> invoked = [false]; |
| 4866 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_setContents(invoked)); |
| 4867 context.setContents(null, null); |
| 4868 JUnitTestCase.assertTrue(invoked[0]); |
| 4869 } |
| 4870 void test_setSourceFactory() { |
| 4871 List<bool> invoked = [false]; |
| 4872 InstrumentedAnalysisContextImpl context = new InstrumentedAnalysisContextImp
l.con1(new TestAnalysisContext_test_setSourceFactory(invoked)); |
| 4873 context.sourceFactory = null; |
| 4874 JUnitTestCase.assertTrue(invoked[0]); |
| 4875 } |
| 4876 static dartSuite() { |
| 4877 _ut.group('InstrumentedAnalysisContextImplTest', () { |
| 4878 _ut.test('test_addSourceInfo', () { |
| 4879 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4880 runJUnitTest(__test, __test.test_addSourceInfo); |
| 4881 }); |
| 4882 _ut.test('test_applyChanges', () { |
| 4883 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4884 runJUnitTest(__test, __test.test_applyChanges); |
| 4885 }); |
| 4886 _ut.test('test_computeDocumentationComment', () { |
| 4887 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4888 runJUnitTest(__test, __test.test_computeDocumentationComment); |
| 4889 }); |
| 4890 _ut.test('test_computeErrors', () { |
| 4891 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4892 runJUnitTest(__test, __test.test_computeErrors); |
| 4893 }); |
| 4894 _ut.test('test_computeExportedLibraries', () { |
| 4895 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4896 runJUnitTest(__test, __test.test_computeExportedLibraries); |
| 4897 }); |
| 4898 _ut.test('test_computeHtmlElement', () { |
| 4899 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4900 runJUnitTest(__test, __test.test_computeHtmlElement); |
| 4901 }); |
| 4902 _ut.test('test_computeImportedLibraries', () { |
| 4903 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4904 runJUnitTest(__test, __test.test_computeImportedLibraries); |
| 4905 }); |
| 4906 _ut.test('test_computeKindOf', () { |
| 4907 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4908 runJUnitTest(__test, __test.test_computeKindOf); |
| 4909 }); |
| 4910 _ut.test('test_computeLibraryElement', () { |
| 4911 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4912 runJUnitTest(__test, __test.test_computeLibraryElement); |
| 4913 }); |
| 4914 _ut.test('test_computeLineInfo', () { |
| 4915 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4916 runJUnitTest(__test, __test.test_computeLineInfo); |
| 4917 }); |
| 4918 _ut.test('test_computeResolvableCompilationUnit', () { |
| 4919 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4920 runJUnitTest(__test, __test.test_computeResolvableCompilationUnit); |
| 4921 }); |
| 4922 _ut.test('test_creation', () { |
| 4923 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4924 runJUnitTest(__test, __test.test_creation); |
| 4925 }); |
| 4926 _ut.test('test_dispose', () { |
| 4927 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4928 runJUnitTest(__test, __test.test_dispose); |
| 4929 }); |
| 4930 _ut.test('test_exists', () { |
| 4931 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4932 runJUnitTest(__test, __test.test_exists); |
| 4933 }); |
| 4934 _ut.test('test_extractContext', () { |
| 4935 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4936 runJUnitTest(__test, __test.test_extractContext); |
| 4937 }); |
| 4938 _ut.test('test_extractContextInto', () { |
| 4939 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4940 runJUnitTest(__test, __test.test_extractContextInto); |
| 4941 }); |
| 4942 _ut.test('test_getAnalysisOptions', () { |
| 4943 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4944 runJUnitTest(__test, __test.test_getAnalysisOptions); |
| 4945 }); |
| 4946 _ut.test('test_getAngularApplicationWithHtml', () { |
| 4947 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4948 runJUnitTest(__test, __test.test_getAngularApplicationWithHtml); |
| 4949 }); |
| 4950 _ut.test('test_getCompilationUnitElement', () { |
| 4951 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4952 runJUnitTest(__test, __test.test_getCompilationUnitElement); |
| 4953 }); |
| 4954 _ut.test('test_getContents', () { |
| 4955 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4956 runJUnitTest(__test, __test.test_getContents); |
| 4957 }); |
| 4958 // _ut.test('test_getContentsToReceiver', () { |
| 4959 // final __test = new InstrumentedAnalysisContextImplTest(); |
| 4960 // runJUnitTest(__test, __test.test_getContentsToReceiver); |
| 4961 // }); |
| 4962 _ut.test('test_getElement', () { |
| 4963 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4964 runJUnitTest(__test, __test.test_getElement); |
| 4965 }); |
| 4966 _ut.test('test_getErrors', () { |
| 4967 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4968 runJUnitTest(__test, __test.test_getErrors); |
| 4969 }); |
| 4970 _ut.test('test_getHtmlElement', () { |
| 4971 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4972 runJUnitTest(__test, __test.test_getHtmlElement); |
| 4973 }); |
| 4974 _ut.test('test_getHtmlFilesReferencing', () { |
| 4975 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4976 runJUnitTest(__test, __test.test_getHtmlFilesReferencing); |
| 4977 }); |
| 4978 _ut.test('test_getHtmlSources', () { |
| 4979 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4980 runJUnitTest(__test, __test.test_getHtmlSources); |
| 4981 }); |
| 4982 _ut.test('test_getKindOf', () { |
| 4983 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4984 runJUnitTest(__test, __test.test_getKindOf); |
| 4985 }); |
| 4986 _ut.test('test_getLaunchableClientLibrarySources', () { |
| 4987 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4988 runJUnitTest(__test, __test.test_getLaunchableClientLibrarySources); |
| 4989 }); |
| 4990 _ut.test('test_getLaunchableServerLibrarySources', () { |
| 4991 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4992 runJUnitTest(__test, __test.test_getLaunchableServerLibrarySources); |
| 4993 }); |
| 4994 _ut.test('test_getLibrariesContaining', () { |
| 4995 final __test = new InstrumentedAnalysisContextImplTest(); |
| 4996 runJUnitTest(__test, __test.test_getLibrariesContaining); |
| 4997 }); |
| 4998 _ut.test('test_getLibrariesDependingOn', () { |
| 4999 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5000 runJUnitTest(__test, __test.test_getLibrariesDependingOn); |
| 5001 }); |
| 5002 _ut.test('test_getLibrariesReferencedFromHtml', () { |
| 5003 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5004 runJUnitTest(__test, __test.test_getLibrariesReferencedFromHtml); |
| 5005 }); |
| 5006 _ut.test('test_getLibraryElement', () { |
| 5007 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5008 runJUnitTest(__test, __test.test_getLibraryElement); |
| 5009 }); |
| 5010 _ut.test('test_getLibrarySources', () { |
| 5011 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5012 runJUnitTest(__test, __test.test_getLibrarySources); |
| 5013 }); |
| 5014 _ut.test('test_getLineInfo', () { |
| 5015 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5016 runJUnitTest(__test, __test.test_getLineInfo); |
| 5017 }); |
| 5018 _ut.test('test_getModificationStamp', () { |
| 5019 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5020 runJUnitTest(__test, __test.test_getModificationStamp); |
| 5021 }); |
| 5022 _ut.test('test_getPublicNamespace', () { |
| 5023 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5024 runJUnitTest(__test, __test.test_getPublicNamespace); |
| 5025 }); |
| 5026 _ut.test('test_getRefactoringUnsafeSources', () { |
| 5027 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5028 runJUnitTest(__test, __test.test_getRefactoringUnsafeSources); |
| 5029 }); |
| 5030 _ut.test('test_getResolvedCompilationUnit_element', () { |
| 5031 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5032 runJUnitTest(__test, __test.test_getResolvedCompilationUnit_element); |
| 5033 }); |
| 5034 _ut.test('test_getResolvedCompilationUnit_source', () { |
| 5035 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5036 runJUnitTest(__test, __test.test_getResolvedCompilationUnit_source); |
| 5037 }); |
| 5038 _ut.test('test_getResolvedHtmlUnit', () { |
| 5039 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5040 runJUnitTest(__test, __test.test_getResolvedHtmlUnit); |
| 5041 }); |
| 5042 _ut.test('test_getSourceFactory', () { |
| 5043 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5044 runJUnitTest(__test, __test.test_getSourceFactory); |
| 5045 }); |
| 5046 _ut.test('test_getStatistics', () { |
| 5047 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5048 runJUnitTest(__test, __test.test_getStatistics); |
| 5049 }); |
| 5050 _ut.test('test_getTypeProvider', () { |
| 5051 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5052 runJUnitTest(__test, __test.test_getTypeProvider); |
| 5053 }); |
| 5054 _ut.test('test_isClientLibrary', () { |
| 5055 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5056 runJUnitTest(__test, __test.test_isClientLibrary); |
| 5057 }); |
| 5058 _ut.test('test_isDisposed', () { |
| 5059 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5060 runJUnitTest(__test, __test.test_isDisposed); |
| 5061 }); |
| 5062 _ut.test('test_isServerLibrary', () { |
| 5063 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5064 runJUnitTest(__test, __test.test_isServerLibrary); |
| 5065 }); |
| 5066 _ut.test('test_mergeContext', () { |
| 5067 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5068 runJUnitTest(__test, __test.test_mergeContext); |
| 5069 }); |
| 5070 _ut.test('test_parseCompilationUnit', () { |
| 5071 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5072 runJUnitTest(__test, __test.test_parseCompilationUnit); |
| 5073 }); |
| 5074 _ut.test('test_parseHtmlUnit', () { |
| 5075 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5076 runJUnitTest(__test, __test.test_parseHtmlUnit); |
| 5077 }); |
| 5078 _ut.test('test_performAnalysisTask', () { |
| 5079 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5080 runJUnitTest(__test, __test.test_performAnalysisTask); |
| 5081 }); |
| 5082 _ut.test('test_recordLibraryElements', () { |
| 5083 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5084 runJUnitTest(__test, __test.test_recordLibraryElements); |
| 5085 }); |
| 5086 _ut.test('test_resolveCompilationUnit', () { |
| 5087 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5088 runJUnitTest(__test, __test.test_resolveCompilationUnit); |
| 5089 }); |
| 5090 _ut.test('test_resolveCompilationUnit_element', () { |
| 5091 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5092 runJUnitTest(__test, __test.test_resolveCompilationUnit_element); |
| 5093 }); |
| 5094 _ut.test('test_resolveHtmlUnit', () { |
| 5095 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5096 runJUnitTest(__test, __test.test_resolveHtmlUnit); |
| 5097 }); |
| 5098 _ut.test('test_setAnalysisOptions', () { |
| 5099 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5100 runJUnitTest(__test, __test.test_setAnalysisOptions); |
| 5101 }); |
| 5102 _ut.test('test_setAnalysisPriorityOrder', () { |
| 5103 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5104 runJUnitTest(__test, __test.test_setAnalysisPriorityOrder); |
| 5105 }); |
| 5106 _ut.test('test_setChangedContents', () { |
| 5107 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5108 runJUnitTest(__test, __test.test_setChangedContents); |
| 5109 }); |
| 5110 _ut.test('test_setContents', () { |
| 5111 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5112 runJUnitTest(__test, __test.test_setContents); |
| 5113 }); |
| 5114 _ut.test('test_setSourceFactory', () { |
| 5115 final __test = new InstrumentedAnalysisContextImplTest(); |
| 5116 runJUnitTest(__test, __test.test_setSourceFactory); |
| 5117 }); |
| 5118 }); |
| 5119 } |
| 5120 } |
| 5121 |
| 5122 |
| 5123 class ParseDartTaskTest extends EngineTestCase { |
| 5124 void test_accept() { |
| 5125 ParseDartTask task = new ParseDartTask(null, null, 0, null, null); |
| 5126 JUnitTestCase.assertTrue(task.accept(new ParseDartTaskTestTV_accept())); |
| 5127 } |
| 5128 |
| 5129 void test_getCompilationUnit() { |
| 5130 ParseDartTask task = new ParseDartTask(null, null, 0, null, null); |
| 5131 JUnitTestCase.assertNull(task.compilationUnit); |
| 5132 } |
| 5133 |
| 5134 void test_getErrors() { |
| 5135 ParseDartTask task = new ParseDartTask(null, null, 0, null, null); |
| 5136 EngineTestCase.assertLength(0, task.errors); |
| 5137 } |
| 5138 |
| 5139 void test_getException() { |
| 5140 ParseDartTask task = new ParseDartTask(null, null, 0, null, null); |
| 5141 JUnitTestCase.assertNull(task.exception); |
| 5142 } |
| 5143 |
| 5144 void test_getModificationTime() { |
| 5145 int modificationTime = 26; |
| 5146 ParseDartTask task = new ParseDartTask(null, null, modificationTime, null, n
ull); |
| 5147 JUnitTestCase.assertEquals(modificationTime, task.modificationTime); |
| 5148 } |
| 5149 |
| 5150 void test_getSource() { |
| 5151 Source source = new TestSource('/test.dart'); |
| 5152 ParseDartTask task = new ParseDartTask(null, source, 0, null, null); |
| 5153 JUnitTestCase.assertSame(source, task.source); |
| 5154 } |
| 5155 |
| 5156 void test_hasNonPartOfDirective() { |
| 5157 ParseDartTask task = new ParseDartTask(null, null, 0, null, null); |
| 5158 JUnitTestCase.assertFalse(task.hasNonPartOfDirective); |
| 5159 } |
| 5160 |
| 5161 void test_hasPartOfDirective() { |
| 5162 ParseDartTask task = new ParseDartTask(null, null, 0, null, null); |
| 5163 JUnitTestCase.assertFalse(task.hasPartOfDirective); |
| 5164 } |
| 5165 |
| 5166 void test_perform_exception() { |
| 5167 TestSource source = new TestSource(); |
| 5168 source.generateExceptionOnRead = true; |
| 5169 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 5170 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 5171 ParseDartTask task = new ParseDartTask(context, source, 0, null, null); |
| 5172 task.perform(new ParseDartTaskTestTV_perform_exception()); |
| 5173 } |
| 5174 |
| 5175 void test_perform_library() { |
| 5176 String content = EngineTestCase.createSource([ |
| 5177 "library lib;", |
| 5178 "import 'lib2.dart';", |
| 5179 "export 'lib3.dart';", |
| 5180 "part 'part.dart';", |
| 5181 "class A {"]); |
| 5182 Source source = new TestSource('/test.dart', content); |
| 5183 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 5184 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 5185 ParseDartTask task = _createParseTask(context, source, content); |
| 5186 task.perform(new ParseDartTaskTestTV_perform_library(context, source)); |
| 5187 } |
| 5188 |
| 5189 void test_perform_part() { |
| 5190 String content = EngineTestCase.createSource(["part of lib;", "class B {}"])
; |
| 5191 Source source = new TestSource('/test.dart', content); |
| 5192 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 5193 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 5194 ParseDartTask task = _createParseTask(context, source, content); |
| 5195 task.perform(new ParseDartTaskTestTV_perform_part(context, source)); |
| 5196 } |
| 5197 |
| 5198 void test_perform_validateDirectives() { |
| 5199 String content = EngineTestCase.createSource([ |
| 5200 "library lib;", |
| 5201 "import '/does/not/exist.dart';", |
| 5202 "import '://invaliduri.dart';", |
| 5203 "export '\${a}lib3.dart';", |
| 5204 "part 'part.dart';", |
| 5205 "class A {}"]); |
| 5206 Source source = new TestSource('/test.dart', content); |
| 5207 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 5208 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 5209 ParseDartTask task = _createParseTask(context, source, content); |
| 5210 task.perform(new ParseDartTaskTestTV_perform_validateDirectives(context, sou
rce)); |
| 5211 } |
| 5212 |
| 5213 /** |
| 5214 * Create and return a task that will parse the given content from the given s
ource in the given |
| 5215 * context. |
| 5216 * |
| 5217 * @param context the context to be passed to the task |
| 5218 * @param source the source to be parsed |
| 5219 * @param content the content of the source to be parsed |
| 5220 * @return the task that was created |
| 5221 * @throws AnalysisException if the task could not be created |
| 5222 */ |
| 5223 ParseDartTask _createParseTask(InternalAnalysisContext context, Source source,
String content) { |
| 5224 ScanDartTask scanTask = new ScanDartTask(context, source, context.getModific
ationStamp(source), content); |
| 5225 scanTask.perform(new ParseDartTaskTestTV_createParseTask()); |
| 5226 return new ParseDartTask(context, source, scanTask.modificationTime, scanTas
k.tokenStream, scanTask.lineInfo); |
| 5227 } |
| 5228 |
| 5229 static dartSuite() { |
| 5230 _ut.group('ParseDartTaskTest', () { |
| 5231 _ut.test('test_accept', () { |
| 5232 final __test = new ParseDartTaskTest(); |
| 5233 runJUnitTest(__test, __test.test_accept); |
| 5234 }); |
| 5235 _ut.test('test_getCompilationUnit', () { |
| 5236 final __test = new ParseDartTaskTest(); |
| 5237 runJUnitTest(__test, __test.test_getCompilationUnit); |
| 5238 }); |
| 5239 _ut.test('test_getErrors', () { |
| 5240 final __test = new ParseDartTaskTest(); |
| 5241 runJUnitTest(__test, __test.test_getErrors); |
| 5242 }); |
| 5243 _ut.test('test_getException', () { |
| 5244 final __test = new ParseDartTaskTest(); |
| 5245 runJUnitTest(__test, __test.test_getException); |
| 5246 }); |
| 5247 _ut.test('test_getModificationTime', () { |
| 5248 final __test = new ParseDartTaskTest(); |
| 5249 runJUnitTest(__test, __test.test_getModificationTime); |
| 5250 }); |
| 5251 _ut.test('test_getSource', () { |
| 5252 final __test = new ParseDartTaskTest(); |
| 5253 runJUnitTest(__test, __test.test_getSource); |
| 5254 }); |
| 5255 _ut.test('test_hasNonPartOfDirective', () { |
| 5256 final __test = new ParseDartTaskTest(); |
| 5257 runJUnitTest(__test, __test.test_hasNonPartOfDirective); |
| 5258 }); |
| 5259 _ut.test('test_hasPartOfDirective', () { |
| 5260 final __test = new ParseDartTaskTest(); |
| 5261 runJUnitTest(__test, __test.test_hasPartOfDirective); |
| 5262 }); |
| 5263 _ut.test('test_perform_exception', () { |
| 5264 final __test = new ParseDartTaskTest(); |
| 5265 runJUnitTest(__test, __test.test_perform_exception); |
| 5266 }); |
| 5267 _ut.test('test_perform_library', () { |
| 5268 final __test = new ParseDartTaskTest(); |
| 5269 runJUnitTest(__test, __test.test_perform_library); |
| 5270 }); |
| 5271 _ut.test('test_perform_part', () { |
| 5272 final __test = new ParseDartTaskTest(); |
| 5273 runJUnitTest(__test, __test.test_perform_part); |
| 5274 }); |
| 5275 _ut.test('test_perform_validateDirectives', () { |
| 5276 final __test = new ParseDartTaskTest(); |
| 5277 runJUnitTest(__test, __test.test_perform_validateDirectives); |
| 5278 }); |
| 5279 }); |
| 5280 } |
| 5281 } |
| 5282 |
| 5283 |
| 5284 class ParseDartTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 5285 @override |
| 5286 bool visitParseDartTask(ParseDartTask task) => true; |
| 5287 } |
| 5288 |
| 5289 |
| 5290 class ParseDartTaskTestTV_createParseTask extends TestTaskVisitor<Object> { |
| 5291 @override |
| 5292 Object visitScanDartTask(ScanDartTask task) => null; |
| 5293 } |
| 5294 |
| 5295 |
| 5296 class ParseDartTaskTestTV_perform_exception extends TestTaskVisitor<bool> { |
| 5297 @override |
| 5298 bool visitParseDartTask(ParseDartTask task) { |
| 5299 JUnitTestCase.assertNotNull(task.exception); |
| 5300 return true; |
| 5301 } |
| 5302 } |
| 5303 |
| 5304 |
| 5305 class ParseDartTaskTestTV_perform_library extends TestTaskVisitor<Object> { |
| 5306 InternalAnalysisContext context; |
| 5307 Source source; |
| 5308 ParseDartTaskTestTV_perform_library(this.context, this.source); |
| 5309 @override |
| 5310 Object visitParseDartTask(ParseDartTask task) { |
| 5311 CaughtException exception = task.exception; |
| 5312 if (exception != null) { |
| 5313 throw exception; |
| 5314 } |
| 5315 JUnitTestCase.assertNotNull(task.compilationUnit); |
| 5316 EngineTestCase.assertLength(1, task.errors); |
| 5317 JUnitTestCase.assertEquals(context.getModificationStamp(source), task.modifi
cationTime); |
| 5318 JUnitTestCase.assertSame(source, task.source); |
| 5319 JUnitTestCase.assertTrue(task.hasNonPartOfDirective); |
| 5320 JUnitTestCase.assertFalse(task.hasPartOfDirective); |
| 5321 return null; |
| 5322 } |
| 5323 } |
| 5324 |
| 5325 |
| 5326 class ParseDartTaskTestTV_perform_part extends TestTaskVisitor<Object> { |
| 5327 InternalAnalysisContext context; |
| 5328 Source source; |
| 5329 ParseDartTaskTestTV_perform_part(this.context, this.source); |
| 5330 @override |
| 5331 Object visitParseDartTask(ParseDartTask task) { |
| 5332 CaughtException exception = task.exception; |
| 5333 if (exception != null) { |
| 5334 throw exception; |
| 5335 } |
| 5336 JUnitTestCase.assertNotNull(task.compilationUnit); |
| 5337 EngineTestCase.assertLength(0, task.errors); |
| 5338 JUnitTestCase.assertEquals(context.getModificationStamp(source), task.modifi
cationTime); |
| 5339 JUnitTestCase.assertSame(source, task.source); |
| 5340 JUnitTestCase.assertFalse(task.hasNonPartOfDirective); |
| 5341 JUnitTestCase.assertTrue(task.hasPartOfDirective); |
| 5342 return null; |
| 5343 } |
| 5344 } |
| 5345 |
| 5346 |
| 5347 class ParseDartTaskTestTV_perform_validateDirectives extends TestTaskVisitor<Obj
ect> { |
| 5348 InternalAnalysisContext context; |
| 5349 Source source; |
| 5350 ParseDartTaskTestTV_perform_validateDirectives(this.context, this.source); |
| 5351 @override |
| 5352 Object visitParseDartTask(ParseDartTask task) { |
| 5353 CaughtException exception = task.exception; |
| 5354 if (exception != null) { |
| 5355 throw exception; |
| 5356 } |
| 5357 JUnitTestCase.assertNotNull(task.compilationUnit); |
| 5358 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 5359 errorListener.addAll(task.errors); |
| 5360 errorListener.assertErrorsWithCodes([ |
| 5361 CompileTimeErrorCode.URI_WITH_INTERPOLATION, |
| 5362 CompileTimeErrorCode.INVALID_URI]); |
| 5363 JUnitTestCase.assertEquals(context.getModificationStamp(source), task.modifi
cationTime); |
| 5364 JUnitTestCase.assertSame(source, task.source); |
| 5365 JUnitTestCase.assertTrue(task.hasNonPartOfDirective); |
| 5366 JUnitTestCase.assertFalse(task.hasPartOfDirective); |
| 5367 return null; |
| 5368 } |
| 5369 } |
| 5370 |
| 5371 |
| 5372 class ParseHtmlTaskTest extends EngineTestCase { |
| 5373 ParseHtmlTask parseContents(String contents, TestLogger testLogger) { |
| 5374 return parseSource(new TestSource('/test.dart', contents), contents, testLog
ger); |
| 5375 } |
| 5376 |
| 5377 ParseHtmlTask parseSource(Source source, String contents, TestLogger testLogge
r) { |
| 5378 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 5379 context.setContents(source, contents); |
| 5380 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 5381 ParseHtmlTask task = new ParseHtmlTask(context, source, context.getModificat
ionStamp(source), contents); |
| 5382 Logger oldLogger = AnalysisEngine.instance.logger; |
| 5383 try { |
| 5384 AnalysisEngine.instance.logger = testLogger; |
| 5385 task.perform(new ParseHtmlTaskTestTV_parseSource(context, source)); |
| 5386 } finally { |
| 5387 AnalysisEngine.instance.logger = oldLogger; |
| 5388 } |
| 5389 return task; |
| 5390 } |
| 5391 |
| 5392 void test_accept() { |
| 5393 ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); |
| 5394 JUnitTestCase.assertTrue(task.accept(new ParseHtmlTaskTestTV_accept())); |
| 5395 } |
| 5396 |
| 5397 void test_getException() { |
| 5398 ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); |
| 5399 JUnitTestCase.assertNull(task.exception); |
| 5400 } |
| 5401 |
| 5402 void test_getHtmlUnit() { |
| 5403 ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); |
| 5404 JUnitTestCase.assertNull(task.htmlUnit); |
| 5405 } |
| 5406 |
| 5407 void test_getLineInfo() { |
| 5408 ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); |
| 5409 JUnitTestCase.assertNull(task.lineInfo); |
| 5410 } |
| 5411 |
| 5412 void test_getReferencedLibraries() { |
| 5413 ParseHtmlTask task = new ParseHtmlTask(null, null, 0, ""); |
| 5414 EngineTestCase.assertLength(0, task.referencedLibraries); |
| 5415 } |
| 5416 |
| 5417 void test_getSource() { |
| 5418 Source source = new TestSource('/test.dart'); |
| 5419 ParseHtmlTask task = new ParseHtmlTask(null, source, 0, ""); |
| 5420 JUnitTestCase.assertSame(source, task.source); |
| 5421 } |
| 5422 |
| 5423 void test_perform_embedded_source() { |
| 5424 String contents = EngineTestCase.createSource([ |
| 5425 "<html>", |
| 5426 "<head>", |
| 5427 " <script type='application/dart'>", |
| 5428 " void buttonPressed() {}", |
| 5429 " </script>", |
| 5430 "</head>", |
| 5431 "<body>", |
| 5432 "</body>", |
| 5433 "</html>"]); |
| 5434 TestLogger testLogger = new TestLogger(); |
| 5435 ParseHtmlTask task = parseContents(contents, testLogger); |
| 5436 EngineTestCase.assertLength(0, task.referencedLibraries); |
| 5437 JUnitTestCase.assertEquals(0, testLogger.errorCount); |
| 5438 JUnitTestCase.assertEquals(0, testLogger.infoCount); |
| 5439 } |
| 5440 |
| 5441 void test_perform_empty_source_reference() { |
| 5442 String contents = EngineTestCase.createSource([ |
| 5443 "<html>", |
| 5444 "<head>", |
| 5445 " <script type='application/dart' src=''/>", |
| 5446 "</head>", |
| 5447 "<body>", |
| 5448 "</body>", |
| 5449 "</html>"]); |
| 5450 TestLogger testLogger = new TestLogger(); |
| 5451 ParseHtmlTask task = parseContents(contents, testLogger); |
| 5452 EngineTestCase.assertLength(0, task.referencedLibraries); |
| 5453 JUnitTestCase.assertEquals(0, testLogger.errorCount); |
| 5454 JUnitTestCase.assertEquals(0, testLogger.infoCount); |
| 5455 } |
| 5456 |
| 5457 void test_perform_invalid_source_reference() { |
| 5458 String contents = EngineTestCase.createSource([ |
| 5459 "<html>", |
| 5460 "<head>", |
| 5461 " <script type='application/dart' src='an;invalid:[]uri'/>", |
| 5462 "</head>", |
| 5463 "<body>", |
| 5464 "</body>", |
| 5465 "</html>"]); |
| 5466 TestLogger testLogger = new TestLogger(); |
| 5467 ParseHtmlTask task = parseContents(contents, testLogger); |
| 5468 EngineTestCase.assertLength(0, task.referencedLibraries); |
| 5469 JUnitTestCase.assertEquals(0, testLogger.errorCount); |
| 5470 JUnitTestCase.assertEquals(0, testLogger.infoCount); |
| 5471 } |
| 5472 |
| 5473 void test_perform_non_existing_source_reference() { |
| 5474 String contents = EngineTestCase.createSource([ |
| 5475 "<html>", |
| 5476 "<head>", |
| 5477 " <script type='application/dart' src='does/not/exist.dart'/>", |
| 5478 "</head>", |
| 5479 "<body>", |
| 5480 "</body>", |
| 5481 "</html>"]); |
| 5482 TestLogger testLogger = new TestLogger(); |
| 5483 ParseHtmlTask task = parseSource(new ParseHtmlTaskTest_non_existing_source(c
ontents), contents, testLogger); |
| 5484 EngineTestCase.assertLength(0, task.referencedLibraries); |
| 5485 JUnitTestCase.assertEquals(0, testLogger.errorCount); |
| 5486 JUnitTestCase.assertEquals(0, testLogger.infoCount); |
| 5487 } |
| 5488 |
| 5489 void test_perform_referenced_source() { |
| 5490 // TODO(scheglov) this test fails because we put into cache TestSource |
| 5491 // test.dart (and actually should test.html), but resolve |
| 5492 // src='test.dart' as a FileBasedSource |
| 5493 // We need to switch to a virtual file system and use it everywhere. |
| 5494 // String contents = EngineTestCase.createSource([ |
| 5495 // "<html>", |
| 5496 // "<head>", |
| 5497 // " <script type='application/dart' src='test.dart'/>", |
| 5498 // "</head>", |
| 5499 // "<body>", |
| 5500 // "</body>", |
| 5501 // "</html>"]); |
| 5502 // TestLogger testLogger = new TestLogger(); |
| 5503 // ParseHtmlTask task = parseContents(contents, testLogger); |
| 5504 // EngineTestCase.assertLength(1, task.referencedLibraries); |
| 5505 // JUnitTestCase.assertEquals(0, testLogger.errorCount); |
| 5506 // JUnitTestCase.assertEquals(0, testLogger.errorCount); |
| 5507 } |
| 5508 |
| 5509 static dartSuite() { |
| 5510 _ut.group('ParseHtmlTaskTest', () { |
| 5511 _ut.test('test_accept', () { |
| 5512 final __test = new ParseHtmlTaskTest(); |
| 5513 runJUnitTest(__test, __test.test_accept); |
| 5514 }); |
| 5515 _ut.test('test_getException', () { |
| 5516 final __test = new ParseHtmlTaskTest(); |
| 5517 runJUnitTest(__test, __test.test_getException); |
| 5518 }); |
| 5519 _ut.test('test_getHtmlUnit', () { |
| 5520 final __test = new ParseHtmlTaskTest(); |
| 5521 runJUnitTest(__test, __test.test_getHtmlUnit); |
| 5522 }); |
| 5523 _ut.test('test_getLineInfo', () { |
| 5524 final __test = new ParseHtmlTaskTest(); |
| 5525 runJUnitTest(__test, __test.test_getLineInfo); |
| 5526 }); |
| 5527 _ut.test('test_getReferencedLibraries', () { |
| 5528 final __test = new ParseHtmlTaskTest(); |
| 5529 runJUnitTest(__test, __test.test_getReferencedLibraries); |
| 5530 }); |
| 5531 _ut.test('test_getSource', () { |
| 5532 final __test = new ParseHtmlTaskTest(); |
| 5533 runJUnitTest(__test, __test.test_getSource); |
| 5534 }); |
| 5535 _ut.test('test_perform_embedded_source', () { |
| 5536 final __test = new ParseHtmlTaskTest(); |
| 5537 runJUnitTest(__test, __test.test_perform_embedded_source); |
| 5538 }); |
| 5539 _ut.test('test_perform_empty_source_reference', () { |
| 5540 final __test = new ParseHtmlTaskTest(); |
| 5541 runJUnitTest(__test, __test.test_perform_empty_source_reference); |
| 5542 }); |
| 5543 _ut.test('test_perform_invalid_source_reference', () { |
| 5544 final __test = new ParseHtmlTaskTest(); |
| 5545 runJUnitTest(__test, __test.test_perform_invalid_source_reference); |
| 5546 }); |
| 5547 _ut.test('test_perform_non_existing_source_reference', () { |
| 5548 final __test = new ParseHtmlTaskTest(); |
| 5549 runJUnitTest(__test, __test.test_perform_non_existing_source_reference); |
| 5550 }); |
| 5551 _ut.test('test_perform_referenced_source', () { |
| 5552 final __test = new ParseHtmlTaskTest(); |
| 5553 runJUnitTest(__test, __test.test_perform_referenced_source); |
| 5554 }); |
| 5555 }); |
| 5556 } |
| 5557 } |
| 5558 |
| 5559 |
| 5560 class ParseHtmlTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 5561 @override |
| 5562 bool visitParseHtmlTask(ParseHtmlTask task) => true; |
| 5563 } |
| 5564 |
| 5565 |
| 5566 class ParseHtmlTaskTestTV_parseSource extends TestTaskVisitor<bool> { |
| 5567 InternalAnalysisContext context; |
| 5568 Source source; |
| 5569 ParseHtmlTaskTestTV_parseSource(this.context, this.source); |
| 5570 @override |
| 5571 bool visitParseHtmlTask(ParseHtmlTask task) { |
| 5572 CaughtException exception = task.exception; |
| 5573 if (exception != null) { |
| 5574 throw exception; |
| 5575 } |
| 5576 JUnitTestCase.assertNotNull(task.htmlUnit); |
| 5577 JUnitTestCase.assertNotNull(task.lineInfo); |
| 5578 JUnitTestCase.assertEquals(context.getModificationStamp(source), task.modifi
cationTime); |
| 5579 JUnitTestCase.assertSame(source, task.source); |
| 5580 return true; |
| 5581 } |
| 5582 } |
| 5583 |
| 5584 |
| 5585 class ParseHtmlTaskTest_non_existing_source extends TestSource { |
| 5586 ParseHtmlTaskTest_non_existing_source(String arg0) : super(arg0); |
| 5587 @override |
| 5588 Uri resolveRelativeUri(Uri containedUri) { |
| 5589 try { |
| 5590 return parseUriWithException("file:/does/not/exist.dart"); |
| 5591 } on URISyntaxException catch (exception) { |
| 5592 return null; |
| 5593 } |
| 5594 } |
| 5595 } |
| 5596 |
| 5597 |
| 5598 class PartitionManagerTest extends EngineTestCase { |
| 5599 void test_clearCache() { |
| 5600 PartitionManager manager = new PartitionManager(); |
| 5601 DartSdk sdk = new MockDartSdk(); |
| 5602 SdkCachePartition oldPartition = manager.forSdk(sdk); |
| 5603 manager.clearCache(); |
| 5604 SdkCachePartition newPartition = manager.forSdk(sdk); |
| 5605 JUnitTestCase.assertNotSame(oldPartition, newPartition); |
| 5606 } |
| 5607 |
| 5608 void test_creation() { |
| 5609 JUnitTestCase.assertNotNull(new PartitionManager()); |
| 5610 } |
| 5611 |
| 5612 void test_forSdk() { |
| 5613 PartitionManager manager = new PartitionManager(); |
| 5614 DartSdk sdk1 = new MockDartSdk(); |
| 5615 SdkCachePartition partition1 = manager.forSdk(sdk1); |
| 5616 JUnitTestCase.assertNotNull(partition1); |
| 5617 JUnitTestCase.assertSame(partition1, manager.forSdk(sdk1)); |
| 5618 DartSdk sdk2 = new MockDartSdk(); |
| 5619 SdkCachePartition partition2 = manager.forSdk(sdk2); |
| 5620 JUnitTestCase.assertNotNull(partition2); |
| 5621 JUnitTestCase.assertSame(partition2, manager.forSdk(sdk2)); |
| 5622 JUnitTestCase.assertNotSame(partition1, partition2); |
| 5623 } |
| 5624 |
| 5625 static dartSuite() { |
| 5626 _ut.group('PartitionManagerTest', () { |
| 5627 _ut.test('test_clearCache', () { |
| 5628 final __test = new PartitionManagerTest(); |
| 5629 runJUnitTest(__test, __test.test_clearCache); |
| 5630 }); |
| 5631 _ut.test('test_creation', () { |
| 5632 final __test = new PartitionManagerTest(); |
| 5633 runJUnitTest(__test, __test.test_creation); |
| 5634 }); |
| 5635 _ut.test('test_forSdk', () { |
| 5636 final __test = new PartitionManagerTest(); |
| 5637 runJUnitTest(__test, __test.test_forSdk); |
| 5638 }); |
| 5639 }); |
| 5640 } |
| 5641 } |
| 5642 |
| 5643 |
| 5644 class ResolveDartLibraryTaskTest extends EngineTestCase { |
| 5645 void test_accept() { |
| 5646 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); |
| 5647 JUnitTestCase.assertTrue(task.accept(new ResolveDartLibraryTaskTestTV_accept
())); |
| 5648 } |
| 5649 void test_getException() { |
| 5650 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); |
| 5651 JUnitTestCase.assertNull(task.exception); |
| 5652 } |
| 5653 void test_getLibraryResolver() { |
| 5654 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); |
| 5655 JUnitTestCase.assertNull(task.libraryResolver); |
| 5656 } |
| 5657 void test_getLibrarySource() { |
| 5658 Source source = new TestSource('/test.dart'); |
| 5659 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, source)
; |
| 5660 JUnitTestCase.assertSame(source, task.librarySource); |
| 5661 } |
| 5662 void test_getUnitSource() { |
| 5663 Source source = new TestSource('/test.dart'); |
| 5664 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, source, null)
; |
| 5665 JUnitTestCase.assertSame(source, task.unitSource); |
| 5666 } |
| 5667 void test_perform_exception() { |
| 5668 TestSource source = new TestSource(); |
| 5669 source.generateExceptionOnRead = true; |
| 5670 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 5671 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 5672 ResolveDartLibraryTask task = new ResolveDartLibraryTask(context, source, so
urce); |
| 5673 task.perform(new ResolveDartLibraryTaskTestTV_perform_exception()); |
| 5674 } |
| 5675 void test_perform_library() { |
| 5676 Source source = new TestSource('/test.dart', EngineTestCase.createSource(["l
ibrary lib;", "class A {}"])); |
| 5677 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 5678 ResolveDartLibraryTask task = new ResolveDartLibraryTask(context, source, so
urce); |
| 5679 task.perform(new ResolveDartLibraryTaskTestTV_perform_library(source)); |
| 5680 } |
| 5681 static dartSuite() { |
| 5682 _ut.group('ResolveDartLibraryTaskTest', () { |
| 5683 _ut.test('test_accept', () { |
| 5684 final __test = new ResolveDartLibraryTaskTest(); |
| 5685 runJUnitTest(__test, __test.test_accept); |
| 5686 }); |
| 5687 _ut.test('test_getException', () { |
| 5688 final __test = new ResolveDartLibraryTaskTest(); |
| 5689 runJUnitTest(__test, __test.test_getException); |
| 5690 }); |
| 5691 _ut.test('test_getLibraryResolver', () { |
| 5692 final __test = new ResolveDartLibraryTaskTest(); |
| 5693 runJUnitTest(__test, __test.test_getLibraryResolver); |
| 5694 }); |
| 5695 _ut.test('test_getLibrarySource', () { |
| 5696 final __test = new ResolveDartLibraryTaskTest(); |
| 5697 runJUnitTest(__test, __test.test_getLibrarySource); |
| 5698 }); |
| 5699 _ut.test('test_getUnitSource', () { |
| 5700 final __test = new ResolveDartLibraryTaskTest(); |
| 5701 runJUnitTest(__test, __test.test_getUnitSource); |
| 5702 }); |
| 5703 _ut.test('test_perform_exception', () { |
| 5704 final __test = new ResolveDartLibraryTaskTest(); |
| 5705 runJUnitTest(__test, __test.test_perform_exception); |
| 5706 }); |
| 5707 _ut.test('test_perform_library', () { |
| 5708 final __test = new ResolveDartLibraryTaskTest(); |
| 5709 runJUnitTest(__test, __test.test_perform_library); |
| 5710 }); |
| 5711 }); |
| 5712 } |
| 5713 } |
| 5714 |
| 5715 |
| 5716 class ResolveDartLibraryTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 5717 @override |
| 5718 bool visitResolveDartLibraryTask(ResolveDartLibraryTask task) => true; |
| 5719 } |
| 5720 |
| 5721 |
| 5722 class ResolveDartLibraryTaskTestTV_perform_exception extends TestTaskVisitor<boo
l> { |
| 5723 @override |
| 5724 bool visitResolveDartLibraryTask(ResolveDartLibraryTask task) { |
| 5725 JUnitTestCase.assertNotNull(task.exception); |
| 5726 return true; |
| 5727 } |
| 5728 } |
| 5729 |
| 5730 |
| 5731 class ResolveDartLibraryTaskTestTV_perform_library extends TestTaskVisitor<bool>
{ |
| 5732 Source source; |
| 5733 ResolveDartLibraryTaskTestTV_perform_library(this.source); |
| 5734 @override |
| 5735 bool visitResolveDartLibraryTask(ResolveDartLibraryTask task) { |
| 5736 CaughtException exception = task.exception; |
| 5737 if (exception != null) { |
| 5738 throw exception; |
| 5739 } |
| 5740 JUnitTestCase.assertNotNull(task.libraryResolver); |
| 5741 JUnitTestCase.assertSame(source, task.librarySource); |
| 5742 JUnitTestCase.assertSame(source, task.unitSource); |
| 5743 return true; |
| 5744 } |
| 5745 } |
| 5746 |
| 5747 |
| 5748 class ResolveDartUnitTaskTest extends EngineTestCase { |
| 5749 void test_accept() { |
| 5750 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); |
| 5751 JUnitTestCase.assertTrue(task.accept(new ResolveDartUnitTaskTestTV_accept())
); |
| 5752 } |
| 5753 |
| 5754 void test_getException() { |
| 5755 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); |
| 5756 JUnitTestCase.assertNull(task.exception); |
| 5757 } |
| 5758 |
| 5759 void test_getLibrarySource() { |
| 5760 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 5761 LibraryElementImpl element = ElementFactory.library(context, "lib"); |
| 5762 Source source = element.source; |
| 5763 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, element); |
| 5764 JUnitTestCase.assertSame(source, task.librarySource); |
| 5765 } |
| 5766 |
| 5767 void test_getModificationTime() { |
| 5768 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); |
| 5769 JUnitTestCase.assertEquals(-1, task.modificationTime); |
| 5770 } |
| 5771 |
| 5772 void test_getResolvedUnit() { |
| 5773 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); |
| 5774 JUnitTestCase.assertNull(task.resolvedUnit); |
| 5775 } |
| 5776 |
| 5777 void test_getSource() { |
| 5778 Source source = new TestSource('/test.dart'); |
| 5779 ResolveDartUnitTask task = new ResolveDartUnitTask(null, source, null); |
| 5780 JUnitTestCase.assertSame(source, task.source); |
| 5781 } |
| 5782 |
| 5783 void test_perform_exception() { |
| 5784 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 5785 LibraryElementImpl element = ElementFactory.library(context, "lib"); |
| 5786 TestSource source = new TestSource(); |
| 5787 source.generateExceptionOnRead = true; |
| 5788 (element.definingCompilationUnit as CompilationUnitElementImpl).source = sou
rce; |
| 5789 ResolveDartUnitTask task = new ResolveDartUnitTask(context, source, element)
; |
| 5790 task.perform(new ResolveDartUnitTaskTestTV_perform_exception()); |
| 5791 } |
| 5792 |
| 5793 void test_perform_library() { |
| 5794 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 5795 LibraryElementImpl libraryElement = ElementFactory.library(context, "lib"); |
| 5796 CompilationUnitElementImpl unitElement = libraryElement.definingCompilationU
nit as CompilationUnitElementImpl; |
| 5797 ClassElementImpl classElement = ElementFactory.classElement2("A", []); |
| 5798 classElement.nameOffset = 19; |
| 5799 ConstructorElementImpl constructorElement = ElementFactory.constructorElemen
t2(classElement, null, []); |
| 5800 constructorElement.synthetic = true; |
| 5801 classElement.constructors = <ConstructorElement> [constructorElement]; |
| 5802 unitElement.types = <ClassElement> [classElement]; |
| 5803 Source source = unitElement.source; |
| 5804 context.setContents(source, EngineTestCase.createSource(["library lib;", "cl
ass A {}"])); |
| 5805 ResolveDartUnitTask task = new ResolveDartUnitTask(context, source, libraryE
lement); |
| 5806 task.perform(new ResolveDartUnitTaskTestTV_perform_library(source, context))
; |
| 5807 } |
| 5808 |
| 5809 static dartSuite() { |
| 5810 _ut.group('ResolveDartUnitTaskTest', () { |
| 5811 _ut.test('test_accept', () { |
| 5812 final __test = new ResolveDartUnitTaskTest(); |
| 5813 runJUnitTest(__test, __test.test_accept); |
| 5814 }); |
| 5815 _ut.test('test_getException', () { |
| 5816 final __test = new ResolveDartUnitTaskTest(); |
| 5817 runJUnitTest(__test, __test.test_getException); |
| 5818 }); |
| 5819 _ut.test('test_getLibrarySource', () { |
| 5820 final __test = new ResolveDartUnitTaskTest(); |
| 5821 runJUnitTest(__test, __test.test_getLibrarySource); |
| 5822 }); |
| 5823 _ut.test('test_getModificationTime', () { |
| 5824 final __test = new ResolveDartUnitTaskTest(); |
| 5825 runJUnitTest(__test, __test.test_getModificationTime); |
| 5826 }); |
| 5827 _ut.test('test_getResolvedUnit', () { |
| 5828 final __test = new ResolveDartUnitTaskTest(); |
| 5829 runJUnitTest(__test, __test.test_getResolvedUnit); |
| 5830 }); |
| 5831 _ut.test('test_getSource', () { |
| 5832 final __test = new ResolveDartUnitTaskTest(); |
| 5833 runJUnitTest(__test, __test.test_getSource); |
| 5834 }); |
| 5835 _ut.test('test_perform_exception', () { |
| 5836 final __test = new ResolveDartUnitTaskTest(); |
| 5837 runJUnitTest(__test, __test.test_perform_exception); |
| 5838 }); |
| 5839 _ut.test('test_perform_library', () { |
| 5840 final __test = new ResolveDartUnitTaskTest(); |
| 5841 runJUnitTest(__test, __test.test_perform_library); |
| 5842 }); |
| 5843 }); |
| 5844 } |
| 5845 } |
| 5846 |
| 5847 |
| 5848 class ResolveDartUnitTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 5849 @override |
| 5850 bool visitResolveDartUnitTask(ResolveDartUnitTask task) => true; |
| 5851 } |
| 5852 |
| 5853 |
| 5854 class ResolveDartUnitTaskTestTV_perform_exception extends TestTaskVisitor<bool>
{ |
| 5855 @override |
| 5856 bool visitResolveDartUnitTask(ResolveDartUnitTask task) { |
| 5857 JUnitTestCase.assertNotNull(task.exception); |
| 5858 return true; |
| 5859 } |
| 5860 } |
| 5861 |
| 5862 |
| 5863 class ResolveDartUnitTaskTestTV_perform_library extends TestTaskVisitor<bool> { |
| 5864 Source source; |
| 5865 InternalAnalysisContext context; |
| 5866 ResolveDartUnitTaskTestTV_perform_library(this.source, this.context); |
| 5867 @override |
| 5868 bool visitResolveDartUnitTask(ResolveDartUnitTask task) { |
| 5869 CaughtException exception = task.exception; |
| 5870 if (exception != null) { |
| 5871 throw exception; |
| 5872 } |
| 5873 JUnitTestCase.assertSame(source, task.librarySource); |
| 5874 JUnitTestCase.assertEquals(context.getModificationStamp(source), task.modifi
cationTime); |
| 5875 JUnitTestCase.assertNotNull(task.resolvedUnit); |
| 5876 JUnitTestCase.assertSame(source, task.source); |
| 5877 return true; |
| 5878 } |
| 5879 } |
| 5880 |
| 5881 |
| 5882 class ResolveHtmlTaskTest extends EngineTestCase { |
| 5883 void test_accept() { |
| 5884 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); |
| 5885 JUnitTestCase.assertTrue(task.accept(new ResolveHtmlTaskTestTV_accept())); |
| 5886 } |
| 5887 |
| 5888 void test_getElement() { |
| 5889 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); |
| 5890 JUnitTestCase.assertNull(task.element); |
| 5891 } |
| 5892 |
| 5893 void test_getException() { |
| 5894 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); |
| 5895 JUnitTestCase.assertNull(task.exception); |
| 5896 } |
| 5897 |
| 5898 void test_getModificationTime() { |
| 5899 int modificationTime = 28; |
| 5900 ResolveHtmlTask task = new ResolveHtmlTask(null, null, modificationTime, nul
l); |
| 5901 JUnitTestCase.assertEquals(modificationTime, task.modificationTime); |
| 5902 } |
| 5903 |
| 5904 void test_getResolutionErrors() { |
| 5905 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); |
| 5906 EngineTestCase.assertLength(0, task.resolutionErrors); |
| 5907 } |
| 5908 |
| 5909 void test_getSource() { |
| 5910 Source source = new TestSource('test.dart', ''); |
| 5911 ResolveHtmlTask task = new ResolveHtmlTask(null, source, 0, null); |
| 5912 JUnitTestCase.assertSame(source, task.source); |
| 5913 } |
| 5914 |
| 5915 void test_perform_exception() { |
| 5916 Source source = new TestSource(); |
| 5917 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 5918 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 5919 ResolveHtmlTask task = new ResolveHtmlTask(context, source, 0, null); |
| 5920 task.perform(new ResolveHtmlTaskTestTV_perform_exception()); |
| 5921 } |
| 5922 |
| 5923 void test_perform_valid() { |
| 5924 int modificationStamp = 73; |
| 5925 String content = EngineTestCase.createSource([ |
| 5926 "<html>", |
| 5927 "<head>", |
| 5928 " <script type='application/dart'>", |
| 5929 " void f() { x = 0; }", |
| 5930 " </script>", |
| 5931 "</head>", |
| 5932 "<body>", |
| 5933 "</body>", |
| 5934 "</html>"]); |
| 5935 Source source = new TestSource("/test.html", content); |
| 5936 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 5937 ParseHtmlTask parseTask = new ParseHtmlTask(context, source, modificationSta
mp, content); |
| 5938 parseTask.perform(new ResolveHtmlTaskTestTV_perform_valid_2()); |
| 5939 ResolveHtmlTask task = new ResolveHtmlTask(context, source, parseTask.modifi
cationTime, parseTask.htmlUnit); |
| 5940 task.perform(new ResolveHtmlTaskTestTV_perform_valid(modificationStamp, sour
ce)); |
| 5941 } |
| 5942 |
| 5943 static dartSuite() { |
| 5944 _ut.group('ResolveHtmlTaskTest', () { |
| 5945 _ut.test('test_accept', () { |
| 5946 final __test = new ResolveHtmlTaskTest(); |
| 5947 runJUnitTest(__test, __test.test_accept); |
| 5948 }); |
| 5949 _ut.test('test_getElement', () { |
| 5950 final __test = new ResolveHtmlTaskTest(); |
| 5951 runJUnitTest(__test, __test.test_getElement); |
| 5952 }); |
| 5953 _ut.test('test_getException', () { |
| 5954 final __test = new ResolveHtmlTaskTest(); |
| 5955 runJUnitTest(__test, __test.test_getException); |
| 5956 }); |
| 5957 _ut.test('test_getModificationTime', () { |
| 5958 final __test = new ResolveHtmlTaskTest(); |
| 5959 runJUnitTest(__test, __test.test_getModificationTime); |
| 5960 }); |
| 5961 _ut.test('test_getResolutionErrors', () { |
| 5962 final __test = new ResolveHtmlTaskTest(); |
| 5963 runJUnitTest(__test, __test.test_getResolutionErrors); |
| 5964 }); |
| 5965 _ut.test('test_getSource', () { |
| 5966 final __test = new ResolveHtmlTaskTest(); |
| 5967 runJUnitTest(__test, __test.test_getSource); |
| 5968 }); |
| 5969 _ut.test('test_perform_exception', () { |
| 5970 final __test = new ResolveHtmlTaskTest(); |
| 5971 runJUnitTest(__test, __test.test_perform_exception); |
| 5972 }); |
| 5973 _ut.test('test_perform_valid', () { |
| 5974 final __test = new ResolveHtmlTaskTest(); |
| 5975 runJUnitTest(__test, __test.test_perform_valid); |
| 5976 }); |
| 5977 }); |
| 5978 } |
| 5979 } |
| 5980 |
| 5981 |
| 5982 class ResolveHtmlTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 5983 @override |
| 5984 bool visitResolveHtmlTask(ResolveHtmlTask task) => true; |
| 5985 } |
| 5986 |
| 5987 |
| 5988 class ResolveHtmlTaskTestTV_perform_exception extends TestTaskVisitor<bool> { |
| 5989 @override |
| 5990 bool visitResolveHtmlTask(ResolveHtmlTask task) { |
| 5991 JUnitTestCase.assertNotNull(task.exception); |
| 5992 return true; |
| 5993 } |
| 5994 } |
| 5995 |
| 5996 |
| 5997 class ResolveHtmlTaskTestTV_perform_valid extends TestTaskVisitor<Object> { |
| 5998 int modificationStamp; |
| 5999 Source source; |
| 6000 ResolveHtmlTaskTestTV_perform_valid(this.modificationStamp, this.source); |
| 6001 @override |
| 6002 Object visitResolveHtmlTask(ResolveHtmlTask task) { |
| 6003 CaughtException exception = task.exception; |
| 6004 if (exception != null) { |
| 6005 throw exception; |
| 6006 } |
| 6007 JUnitTestCase.assertNotNull(task.element); |
| 6008 JUnitTestCase.assertEquals(modificationStamp, task.modificationTime); |
| 6009 EngineTestCase.assertLength(1, task.resolutionErrors); |
| 6010 JUnitTestCase.assertSame(source, task.source); |
| 6011 return null; |
| 6012 } |
| 6013 } |
| 6014 |
| 6015 |
| 6016 class ResolveHtmlTaskTestTV_perform_valid_2 extends TestTaskVisitor<Object> { |
| 6017 @override |
| 6018 Object visitParseHtmlTask(ParseHtmlTask task) => null; |
| 6019 } |
| 6020 |
| 6021 |
| 6022 class ScanDartTaskTest extends EngineTestCase { |
| 6023 void test_accept() { |
| 6024 ScanDartTask task = new ScanDartTask(null, null, 0, null); |
| 6025 JUnitTestCase.assertTrue(task.accept(new ScanDartTaskTestTV_accept())); |
| 6026 } |
| 6027 |
| 6028 void test_getErrors() { |
| 6029 ScanDartTask task = new ScanDartTask(null, null, 0, null); |
| 6030 EngineTestCase.assertLength(0, task.errors); |
| 6031 } |
| 6032 |
| 6033 void test_getException() { |
| 6034 ScanDartTask task = new ScanDartTask(null, null, 0, null); |
| 6035 JUnitTestCase.assertNull(task.exception); |
| 6036 } |
| 6037 |
| 6038 void test_getLineInfo() { |
| 6039 ScanDartTask task = new ScanDartTask(null, null, 0, null); |
| 6040 JUnitTestCase.assertNull(task.lineInfo); |
| 6041 } |
| 6042 |
| 6043 void test_getModificationTime() { |
| 6044 ScanDartTask task = new ScanDartTask(null, null, 0, null); |
| 6045 JUnitTestCase.assertEquals(0, task.modificationTime); |
| 6046 } |
| 6047 |
| 6048 void test_getSource() { |
| 6049 Source source = new TestSource('test.dart', ''); |
| 6050 ScanDartTask task = new ScanDartTask(null, source, 0, null); |
| 6051 JUnitTestCase.assertSame(source, task.source); |
| 6052 } |
| 6053 |
| 6054 void test_perform_valid() { |
| 6055 String content = 'class A {}'; |
| 6056 Source source = new TestSource('test.dart', content); |
| 6057 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 6058 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 6059 ScanDartTask task = new ScanDartTask(context, source, source.modificationSta
mp, content); |
| 6060 task.perform(new ScanDartTaskTestTV_perform_valid(context, source)); |
| 6061 } |
| 6062 |
| 6063 static dartSuite() { |
| 6064 _ut.group('ScanDartTaskTest', () { |
| 6065 _ut.test('test_accept', () { |
| 6066 final __test = new ScanDartTaskTest(); |
| 6067 runJUnitTest(__test, __test.test_accept); |
| 6068 }); |
| 6069 _ut.test('test_getErrors', () { |
| 6070 final __test = new ScanDartTaskTest(); |
| 6071 runJUnitTest(__test, __test.test_getErrors); |
| 6072 }); |
| 6073 _ut.test('test_getException', () { |
| 6074 final __test = new ScanDartTaskTest(); |
| 6075 runJUnitTest(__test, __test.test_getException); |
| 6076 }); |
| 6077 _ut.test('test_getLineInfo', () { |
| 6078 final __test = new ScanDartTaskTest(); |
| 6079 runJUnitTest(__test, __test.test_getLineInfo); |
| 6080 }); |
| 6081 _ut.test('test_getModificationTime', () { |
| 6082 final __test = new ScanDartTaskTest(); |
| 6083 runJUnitTest(__test, __test.test_getModificationTime); |
| 6084 }); |
| 6085 _ut.test('test_getSource', () { |
| 6086 final __test = new ScanDartTaskTest(); |
| 6087 runJUnitTest(__test, __test.test_getSource); |
| 6088 }); |
| 6089 _ut.test('test_perform_valid', () { |
| 6090 final __test = new ScanDartTaskTest(); |
| 6091 runJUnitTest(__test, __test.test_perform_valid); |
| 6092 }); |
| 6093 }); |
| 6094 } |
| 6095 } |
| 6096 |
| 6097 |
| 6098 class ScanDartTaskTestTV_accept extends TestTaskVisitor<bool> { |
| 6099 @override |
| 6100 bool visitScanDartTask(ScanDartTask task) => true; |
| 6101 } |
| 6102 |
| 6103 |
| 6104 class ScanDartTaskTestTV_perform_valid extends TestTaskVisitor<bool> { |
| 6105 InternalAnalysisContext context; |
| 6106 Source source; |
| 6107 ScanDartTaskTestTV_perform_valid(this.context, this.source); |
| 6108 @override |
| 6109 bool visitScanDartTask(ScanDartTask task) { |
| 6110 CaughtException exception = task.exception; |
| 6111 if (exception != null) { |
| 6112 throw exception; |
| 6113 } |
| 6114 JUnitTestCase.assertNotNull(task.tokenStream); |
| 6115 EngineTestCase.assertLength(0, task.errors); |
| 6116 JUnitTestCase.assertNotNull(task.lineInfo); |
| 6117 JUnitTestCase.assertEquals(context.getModificationStamp(source), task.modifi
cationTime); |
| 6118 JUnitTestCase.assertSame(source, task.source); |
| 6119 return true; |
| 6120 } |
| 6121 } |
| 6122 |
| 6123 |
| 6124 class SdkCachePartitionTest extends EngineTestCase { |
| 6125 void test_contains_false() { |
| 6126 SdkCachePartition partition = new SdkCachePartition(null, 8); |
| 6127 Source source = new TestSource(); |
| 6128 JUnitTestCase.assertFalse(partition.contains(source)); |
| 6129 } |
| 6130 |
| 6131 void test_contains_true() { |
| 6132 SdkCachePartition partition = new SdkCachePartition(null, 8); |
| 6133 SourceFactory factory = new SourceFactory([new DartUriResolver(DirectoryBase
dDartSdk.defaultSdk)]); |
| 6134 Source source = factory.forUri("dart:core"); |
| 6135 JUnitTestCase.assertTrue(partition.contains(source)); |
| 6136 } |
| 6137 |
| 6138 void test_creation() { |
| 6139 JUnitTestCase.assertNotNull(new SdkCachePartition(null, 8)); |
| 6140 } |
| 6141 |
| 6142 static dartSuite() { |
| 6143 _ut.group('SdkCachePartitionTest', () { |
| 6144 _ut.test('test_contains_false', () { |
| 6145 final __test = new SdkCachePartitionTest(); |
| 6146 runJUnitTest(__test, __test.test_contains_false); |
| 6147 }); |
| 6148 _ut.test('test_contains_true', () { |
| 6149 final __test = new SdkCachePartitionTest(); |
| 6150 runJUnitTest(__test, __test.test_contains_true); |
| 6151 }); |
| 6152 _ut.test('test_creation', () { |
| 6153 final __test = new SdkCachePartitionTest(); |
| 6154 runJUnitTest(__test, __test.test_creation); |
| 6155 }); |
| 6156 }); |
| 6157 } |
| 6158 } |
| 6159 |
| 6160 |
| 6161 /** |
| 6162 * Instances of the class `TestAnalysisContext` implement an analysis context in
which every |
| 6163 * method will cause a test to fail when invoked. |
| 6164 */ |
| 6165 class TestAnalysisContext implements InternalAnalysisContext { |
| 6166 @override |
| 6167 AnalysisOptions get analysisOptions { |
| 6168 JUnitTestCase.fail("Unexpected invocation of getAnalysisOptions"); |
| 6169 return null; |
| 6170 } |
| 6171 @override |
| 6172 void set analysisOptions(AnalysisOptions options) { |
| 6173 JUnitTestCase.fail("Unexpected invocation of setAnalysisOptions"); |
| 6174 } |
| 6175 @override |
| 6176 void set analysisPriorityOrder(List<Source> sources) { |
| 6177 JUnitTestCase.fail("Unexpected invocation of setAnalysisPriorityOrder"); |
| 6178 } |
| 6179 @override |
| 6180 DeclaredVariables get declaredVariables { |
| 6181 JUnitTestCase.fail("Unexpected invocation of getDeclaredVariables"); |
| 6182 return null; |
| 6183 } |
| 6184 @override |
| 6185 List<Source> get htmlSources { |
| 6186 JUnitTestCase.fail("Unexpected invocation of getHtmlSources"); |
| 6187 return null; |
| 6188 } |
| 6189 @override |
| 6190 bool get isDisposed { |
| 6191 JUnitTestCase.fail("Unexpected invocation of isDisposed"); |
| 6192 return false; |
| 6193 } |
| 6194 @override |
| 6195 List<Source> get launchableClientLibrarySources { |
| 6196 JUnitTestCase.fail("Unexpected invocation of getLaunchableClientLibrarySourc
es"); |
| 6197 return null; |
| 6198 } |
| 6199 @override |
| 6200 List<Source> get launchableServerLibrarySources { |
| 6201 JUnitTestCase.fail("Unexpected invocation of getLaunchableServerLibrarySourc
es"); |
| 6202 return null; |
| 6203 } |
| 6204 @override |
| 6205 List<Source> get librarySources { |
| 6206 JUnitTestCase.fail("Unexpected invocation of getLibrarySources"); |
| 6207 return null; |
| 6208 } |
| 6209 @override |
| 6210 List<Source> get prioritySources { |
| 6211 JUnitTestCase.fail("Unexpected invocation of getPrioritySources"); |
| 6212 return null; |
| 6213 } |
| 6214 @override |
| 6215 List<Source> get refactoringUnsafeSources { |
| 6216 JUnitTestCase.fail("Unexpected invocation of getRefactoringUnsafeSources"); |
| 6217 return null; |
| 6218 } |
| 6219 @override |
| 6220 SourceFactory get sourceFactory { |
| 6221 JUnitTestCase.fail("Unexpected invocation of getSourceFactory"); |
| 6222 return null; |
| 6223 } |
| 6224 @override |
| 6225 void set sourceFactory(SourceFactory factory) { |
| 6226 JUnitTestCase.fail("Unexpected invocation of setSourceFactory"); |
| 6227 } |
| 6228 @override |
| 6229 AnalysisContextStatistics get statistics { |
| 6230 JUnitTestCase.fail("Unexpected invocation of getStatistics"); |
| 6231 return null; |
| 6232 } |
| 6233 @override |
| 6234 TypeProvider get typeProvider { |
| 6235 JUnitTestCase.fail("Unexpected invocation of getTypeProvider"); |
| 6236 return null; |
| 6237 } |
| 6238 @override |
| 6239 void addListener(AnalysisListener listener) { |
| 6240 JUnitTestCase.fail("Unexpected invocation of addListener"); |
| 6241 } |
| 6242 @override |
| 6243 void addSourceInfo(Source source, SourceEntry info) { |
| 6244 JUnitTestCase.fail("Unexpected invocation of addSourceInfo"); |
| 6245 } |
| 6246 @override |
| 6247 void applyAnalysisDelta(AnalysisDelta delta) { |
| 6248 JUnitTestCase.fail("Unexpected invocation of applyAnalysisDelta"); |
| 6249 } |
| 6250 @override |
| 6251 void applyChanges(ChangeSet changeSet) { |
| 6252 JUnitTestCase.fail("Unexpected invocation of applyChanges"); |
| 6253 } |
| 6254 @override |
| 6255 String computeDocumentationComment(Element element) { |
| 6256 JUnitTestCase.fail("Unexpected invocation of computeDocumentationComment"); |
| 6257 return null; |
| 6258 } |
| 6259 @override |
| 6260 List<AnalysisError> computeErrors(Source source) { |
| 6261 JUnitTestCase.fail("Unexpected invocation of computeErrors"); |
| 6262 return null; |
| 6263 } |
| 6264 @override |
| 6265 List<Source> computeExportedLibraries(Source source) { |
| 6266 JUnitTestCase.fail("Unexpected invocation of computeExportedLibraries"); |
| 6267 return null; |
| 6268 } |
| 6269 @override |
| 6270 HtmlElement computeHtmlElement(Source source) { |
| 6271 JUnitTestCase.fail("Unexpected invocation of computeHtmlElement"); |
| 6272 return null; |
| 6273 } |
| 6274 @override |
| 6275 List<Source> computeImportedLibraries(Source source) { |
| 6276 JUnitTestCase.fail("Unexpected invocation of computeImportedLibraries"); |
| 6277 return null; |
| 6278 } |
| 6279 @override |
| 6280 SourceKind computeKindOf(Source source) { |
| 6281 JUnitTestCase.fail("Unexpected invocation of computeKindOf"); |
| 6282 return null; |
| 6283 } |
| 6284 @override |
| 6285 LibraryElement computeLibraryElement(Source source) { |
| 6286 JUnitTestCase.fail("Unexpected invocation of computeLibraryElement"); |
| 6287 return null; |
| 6288 } |
| 6289 @override |
| 6290 LineInfo computeLineInfo(Source source) { |
| 6291 JUnitTestCase.fail("Unexpected invocation of computeLineInfo"); |
| 6292 return null; |
| 6293 } |
| 6294 @override |
| 6295 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { |
| 6296 JUnitTestCase.fail("Unexpected invocation of computeResolvableCompilationUni
t"); |
| 6297 return null; |
| 6298 } |
| 6299 @override |
| 6300 void dispose() { |
| 6301 JUnitTestCase.fail("Unexpected invocation of dispose"); |
| 6302 } |
| 6303 @override |
| 6304 bool exists(Source source) { |
| 6305 JUnitTestCase.fail("Unexpected invocation of exists"); |
| 6306 return false; |
| 6307 } |
| 6308 @override |
| 6309 AnalysisContext extractContext(SourceContainer container) { |
| 6310 JUnitTestCase.fail("Unexpected invocation of extractContext"); |
| 6311 return null; |
| 6312 } |
| 6313 @override |
| 6314 InternalAnalysisContext extractContextInto(SourceContainer container, Internal
AnalysisContext newContext) { |
| 6315 JUnitTestCase.fail("Unexpected invocation of extractContextInto"); |
| 6316 return null; |
| 6317 } |
| 6318 @override |
| 6319 AngularApplication getAngularApplicationWithHtml(Source htmlSource) { |
| 6320 JUnitTestCase.fail("Unexpected invocation of getAngularApplicationWithHtml")
; |
| 6321 return null; |
| 6322 } |
| 6323 @override |
| 6324 CompilationUnitElement getCompilationUnitElement(Source unitSource, Source lib
rarySource) { |
| 6325 JUnitTestCase.fail("Unexpected invocation of getCompilationUnitElement"); |
| 6326 return null; |
| 6327 } |
| 6328 @override |
| 6329 TimestampedData<String> getContents(Source source) { |
| 6330 JUnitTestCase.fail("Unexpected invocation of getContents"); |
| 6331 return null; |
| 6332 } |
| 6333 @override |
| 6334 InternalAnalysisContext getContextFor(Source source) { |
| 6335 JUnitTestCase.fail("Unexpected invocation of getContextFor"); |
| 6336 return null; |
| 6337 } |
| 6338 @override |
| 6339 Element getElement(ElementLocation location) { |
| 6340 JUnitTestCase.fail("Unexpected invocation of getElement"); |
| 6341 return null; |
| 6342 } |
| 6343 @override |
| 6344 AnalysisErrorInfo getErrors(Source source) { |
| 6345 JUnitTestCase.fail("Unexpected invocation of getErrors"); |
| 6346 return null; |
| 6347 } |
| 6348 @override |
| 6349 HtmlElement getHtmlElement(Source source) { |
| 6350 JUnitTestCase.fail("Unexpected invocation of getHtmlElement"); |
| 6351 return null; |
| 6352 } |
| 6353 @override |
| 6354 List<Source> getHtmlFilesReferencing(Source source) { |
| 6355 JUnitTestCase.fail("Unexpected invocation of getHtmlFilesReferencing"); |
| 6356 return null; |
| 6357 } |
| 6358 @override |
| 6359 SourceKind getKindOf(Source source) { |
| 6360 JUnitTestCase.fail("Unexpected invocation of getKindOf"); |
| 6361 return null; |
| 6362 } |
| 6363 @override |
| 6364 List<Source> getLibrariesContaining(Source source) { |
| 6365 JUnitTestCase.fail("Unexpected invocation of getLibrariesContaining"); |
| 6366 return null; |
| 6367 } |
| 6368 @override |
| 6369 List<Source> getLibrariesDependingOn(Source librarySource) { |
| 6370 JUnitTestCase.fail("Unexpected invocation of getLibrariesDependingOn"); |
| 6371 return null; |
| 6372 } |
| 6373 @override |
| 6374 List<Source> getLibrariesReferencedFromHtml(Source htmlSource) { |
| 6375 JUnitTestCase.fail("Unexpected invocation of getLibrariesReferencedFromHtml"
); |
| 6376 return null; |
| 6377 } |
| 6378 @override |
| 6379 LibraryElement getLibraryElement(Source source) { |
| 6380 JUnitTestCase.fail("Unexpected invocation of getLibraryElement"); |
| 6381 return null; |
| 6382 } |
| 6383 @override |
| 6384 LineInfo getLineInfo(Source source) { |
| 6385 JUnitTestCase.fail("Unexpected invocation of getLineInfo"); |
| 6386 return null; |
| 6387 } |
| 6388 @override |
| 6389 int getModificationStamp(Source source) { |
| 6390 JUnitTestCase.fail("Unexpected invocation of getModificationStamp"); |
| 6391 return 0; |
| 6392 } |
| 6393 @override |
| 6394 Namespace getPublicNamespace(LibraryElement library) { |
| 6395 JUnitTestCase.fail("Unexpected invocation of getPublicNamespace"); |
| 6396 return null; |
| 6397 } |
| 6398 @override |
| 6399 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { |
| 6400 JUnitTestCase.fail("Unexpected invocation of getResolvedCompilationUnit"); |
| 6401 return null; |
| 6402 } |
| 6403 @override |
| 6404 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { |
| 6405 JUnitTestCase.fail("Unexpected invocation of getResolvedCompilationUnit"); |
| 6406 return null; |
| 6407 } |
| 6408 @override |
| 6409 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { |
| 6410 JUnitTestCase.fail("Unexpected invocation of getResolvedHtmlUnit"); |
| 6411 return null; |
| 6412 } |
| 6413 @override |
| 6414 bool isClientLibrary(Source librarySource) { |
| 6415 JUnitTestCase.fail("Unexpected invocation of isClientLibrary"); |
| 6416 return false; |
| 6417 } |
| 6418 @override |
| 6419 bool isServerLibrary(Source librarySource) { |
| 6420 JUnitTestCase.fail("Unexpected invocation of isServerLibrary"); |
| 6421 return false; |
| 6422 } |
| 6423 @override |
| 6424 void mergeContext(AnalysisContext context) { |
| 6425 JUnitTestCase.fail("Unexpected invocation of mergeContext"); |
| 6426 } |
| 6427 @override |
| 6428 CompilationUnit parseCompilationUnit(Source source) { |
| 6429 JUnitTestCase.fail("Unexpected invocation of parseCompilationUnit"); |
| 6430 return null; |
| 6431 } |
| 6432 @override |
| 6433 ht.HtmlUnit parseHtmlUnit(Source source) { |
| 6434 JUnitTestCase.fail("Unexpected invocation of parseHtmlUnit"); |
| 6435 return null; |
| 6436 } |
| 6437 @override |
| 6438 AnalysisResult performAnalysisTask() { |
| 6439 JUnitTestCase.fail("Unexpected invocation of performAnalysisTask"); |
| 6440 return null; |
| 6441 } |
| 6442 @override |
| 6443 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { |
| 6444 JUnitTestCase.fail("Unexpected invocation of recordLibraryElements"); |
| 6445 } |
| 6446 @override |
| 6447 void removeListener(AnalysisListener listener) { |
| 6448 JUnitTestCase.fail("Unexpected invocation of removeListener"); |
| 6449 } |
| 6450 @override |
| 6451 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { |
| 6452 JUnitTestCase.fail("Unexpected invocation of resolveCompilationUnit"); |
| 6453 return null; |
| 6454 } |
| 6455 @override |
| 6456 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) { |
| 6457 JUnitTestCase.fail("Unexpected invocation of resolveCompilationUnit"); |
| 6458 return null; |
| 6459 } |
| 6460 @override |
| 6461 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { |
| 6462 JUnitTestCase.fail("Unexpected invocation of resolveHtmlUnit"); |
| 6463 return null; |
| 6464 } |
| 6465 @override |
| 6466 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { |
| 6467 JUnitTestCase.fail("Unexpected invocation of setChangedContents"); |
| 6468 } |
| 6469 @override |
| 6470 void setContents(Source source, String contents) { |
| 6471 JUnitTestCase.fail("Unexpected invocation of setContents"); |
| 6472 } |
| 6473 } |
| 6474 |
| 6475 |
| 6476 class TestAnalysisContext_test_addSourceInfo extends TestAnalysisContext { |
| 6477 List<bool> invoked; |
| 6478 TestAnalysisContext_test_addSourceInfo(this.invoked); |
| 6479 @override |
| 6480 void addSourceInfo(Source source, SourceEntry info) { |
| 6481 invoked[0] = true; |
| 6482 } |
| 6483 } |
| 6484 |
| 6485 |
| 6486 class TestAnalysisContext_test_applyChanges extends TestAnalysisContext { |
| 6487 List<bool> invoked; |
| 6488 TestAnalysisContext_test_applyChanges(this.invoked); |
| 6489 @override |
| 6490 void applyChanges(ChangeSet changeSet) { |
| 6491 invoked[0] = true; |
| 6492 } |
| 6493 } |
| 6494 |
| 6495 |
| 6496 class TestAnalysisContext_test_computeDocumentationComment extends TestAnalysisC
ontext { |
| 6497 List<bool> invoked; |
| 6498 TestAnalysisContext_test_computeDocumentationComment(this.invoked); |
| 6499 @override |
| 6500 String computeDocumentationComment(Element element) { |
| 6501 invoked[0] = true; |
| 6502 return null; |
| 6503 } |
| 6504 } |
| 6505 |
| 6506 |
| 6507 class TestAnalysisContext_test_computeErrors extends TestAnalysisContext { |
| 6508 List<bool> invoked; |
| 6509 TestAnalysisContext_test_computeErrors(this.invoked); |
| 6510 @override |
| 6511 List<AnalysisError> computeErrors(Source source) { |
| 6512 invoked[0] = true; |
| 6513 return AnalysisError.NO_ERRORS; |
| 6514 } |
| 6515 } |
| 6516 |
| 6517 |
| 6518 class TestAnalysisContext_test_computeExportedLibraries extends TestAnalysisCont
ext { |
| 6519 List<bool> invoked; |
| 6520 TestAnalysisContext_test_computeExportedLibraries(this.invoked); |
| 6521 @override |
| 6522 List<Source> computeExportedLibraries(Source source) { |
| 6523 invoked[0] = true; |
| 6524 return null; |
| 6525 } |
| 6526 } |
| 6527 |
| 6528 |
| 6529 class TestAnalysisContext_test_computeHtmlElement extends TestAnalysisContext { |
| 6530 List<bool> invoked; |
| 6531 TestAnalysisContext_test_computeHtmlElement(this.invoked); |
| 6532 @override |
| 6533 HtmlElement computeHtmlElement(Source source) { |
| 6534 invoked[0] = true; |
| 6535 return null; |
| 6536 } |
| 6537 } |
| 6538 |
| 6539 |
| 6540 class TestAnalysisContext_test_computeImportedLibraries extends TestAnalysisCont
ext { |
| 6541 List<bool> invoked; |
| 6542 TestAnalysisContext_test_computeImportedLibraries(this.invoked); |
| 6543 @override |
| 6544 List<Source> computeImportedLibraries(Source source) { |
| 6545 invoked[0] = true; |
| 6546 return null; |
| 6547 } |
| 6548 } |
| 6549 |
| 6550 |
| 6551 class TestAnalysisContext_test_computeKindOf extends TestAnalysisContext { |
| 6552 List<bool> invoked; |
| 6553 TestAnalysisContext_test_computeKindOf(this.invoked); |
| 6554 @override |
| 6555 SourceKind computeKindOf(Source source) { |
| 6556 invoked[0] = true; |
| 6557 return null; |
| 6558 } |
| 6559 } |
| 6560 |
| 6561 |
| 6562 class TestAnalysisContext_test_computeLibraryElement extends TestAnalysisContext
{ |
| 6563 List<bool> invoked; |
| 6564 TestAnalysisContext_test_computeLibraryElement(this.invoked); |
| 6565 @override |
| 6566 LibraryElement computeLibraryElement(Source source) { |
| 6567 invoked[0] = true; |
| 6568 return null; |
| 6569 } |
| 6570 } |
| 6571 |
| 6572 |
| 6573 class TestAnalysisContext_test_computeLineInfo extends TestAnalysisContext { |
| 6574 List<bool> invoked; |
| 6575 TestAnalysisContext_test_computeLineInfo(this.invoked); |
| 6576 @override |
| 6577 LineInfo computeLineInfo(Source source) { |
| 6578 invoked[0] = true; |
| 6579 return null; |
| 6580 } |
| 6581 } |
| 6582 |
| 6583 |
| 6584 class TestAnalysisContext_test_computeResolvableCompilationUnit extends TestAnal
ysisContext { |
| 6585 List<bool> invoked; |
| 6586 TestAnalysisContext_test_computeResolvableCompilationUnit(this.invoked); |
| 6587 @override |
| 6588 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { |
| 6589 invoked[0] = true; |
| 6590 return null; |
| 6591 } |
| 6592 } |
| 6593 |
| 6594 |
| 6595 class TestAnalysisContext_test_dispose extends TestAnalysisContext { |
| 6596 List<bool> invoked; |
| 6597 TestAnalysisContext_test_dispose(this.invoked); |
| 6598 @override |
| 6599 void dispose() { |
| 6600 invoked[0] = true; |
| 6601 } |
| 6602 } |
| 6603 |
| 6604 |
| 6605 class TestAnalysisContext_test_exists extends TestAnalysisContext { |
| 6606 List<bool> invoked; |
| 6607 TestAnalysisContext_test_exists(this.invoked); |
| 6608 @override |
| 6609 bool exists(Source source) { |
| 6610 invoked[0] = true; |
| 6611 return false; |
| 6612 } |
| 6613 } |
| 6614 |
| 6615 |
| 6616 class TestAnalysisContext_test_extractContext extends TestAnalysisContext { |
| 6617 List<bool> invoked; |
| 6618 TestAnalysisContext_test_extractContext(this.invoked); |
| 6619 @override |
| 6620 InternalAnalysisContext extractContextInto(SourceContainer container, Internal
AnalysisContext newContext) { |
| 6621 invoked[0] = true; |
| 6622 return null; |
| 6623 } |
| 6624 } |
| 6625 |
| 6626 |
| 6627 class TestAnalysisContext_test_extractContextInto extends TestAnalysisContext { |
| 6628 List<bool> invoked; |
| 6629 TestAnalysisContext_test_extractContextInto(this.invoked); |
| 6630 @override |
| 6631 InternalAnalysisContext extractContextInto(SourceContainer container, Internal
AnalysisContext newContext) { |
| 6632 invoked[0] = true; |
| 6633 return null; |
| 6634 } |
| 6635 } |
| 6636 |
| 6637 |
| 6638 class TestAnalysisContext_test_getAnalysisOptions extends TestAnalysisContext { |
| 6639 List<bool> invoked; |
| 6640 TestAnalysisContext_test_getAnalysisOptions(this.invoked); |
| 6641 @override |
| 6642 AnalysisOptions get analysisOptions { |
| 6643 invoked[0] = true; |
| 6644 return null; |
| 6645 } |
| 6646 } |
| 6647 |
| 6648 |
| 6649 class TestAnalysisContext_test_getAngularApplicationWithHtml extends TestAnalysi
sContext { |
| 6650 List<bool> invoked; |
| 6651 TestAnalysisContext_test_getAngularApplicationWithHtml(this.invoked); |
| 6652 @override |
| 6653 AngularApplication getAngularApplicationWithHtml(Source htmlSource) { |
| 6654 invoked[0] = true; |
| 6655 return null; |
| 6656 } |
| 6657 } |
| 6658 |
| 6659 |
| 6660 class TestAnalysisContext_test_getCompilationUnitElement extends TestAnalysisCon
text { |
| 6661 List<bool> invoked; |
| 6662 TestAnalysisContext_test_getCompilationUnitElement(this.invoked); |
| 6663 @override |
| 6664 CompilationUnitElement getCompilationUnitElement(Source unitSource, Source lib
rarySource) { |
| 6665 invoked[0] = true; |
| 6666 return null; |
| 6667 } |
| 6668 } |
| 6669 |
| 6670 |
| 6671 class TestAnalysisContext_test_getContents extends TestAnalysisContext { |
| 6672 List<bool> invoked; |
| 6673 TestAnalysisContext_test_getContents(this.invoked); |
| 6674 @override |
| 6675 TimestampedData<String> getContents(Source source) { |
| 6676 invoked[0] = true; |
| 6677 return null; |
| 6678 } |
| 6679 } |
| 6680 |
| 6681 |
| 6682 class TestAnalysisContext_test_getElement extends TestAnalysisContext { |
| 6683 List<bool> invoked; |
| 6684 TestAnalysisContext_test_getElement(this.invoked); |
| 6685 @override |
| 6686 Element getElement(ElementLocation location) { |
| 6687 invoked[0] = true; |
| 6688 return null; |
| 6689 } |
| 6690 } |
| 6691 |
| 6692 |
| 6693 class TestAnalysisContext_test_getErrors extends TestAnalysisContext { |
| 6694 List<bool> invoked; |
| 6695 TestAnalysisContext_test_getErrors(this.invoked); |
| 6696 @override |
| 6697 AnalysisErrorInfo getErrors(Source source) { |
| 6698 invoked[0] = true; |
| 6699 return new AnalysisErrorInfoImpl(AnalysisError.NO_ERRORS, null); |
| 6700 } |
| 6701 } |
| 6702 |
| 6703 |
| 6704 class TestAnalysisContext_test_getHtmlElement extends TestAnalysisContext { |
| 6705 List<bool> invoked; |
| 6706 TestAnalysisContext_test_getHtmlElement(this.invoked); |
| 6707 @override |
| 6708 HtmlElement getHtmlElement(Source source) { |
| 6709 invoked[0] = true; |
| 6710 return null; |
| 6711 } |
| 6712 } |
| 6713 |
| 6714 |
| 6715 class TestAnalysisContext_test_getHtmlFilesReferencing extends TestAnalysisConte
xt { |
| 6716 List<bool> invoked; |
| 6717 TestAnalysisContext_test_getHtmlFilesReferencing(this.invoked); |
| 6718 @override |
| 6719 List<Source> getHtmlFilesReferencing(Source source) { |
| 6720 invoked[0] = true; |
| 6721 return Source.EMPTY_ARRAY; |
| 6722 } |
| 6723 } |
| 6724 |
| 6725 |
| 6726 class TestAnalysisContext_test_getHtmlSources extends TestAnalysisContext { |
| 6727 List<bool> invoked; |
| 6728 TestAnalysisContext_test_getHtmlSources(this.invoked); |
| 6729 @override |
| 6730 List<Source> get htmlSources { |
| 6731 invoked[0] = true; |
| 6732 return Source.EMPTY_ARRAY; |
| 6733 } |
| 6734 } |
| 6735 |
| 6736 |
| 6737 class TestAnalysisContext_test_getKindOf extends TestAnalysisContext { |
| 6738 List<bool> invoked; |
| 6739 TestAnalysisContext_test_getKindOf(this.invoked); |
| 6740 @override |
| 6741 SourceKind getKindOf(Source source) { |
| 6742 invoked[0] = true; |
| 6743 return null; |
| 6744 } |
| 6745 } |
| 6746 |
| 6747 |
| 6748 class TestAnalysisContext_test_getLaunchableClientLibrarySources extends TestAna
lysisContext { |
| 6749 List<bool> invoked; |
| 6750 TestAnalysisContext_test_getLaunchableClientLibrarySources(this.invoked); |
| 6751 @override |
| 6752 List<Source> get launchableClientLibrarySources { |
| 6753 invoked[0] = true; |
| 6754 return Source.EMPTY_ARRAY; |
| 6755 } |
| 6756 } |
| 6757 |
| 6758 |
| 6759 class TestAnalysisContext_test_getLaunchableServerLibrarySources extends TestAna
lysisContext { |
| 6760 List<bool> invoked; |
| 6761 TestAnalysisContext_test_getLaunchableServerLibrarySources(this.invoked); |
| 6762 @override |
| 6763 List<Source> get launchableServerLibrarySources { |
| 6764 invoked[0] = true; |
| 6765 return Source.EMPTY_ARRAY; |
| 6766 } |
| 6767 } |
| 6768 |
| 6769 |
| 6770 class TestAnalysisContext_test_getLibrariesContaining extends TestAnalysisContex
t { |
| 6771 List<bool> invoked; |
| 6772 TestAnalysisContext_test_getLibrariesContaining(this.invoked); |
| 6773 @override |
| 6774 List<Source> getLibrariesContaining(Source source) { |
| 6775 invoked[0] = true; |
| 6776 return Source.EMPTY_ARRAY; |
| 6777 } |
| 6778 } |
| 6779 |
| 6780 |
| 6781 class TestAnalysisContext_test_getLibrariesDependingOn extends TestAnalysisConte
xt { |
| 6782 List<bool> invoked; |
| 6783 TestAnalysisContext_test_getLibrariesDependingOn(this.invoked); |
| 6784 @override |
| 6785 List<Source> getLibrariesDependingOn(Source librarySource) { |
| 6786 invoked[0] = true; |
| 6787 return Source.EMPTY_ARRAY; |
| 6788 } |
| 6789 } |
| 6790 |
| 6791 |
| 6792 class TestAnalysisContext_test_getLibrariesReferencedFromHtml extends TestAnalys
isContext { |
| 6793 List<bool> invoked; |
| 6794 TestAnalysisContext_test_getLibrariesReferencedFromHtml(this.invoked); |
| 6795 @override |
| 6796 List<Source> getLibrariesReferencedFromHtml(Source htmlSource) { |
| 6797 invoked[0] = true; |
| 6798 return null; |
| 6799 } |
| 6800 } |
| 6801 |
| 6802 |
| 6803 class TestAnalysisContext_test_getLibraryElement extends TestAnalysisContext { |
| 6804 List<bool> invoked; |
| 6805 TestAnalysisContext_test_getLibraryElement(this.invoked); |
| 6806 @override |
| 6807 LibraryElement getLibraryElement(Source source) { |
| 6808 invoked[0] = true; |
| 6809 return null; |
| 6810 } |
| 6811 } |
| 6812 |
| 6813 |
| 6814 class TestAnalysisContext_test_getLibrarySources extends TestAnalysisContext { |
| 6815 List<bool> invoked; |
| 6816 TestAnalysisContext_test_getLibrarySources(this.invoked); |
| 6817 @override |
| 6818 List<Source> get librarySources { |
| 6819 invoked[0] = true; |
| 6820 return Source.EMPTY_ARRAY; |
| 6821 } |
| 6822 } |
| 6823 |
| 6824 |
| 6825 class TestAnalysisContext_test_getLineInfo extends TestAnalysisContext { |
| 6826 List<bool> invoked; |
| 6827 TestAnalysisContext_test_getLineInfo(this.invoked); |
| 6828 @override |
| 6829 LineInfo getLineInfo(Source source) { |
| 6830 invoked[0] = true; |
| 6831 return null; |
| 6832 } |
| 6833 } |
| 6834 |
| 6835 |
| 6836 class TestAnalysisContext_test_getModificationStamp extends TestAnalysisContext
{ |
| 6837 List<bool> invoked; |
| 6838 TestAnalysisContext_test_getModificationStamp(this.invoked); |
| 6839 @override |
| 6840 int getModificationStamp(Source source) { |
| 6841 invoked[0] = true; |
| 6842 return 0; |
| 6843 } |
| 6844 } |
| 6845 |
| 6846 |
| 6847 class TestAnalysisContext_test_getPublicNamespace extends TestAnalysisContext { |
| 6848 List<bool> invoked; |
| 6849 TestAnalysisContext_test_getPublicNamespace(this.invoked); |
| 6850 @override |
| 6851 Namespace getPublicNamespace(LibraryElement library) { |
| 6852 invoked[0] = true; |
| 6853 return null; |
| 6854 } |
| 6855 } |
| 6856 |
| 6857 |
| 6858 class TestAnalysisContext_test_getRefactoringUnsafeSources extends TestAnalysisC
ontext { |
| 6859 List<bool> invoked; |
| 6860 TestAnalysisContext_test_getRefactoringUnsafeSources(this.invoked); |
| 6861 @override |
| 6862 List<Source> get refactoringUnsafeSources { |
| 6863 invoked[0] = true; |
| 6864 return null; |
| 6865 } |
| 6866 } |
| 6867 |
| 6868 |
| 6869 class TestAnalysisContext_test_getResolvedCompilationUnit_element extends TestAn
alysisContext { |
| 6870 List<bool> invoked; |
| 6871 TestAnalysisContext_test_getResolvedCompilationUnit_element(this.invoked); |
| 6872 @override |
| 6873 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { |
| 6874 invoked[0] = true; |
| 6875 return null; |
| 6876 } |
| 6877 } |
| 6878 |
| 6879 |
| 6880 class TestAnalysisContext_test_getResolvedCompilationUnit_source extends TestAna
lysisContext { |
| 6881 List<bool> invoked; |
| 6882 TestAnalysisContext_test_getResolvedCompilationUnit_source(this.invoked); |
| 6883 @override |
| 6884 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { |
| 6885 invoked[0] = true; |
| 6886 return null; |
| 6887 } |
| 6888 } |
| 6889 |
| 6890 |
| 6891 class TestAnalysisContext_test_getResolvedHtmlUnit extends TestAnalysisContext { |
| 6892 List<bool> invoked; |
| 6893 TestAnalysisContext_test_getResolvedHtmlUnit(this.invoked); |
| 6894 @override |
| 6895 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { |
| 6896 invoked[0] = true; |
| 6897 return null; |
| 6898 } |
| 6899 } |
| 6900 |
| 6901 |
| 6902 class TestAnalysisContext_test_getSourceFactory extends TestAnalysisContext { |
| 6903 List<bool> invoked; |
| 6904 TestAnalysisContext_test_getSourceFactory(this.invoked); |
| 6905 @override |
| 6906 SourceFactory get sourceFactory { |
| 6907 invoked[0] = true; |
| 6908 return null; |
| 6909 } |
| 6910 } |
| 6911 |
| 6912 |
| 6913 class TestAnalysisContext_test_getStatistics extends TestAnalysisContext { |
| 6914 List<bool> invoked; |
| 6915 TestAnalysisContext_test_getStatistics(this.invoked); |
| 6916 @override |
| 6917 AnalysisContextStatistics get statistics { |
| 6918 invoked[0] = true; |
| 6919 return null; |
| 6920 } |
| 6921 } |
| 6922 |
| 6923 |
| 6924 class TestAnalysisContext_test_getTypeProvider extends TestAnalysisContext { |
| 6925 List<bool> invoked; |
| 6926 TestAnalysisContext_test_getTypeProvider(this.invoked); |
| 6927 @override |
| 6928 TypeProvider get typeProvider { |
| 6929 invoked[0] = true; |
| 6930 return null; |
| 6931 } |
| 6932 } |
| 6933 |
| 6934 |
| 6935 class TestAnalysisContext_test_isClientLibrary extends TestAnalysisContext { |
| 6936 List<bool> invoked; |
| 6937 TestAnalysisContext_test_isClientLibrary(this.invoked); |
| 6938 @override |
| 6939 bool isClientLibrary(Source librarySource) { |
| 6940 invoked[0] = true; |
| 6941 return false; |
| 6942 } |
| 6943 } |
| 6944 |
| 6945 |
| 6946 class TestAnalysisContext_test_isDisposed extends TestAnalysisContext { |
| 6947 List<bool> invoked; |
| 6948 TestAnalysisContext_test_isDisposed(this.invoked); |
| 6949 @override |
| 6950 bool get isDisposed { |
| 6951 invoked[0] = true; |
| 6952 return false; |
| 6953 } |
| 6954 } |
| 6955 |
| 6956 |
| 6957 class TestAnalysisContext_test_isServerLibrary extends TestAnalysisContext { |
| 6958 List<bool> invoked; |
| 6959 TestAnalysisContext_test_isServerLibrary(this.invoked); |
| 6960 @override |
| 6961 bool isServerLibrary(Source librarySource) { |
| 6962 invoked[0] = true; |
| 6963 return false; |
| 6964 } |
| 6965 } |
| 6966 |
| 6967 |
| 6968 class TestAnalysisContext_test_mergeContext extends TestAnalysisContext { |
| 6969 List<bool> invoked; |
| 6970 TestAnalysisContext_test_mergeContext(this.invoked); |
| 6971 @override |
| 6972 void mergeContext(AnalysisContext context) { |
| 6973 invoked[0] = true; |
| 6974 } |
| 6975 } |
| 6976 |
| 6977 |
| 6978 class TestAnalysisContext_test_parseCompilationUnit extends TestAnalysisContext
{ |
| 6979 List<bool> invoked; |
| 6980 TestAnalysisContext_test_parseCompilationUnit(this.invoked); |
| 6981 @override |
| 6982 CompilationUnit parseCompilationUnit(Source source) { |
| 6983 invoked[0] = true; |
| 6984 return null; |
| 6985 } |
| 6986 } |
| 6987 |
| 6988 |
| 6989 class TestAnalysisContext_test_parseHtmlUnit extends TestAnalysisContext { |
| 6990 List<bool> invoked; |
| 6991 TestAnalysisContext_test_parseHtmlUnit(this.invoked); |
| 6992 @override |
| 6993 ht.HtmlUnit parseHtmlUnit(Source source) { |
| 6994 invoked[0] = true; |
| 6995 return null; |
| 6996 } |
| 6997 } |
| 6998 |
| 6999 |
| 7000 class TestAnalysisContext_test_performAnalysisTask extends TestAnalysisContext { |
| 7001 List<bool> invoked; |
| 7002 TestAnalysisContext_test_performAnalysisTask(this.invoked); |
| 7003 @override |
| 7004 AnalysisResult performAnalysisTask() { |
| 7005 invoked[0] = true; |
| 7006 return new AnalysisResult(new List<ChangeNotice>(0), 0, null, 0); |
| 7007 } |
| 7008 } |
| 7009 |
| 7010 |
| 7011 class TestAnalysisContext_test_recordLibraryElements extends TestAnalysisContext
{ |
| 7012 List<bool> invoked; |
| 7013 TestAnalysisContext_test_recordLibraryElements(this.invoked); |
| 7014 @override |
| 7015 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { |
| 7016 invoked[0] = true; |
| 7017 } |
| 7018 } |
| 7019 |
| 7020 |
| 7021 class TestAnalysisContext_test_resolveCompilationUnit extends TestAnalysisContex
t { |
| 7022 List<bool> invoked; |
| 7023 TestAnalysisContext_test_resolveCompilationUnit(this.invoked); |
| 7024 @override |
| 7025 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) { |
| 7026 invoked[0] = true; |
| 7027 return null; |
| 7028 } |
| 7029 } |
| 7030 |
| 7031 |
| 7032 class TestAnalysisContext_test_resolveCompilationUnit_element extends TestAnalys
isContext { |
| 7033 List<bool> invoked; |
| 7034 TestAnalysisContext_test_resolveCompilationUnit_element(this.invoked); |
| 7035 @override |
| 7036 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { |
| 7037 invoked[0] = true; |
| 7038 return null; |
| 7039 } |
| 7040 } |
| 7041 |
| 7042 |
| 7043 class TestAnalysisContext_test_resolveHtmlUnit extends TestAnalysisContext { |
| 7044 List<bool> invoked; |
| 7045 TestAnalysisContext_test_resolveHtmlUnit(this.invoked); |
| 7046 @override |
| 7047 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { |
| 7048 invoked[0] = true; |
| 7049 return null; |
| 7050 } |
| 7051 } |
| 7052 |
| 7053 |
| 7054 class TestAnalysisContext_test_setAnalysisOptions extends TestAnalysisContext { |
| 7055 List<bool> invoked; |
| 7056 TestAnalysisContext_test_setAnalysisOptions(this.invoked); |
| 7057 @override |
| 7058 void set analysisOptions(AnalysisOptions options) { |
| 7059 invoked[0] = true; |
| 7060 } |
| 7061 } |
| 7062 |
| 7063 |
| 7064 class TestAnalysisContext_test_setAnalysisPriorityOrder extends TestAnalysisCont
ext { |
| 7065 List<bool> invoked; |
| 7066 TestAnalysisContext_test_setAnalysisPriorityOrder(this.invoked); |
| 7067 @override |
| 7068 void set analysisPriorityOrder(List<Source> sources) { |
| 7069 invoked[0] = true; |
| 7070 } |
| 7071 } |
| 7072 |
| 7073 |
| 7074 class TestAnalysisContext_test_setChangedContents extends TestAnalysisContext { |
| 7075 List<bool> invoked; |
| 7076 TestAnalysisContext_test_setChangedContents(this.invoked); |
| 7077 @override |
| 7078 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { |
| 7079 invoked[0] = true; |
| 7080 } |
| 7081 } |
| 7082 |
| 7083 |
| 7084 class TestAnalysisContext_test_setContents extends TestAnalysisContext { |
| 7085 List<bool> invoked; |
| 7086 TestAnalysisContext_test_setContents(this.invoked); |
| 7087 @override |
| 7088 void setContents(Source source, String contents) { |
| 7089 invoked[0] = true; |
| 7090 } |
| 7091 } |
| 7092 |
| 7093 |
| 7094 class TestAnalysisContext_test_setSourceFactory extends TestAnalysisContext { |
| 7095 List<bool> invoked; |
| 7096 TestAnalysisContext_test_setSourceFactory(this.invoked); |
| 7097 @override |
| 7098 void set sourceFactory(SourceFactory factory) { |
| 7099 invoked[0] = true; |
| 7100 } |
| 7101 } |
| 7102 |
| 7103 |
| 7104 /** |
| 7105 * This subclass of DartEntryImpl allows test code to invoke the copyFrom() meth
od. |
| 7106 */ |
| 7107 class TestDartEntryImpl extends DartEntryImpl { |
| 7108 @override |
| 7109 void copyFrom(SourceEntryImpl entry) { |
| 7110 super.copyFrom(entry); |
| 7111 } |
| 7112 } |
| 7113 |
| 7114 |
| 7115 /** |
| 7116 * Instances of the class `TestTaskVisitor` implement a task visitor that fails
if any of its |
| 7117 * methods are invoked. Subclasses typically override the expected methods to no
t cause a test |
| 7118 * failure. |
| 7119 */ |
| 7120 class TestTaskVisitor<E> implements AnalysisTaskVisitor<E> { |
| 7121 @override |
| 7122 E visitGenerateDartErrorsTask(GenerateDartErrorsTask task) { |
| 7123 JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartErrorsTask"); |
| 7124 return null; |
| 7125 } |
| 7126 @override |
| 7127 E visitGenerateDartHintsTask(GenerateDartHintsTask task) { |
| 7128 JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartHintsTask"); |
| 7129 return null; |
| 7130 } |
| 7131 @override |
| 7132 E visitGetContentTask(GetContentTask task) { |
| 7133 JUnitTestCase.fail("Unexpectedly invoked visitGetContentsTask"); |
| 7134 return null; |
| 7135 } |
| 7136 @override |
| 7137 E visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTask
) { |
| 7138 JUnitTestCase.fail("Unexpectedly invoked visitIncrementalAnalysisTask"); |
| 7139 return null; |
| 7140 } |
| 7141 @override |
| 7142 E visitParseDartTask(ParseDartTask task) { |
| 7143 JUnitTestCase.fail("Unexpectedly invoked visitParseDartTask"); |
| 7144 return null; |
| 7145 } |
| 7146 @override |
| 7147 E visitParseHtmlTask(ParseHtmlTask task) { |
| 7148 JUnitTestCase.fail("Unexpectedly invoked visitParseHtmlTask"); |
| 7149 return null; |
| 7150 } |
| 7151 @override |
| 7152 E visitPolymerBuildHtmlTask(PolymerBuildHtmlTask task) { |
| 7153 JUnitTestCase.fail("Unexpectedly invoked visitPolymerBuildHtmlTask"); |
| 7154 return null; |
| 7155 } |
| 7156 @override |
| 7157 E visitPolymerResolveHtmlTask(PolymerResolveHtmlTask task) { |
| 7158 JUnitTestCase.fail("Unexpectedly invoked visitPolymerResolveHtmlTask"); |
| 7159 return null; |
| 7160 } |
| 7161 @override |
| 7162 E visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemplateTask
task) { |
| 7163 JUnitTestCase.fail("Unexpectedly invoked visitResolveAngularComponentTemplat
eTask"); |
| 7164 return null; |
| 7165 } |
| 7166 @override |
| 7167 E visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) { |
| 7168 JUnitTestCase.fail("Unexpectedly invoked visitResolveAngularEntryHtmlTask"); |
| 7169 return null; |
| 7170 } |
| 7171 @override |
| 7172 E visitResolveDartLibraryCycleTask(ResolveDartLibraryCycleTask task) { |
| 7173 JUnitTestCase.fail("Unexpectedly invoked visitResolveDartLibraryCycleTask"); |
| 7174 return null; |
| 7175 } |
| 7176 @override |
| 7177 E visitResolveDartLibraryTask(ResolveDartLibraryTask task) { |
| 7178 JUnitTestCase.fail("Unexpectedly invoked visitResolveDartLibraryTask"); |
| 7179 return null; |
| 7180 } |
| 7181 @override |
| 7182 E visitResolveDartUnitTask(ResolveDartUnitTask task) { |
| 7183 JUnitTestCase.fail("Unexpectedly invoked visitResolveDartUnitTask"); |
| 7184 return null; |
| 7185 } |
| 7186 @override |
| 7187 E visitResolveHtmlTask(ResolveHtmlTask task) { |
| 7188 JUnitTestCase.fail("Unexpectedly invoked visitResolveHtmlTask"); |
| 7189 return null; |
| 7190 } |
| 7191 @override |
| 7192 E visitScanDartTask(ScanDartTask task) { |
| 7193 JUnitTestCase.fail("Unexpectedly invoked visitScanDartTask"); |
| 7194 return null; |
| 7195 } |
| 7196 } |
| 7197 |
| 7198 |
| 7199 class UniversalCachePartitionTest extends EngineTestCase { |
| 7200 void test_contains() { |
| 7201 UniversalCachePartition partition = new UniversalCachePartition(null, 8, nul
l); |
| 7202 TestSource source = new TestSource(); |
| 7203 JUnitTestCase.assertTrue(partition.contains(source)); |
| 7204 } |
| 7205 void test_creation() { |
| 7206 JUnitTestCase.assertNotNull(new UniversalCachePartition(null, 8, null)); |
| 7207 } |
| 7208 void test_entrySet() { |
| 7209 UniversalCachePartition partition = new UniversalCachePartition(null, 8, nul
l); |
| 7210 TestSource source = new TestSource(); |
| 7211 DartEntryImpl entry = new DartEntryImpl(); |
| 7212 partition.put(source, entry); |
| 7213 JavaIterator<MapEntry<Source, SourceEntry>> entries = new JavaIterator(getMa
pEntrySet(partition.map)); |
| 7214 JUnitTestCase.assertTrue(entries.hasNext); |
| 7215 MapEntry<Source, SourceEntry> mapEntry = entries.next(); |
| 7216 JUnitTestCase.assertSame(source, mapEntry.getKey()); |
| 7217 JUnitTestCase.assertSame(entry, mapEntry.getValue()); |
| 7218 JUnitTestCase.assertFalse(entries.hasNext); |
| 7219 } |
| 7220 void test_get() { |
| 7221 UniversalCachePartition partition = new UniversalCachePartition(null, 8, nul
l); |
| 7222 TestSource source = new TestSource(); |
| 7223 JUnitTestCase.assertNull(partition.get(source)); |
| 7224 } |
| 7225 void test_put_noFlush() { |
| 7226 UniversalCachePartition partition = new UniversalCachePartition(null, 8, nul
l); |
| 7227 TestSource source = new TestSource(); |
| 7228 DartEntryImpl entry = new DartEntryImpl(); |
| 7229 partition.put(source, entry); |
| 7230 JUnitTestCase.assertSame(entry, partition.get(source)); |
| 7231 } |
| 7232 void test_remove() { |
| 7233 UniversalCachePartition partition = new UniversalCachePartition(null, 8, nul
l); |
| 7234 TestSource source = new TestSource(); |
| 7235 DartEntryImpl entry = new DartEntryImpl(); |
| 7236 partition.put(source, entry); |
| 7237 JUnitTestCase.assertSame(entry, partition.get(source)); |
| 7238 partition.remove(source); |
| 7239 JUnitTestCase.assertNull(partition.get(source)); |
| 7240 } |
| 7241 void test_setMaxCacheSize() { |
| 7242 UniversalCachePartition partition = new UniversalCachePartition(null, 8, new
_UniversalCachePartitionTest_test_setMaxCacheSize()); |
| 7243 int size = 6; |
| 7244 for (int i = 0; i < size; i++) { |
| 7245 Source source = new TestSource("/test${i}.dart"); |
| 7246 DartEntryImpl entry = new DartEntryImpl(); |
| 7247 entry.setValue(DartEntry.PARSED_UNIT, null); |
| 7248 partition.put(source, entry); |
| 7249 partition.accessedAst(source); |
| 7250 } |
| 7251 _assertNonFlushedCount(size, partition); |
| 7252 int newSize = size - 2; |
| 7253 partition.maxCacheSize = newSize; |
| 7254 _assertNonFlushedCount(newSize, partition); |
| 7255 } |
| 7256 void test_size() { |
| 7257 UniversalCachePartition partition = new UniversalCachePartition(null, 8, nul
l); |
| 7258 int size = 4; |
| 7259 for (int i = 0; i < size; i++) { |
| 7260 Source source = new TestSource("/test${i}.dart"); |
| 7261 partition.put(source, new DartEntryImpl()); |
| 7262 partition.accessedAst(source); |
| 7263 } |
| 7264 JUnitTestCase.assertEquals(size, partition.size()); |
| 7265 } |
| 7266 void _assertNonFlushedCount(int expectedCount, UniversalCachePartition partiti
on) { |
| 7267 int nonFlushedCount = 0; |
| 7268 JavaIterator<MapEntry<Source, SourceEntry>> entries = new JavaIterator(getMa
pEntrySet(partition.map)); |
| 7269 while (entries.hasNext) { |
| 7270 MapEntry<Source, SourceEntry> entry = entries.next(); |
| 7271 if (entry.getValue().getState(DartEntry.PARSED_UNIT) != CacheState.FLUSHED
) { |
| 7272 nonFlushedCount++; |
| 7273 } |
| 7274 } |
| 7275 JUnitTestCase.assertEquals(expectedCount, nonFlushedCount); |
| 7276 } |
| 7277 static dartSuite() { |
| 7278 _ut.group('UniversalCachePartitionTest', () { |
| 7279 _ut.test('test_contains', () { |
| 7280 final __test = new UniversalCachePartitionTest(); |
| 7281 runJUnitTest(__test, __test.test_contains); |
| 7282 }); |
| 7283 _ut.test('test_creation', () { |
| 7284 final __test = new UniversalCachePartitionTest(); |
| 7285 runJUnitTest(__test, __test.test_creation); |
| 7286 }); |
| 7287 _ut.test('test_entrySet', () { |
| 7288 final __test = new UniversalCachePartitionTest(); |
| 7289 runJUnitTest(__test, __test.test_entrySet); |
| 7290 }); |
| 7291 _ut.test('test_get', () { |
| 7292 final __test = new UniversalCachePartitionTest(); |
| 7293 runJUnitTest(__test, __test.test_get); |
| 7294 }); |
| 7295 _ut.test('test_put_noFlush', () { |
| 7296 final __test = new UniversalCachePartitionTest(); |
| 7297 runJUnitTest(__test, __test.test_put_noFlush); |
| 7298 }); |
| 7299 _ut.test('test_remove', () { |
| 7300 final __test = new UniversalCachePartitionTest(); |
| 7301 runJUnitTest(__test, __test.test_remove); |
| 7302 }); |
| 7303 _ut.test('test_setMaxCacheSize', () { |
| 7304 final __test = new UniversalCachePartitionTest(); |
| 7305 runJUnitTest(__test, __test.test_setMaxCacheSize); |
| 7306 }); |
| 7307 _ut.test('test_size', () { |
| 7308 final __test = new UniversalCachePartitionTest(); |
| 7309 runJUnitTest(__test, __test.test_size); |
| 7310 }); |
| 7311 }); |
| 7312 } |
| 7313 } |
| 7314 |
| 7315 |
| 7316 class WorkManagerTest extends EngineTestCase { |
| 7317 void test_addFirst() { |
| 7318 TestSource source1 = new TestSource("/f1.dart"); |
| 7319 TestSource source2 = new TestSource("/f2.dart"); |
| 7320 WorkManager manager = new WorkManager(); |
| 7321 manager.add(source1, SourcePriority.UNKNOWN); |
| 7322 manager.addFirst(source2, SourcePriority.UNKNOWN); |
| 7323 WorkManager_WorkIterator iterator = manager.iterator(); |
| 7324 JUnitTestCase.assertSame(source2, iterator.next()); |
| 7325 JUnitTestCase.assertSame(source1, iterator.next()); |
| 7326 } |
| 7327 void test_creation() { |
| 7328 JUnitTestCase.assertNotNull(new WorkManager()); |
| 7329 } |
| 7330 void test_iterator_empty() { |
| 7331 WorkManager manager = new WorkManager(); |
| 7332 WorkManager_WorkIterator iterator = manager.iterator(); |
| 7333 JUnitTestCase.assertFalse(iterator.hasNext); |
| 7334 try { |
| 7335 iterator.next(); |
| 7336 JUnitTestCase.fail("Expected NoSuchElementException"); |
| 7337 } on NoSuchElementException catch (exception) { |
| 7338 } |
| 7339 } |
| 7340 void test_iterator_nonEmpty() { |
| 7341 TestSource source = new TestSource(); |
| 7342 WorkManager manager = new WorkManager(); |
| 7343 manager.add(source, SourcePriority.UNKNOWN); |
| 7344 WorkManager_WorkIterator iterator = manager.iterator(); |
| 7345 JUnitTestCase.assertTrue(iterator.hasNext); |
| 7346 JUnitTestCase.assertSame(source, iterator.next()); |
| 7347 } |
| 7348 void test_remove() { |
| 7349 TestSource source1 = new TestSource("/f1.dart"); |
| 7350 TestSource source2 = new TestSource("/f2.dart"); |
| 7351 TestSource source3 = new TestSource("/f3.dart"); |
| 7352 WorkManager manager = new WorkManager(); |
| 7353 manager.add(source1, SourcePriority.UNKNOWN); |
| 7354 manager.add(source2, SourcePriority.UNKNOWN); |
| 7355 manager.add(source3, SourcePriority.UNKNOWN); |
| 7356 manager.remove(source2); |
| 7357 WorkManager_WorkIterator iterator = manager.iterator(); |
| 7358 JUnitTestCase.assertSame(source1, iterator.next()); |
| 7359 JUnitTestCase.assertSame(source3, iterator.next()); |
| 7360 } |
| 7361 void test_toString_empty() { |
| 7362 WorkManager manager = new WorkManager(); |
| 7363 JUnitTestCase.assertNotNull(manager.toString()); |
| 7364 } |
| 7365 void test_toString_nonEmpty() { |
| 7366 WorkManager manager = new WorkManager(); |
| 7367 manager.add(new TestSource(), SourcePriority.HTML); |
| 7368 manager.add(new TestSource(), SourcePriority.LIBRARY); |
| 7369 manager.add(new TestSource(), SourcePriority.NORMAL_PART); |
| 7370 manager.add(new TestSource(), SourcePriority.PRIORITY_PART); |
| 7371 manager.add(new TestSource(), SourcePriority.UNKNOWN); |
| 7372 JUnitTestCase.assertNotNull(manager.toString()); |
| 7373 } |
| 7374 static dartSuite() { |
| 7375 _ut.group('WorkManagerTest', () { |
| 7376 _ut.test('test_addFirst', () { |
| 7377 final __test = new WorkManagerTest(); |
| 7378 runJUnitTest(__test, __test.test_addFirst); |
| 7379 }); |
| 7380 _ut.test('test_creation', () { |
| 7381 final __test = new WorkManagerTest(); |
| 7382 runJUnitTest(__test, __test.test_creation); |
| 7383 }); |
| 7384 _ut.test('test_iterator_empty', () { |
| 7385 final __test = new WorkManagerTest(); |
| 7386 runJUnitTest(__test, __test.test_iterator_empty); |
| 7387 }); |
| 7388 _ut.test('test_iterator_nonEmpty', () { |
| 7389 final __test = new WorkManagerTest(); |
| 7390 runJUnitTest(__test, __test.test_iterator_nonEmpty); |
| 7391 }); |
| 7392 _ut.test('test_remove', () { |
| 7393 final __test = new WorkManagerTest(); |
| 7394 runJUnitTest(__test, __test.test_remove); |
| 7395 }); |
| 7396 _ut.test('test_toString_empty', () { |
| 7397 final __test = new WorkManagerTest(); |
| 7398 runJUnitTest(__test, __test.test_toString_empty); |
| 7399 }); |
| 7400 _ut.test('test_toString_nonEmpty', () { |
| 7401 final __test = new WorkManagerTest(); |
| 7402 runJUnitTest(__test, __test.test_toString_nonEmpty); |
| 7403 }); |
| 7404 }); |
| 7405 } |
| 7406 } |
| 7407 |
| 7408 |
| 7409 class _AnalysisCacheTest_test_setMaxCacheSize implements CacheRetentionPolicy { |
| 7410 @override |
| 7411 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => Re
tentionPriority.LOW; |
| 7412 } |
| 7413 |
| 7414 |
| 7415 class _AnalysisContextImplTest_test_applyChanges_removeContainer implements Sour
ceContainer { |
| 7416 Source libB; |
| 7417 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); |
| 7418 @override |
| 7419 bool contains(Source source) => source == libB; |
| 7420 } |
| 7421 |
| 7422 |
| 7423 class _AnalysisContext_sourceChangeDuringResolution extends AnalysisContextForTe
sts { |
| 7424 @override |
| 7425 DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task) { |
| 7426 ChangeSet changeSet = new ChangeSet(); |
| 7427 changeSet.changedSource(task.librarySource); |
| 7428 applyChanges(changeSet); |
| 7429 return super.recordResolveDartLibraryTaskResults(task); |
| 7430 } |
| 7431 } |
| 7432 |
| 7433 |
| 7434 class _UniversalCachePartitionTest_test_setMaxCacheSize implements CacheRetentio
nPolicy { |
| 7435 @override |
| 7436 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => Re
tentionPriority.LOW; |
| 7437 } |
| OLD | NEW |