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

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

Issue 622743002: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // // for details. All rights reserved. Use of this source code is governed by a 2 // // for details. All rights reserved. Use of this source code is governed by a
3 // // BSD-style license that can be found in the LICENSE file. 3 // // BSD-style license that can be found in the LICENSE file.
4 // // This code was auto-generated, is not intended to be edited, and is subject to 4 // // This code was auto-generated, is not intended to be edited, and is subject to
5 // // significant change. Please see the README file for more information. 5 // // significant change. Please see the README file for more information.
6 // library engine.engine_test; 6 // library engine.engine_test;
7 // import 'dart:collection'; 7 // import 'dart:collection';
8 // import 'package:analyzer/src/generated/ast.dart'; 8 // import 'package:analyzer/src/generated/ast.dart';
9 // import 'package:analyzer/src/generated/element.dart'; 9 // import 'package:analyzer/src/generated/element.dart';
10 // import 'package:analyzer/src/generated/engine.dart'; 10 // import 'package:analyzer/src/generated/engine.dart';
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // final __test = new AnalysisCacheTest(); 111 // final __test = new AnalysisCacheTest();
112 // runJUnitTest(__test, __test.test_setMaxCacheSize); 112 // runJUnitTest(__test, __test.test_setMaxCacheSize);
113 // }); 113 // });
114 // _ut.test('test_size', () { 114 // _ut.test('test_size', () {
115 // final __test = new AnalysisCacheTest(); 115 // final __test = new AnalysisCacheTest();
116 // runJUnitTest(__test, __test.test_size); 116 // runJUnitTest(__test, __test.test_size);
117 // }); 117 // });
118 // }); 118 // });
119 // } 119 // }
120 // } 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 // }
121 // class AnalysisContextImplTest extends EngineTestCase { 130 // class AnalysisContextImplTest extends EngineTestCase {
122 // /** 131 // /**
123 // * Returns `true` if there is an [AnalysisError] with [ErrorSeverity#ERROR] in 132 // * Returns `true` if there is an [AnalysisError] with [ErrorSeverity#ERROR] in
124 // * the given [AnalysisErrorInfo]. 133 // * the given [AnalysisErrorInfo].
125 // */ 134 // */
126 // static bool _hasAnalysisErrorWithErrorSeverity(AnalysisErrorInfo errorInfo) { 135 // static bool _hasAnalysisErrorWithErrorSeverity(AnalysisErrorInfo errorInfo) {
127 // List<AnalysisError> errors = errorInfo.errors; 136 // List<AnalysisError> errors = errorInfo.errors;
128 // for (AnalysisError analysisError in errors) { 137 // for (AnalysisError analysisError in errors) {
129 // if (analysisError.errorCode.errorSeverity == ErrorSeverity.ERROR) { 138 // if (analysisError.errorCode.errorSeverity == ErrorSeverity.ERROR) {
130 // return true; 139 // return true;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // void test_computeLineInfo_html() { 404 // void test_computeLineInfo_html() {
396 // Source source = _addSource("/test.html", EngineTestCase.createSource([ 405 // Source source = _addSource("/test.html", EngineTestCase.createSource([
397 // "<html>", 406 // "<html>",
398 // " <body>", 407 // " <body>",
399 // " <h1>A</h1>", 408 // " <h1>A</h1>",
400 // " </body>", 409 // " </body>",
401 // "</html>"])); 410 // "</html>"]));
402 // LineInfo info = _context.computeLineInfo(source); 411 // LineInfo info = _context.computeLineInfo(source);
403 // JUnitTestCase.assertNotNull(info); 412 // JUnitTestCase.assertNotNull(info);
404 // } 413 // }
405 // void test_computeResolvableCompilationUnit_exception() { 414 // void test_computeResolvableCompilationUnit_dart_exception() {
406 // TestSource source = _addSourceWithException("/test.dart"); 415 // TestSource source = _addSourceWithException("/test.dart");
407 // try { 416 // try {
408 // _context.computeResolvableCompilationUnit(source); 417 // _context.computeResolvableCompilationUnit(source);
409 // JUnitTestCase.fail("Expected AnalysisException"); 418 // JUnitTestCase.fail("Expected AnalysisException");
410 // } on AnalysisException catch (exception) { 419 // } on AnalysisException catch (exception) {
411 // } 420 // }
412 // } 421 // }
413 // void test_computeResolvableCompilationUnit_html() { 422 // void test_computeResolvableCompilationUnit_html_exception() {
414 // Source source = _addSource("/lib.html", "<html></html>"); 423 // Source source = _addSource("/lib.html", "<html></html>");
415 // try { 424 // try {
416 // _context.computeResolvableCompilationUnit(source); 425 // _context.computeResolvableCompilationUnit(source);
417 // JUnitTestCase.fail("Expected AnalysisException"); 426 // JUnitTestCase.fail("Expected AnalysisException");
418 // } on AnalysisException catch (exception) { 427 // } on AnalysisException catch (exception) {
419 // } 428 // }
420 // } 429 // }
421 // void test_computeResolvableCompilationUnit_valid() { 430 // void test_computeResolvableCompilationUnit_valid() {
422 // Source source = _addSource("/lib.dart", "library lib;"); 431 // Source source = _addSource("/lib.dart", "library lib;");
423 // CompilationUnit compilationUnit = _context.parseCompilationUnit(source); 432 // CompilationUnit parsedUnit = _context.parseCompilationUnit(source);
424 // JUnitTestCase.assertNotNull(compilationUnit); 433 // JUnitTestCase.assertNotNull(parsedUnit);
425 // JUnitTestCase.assertNotSame(compilationUnit, _context.computeResolvableCo mpilationUnit(source)); 434 // CompilationUnit resolvedUnit = _context.computeResolvableCompilationUnit( source).compilationUnit;
435 // JUnitTestCase.assertNotNull(resolvedUnit);
436 // JUnitTestCase.assertNotSame(parsedUnit, resolvedUnit);
426 // } 437 // }
427 // void test_dispose() { 438 // void test_dispose() {
428 // JUnitTestCase.assertFalse(_context.isDisposed); 439 // JUnitTestCase.assertFalse(_context.isDisposed);
429 // _context.dispose(); 440 // _context.dispose();
430 // JUnitTestCase.assertTrue(_context.isDisposed); 441 // JUnitTestCase.assertTrue(_context.isDisposed);
431 // } 442 // }
432 // void test_exists_false() { 443 // void test_exists_false() {
433 // JUnitTestCase.assertFalse(_context.exists(new TestSource())); 444 // JUnitTestCase.assertFalse(_context.exists(new TestSource()));
434 // } 445 // }
435 // void test_exists_null() { 446 // void test_exists_null() {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 // _sourceFactory = _context.sourceFactory; 722 // _sourceFactory = _context.sourceFactory;
712 // Source source = _addSource("/test.dart", "library lib;"); 723 // Source source = _addSource("/test.dart", "library lib;");
713 // LibraryElement element = _context.getLibraryElement(source); 724 // LibraryElement element = _context.getLibraryElement(source);
714 // JUnitTestCase.assertNull(element); 725 // JUnitTestCase.assertNull(element);
715 // _context.computeLibraryElement(source); 726 // _context.computeLibraryElement(source);
716 // element = _context.getLibraryElement(source); 727 // element = _context.getLibraryElement(source);
717 // JUnitTestCase.assertNotNull(element); 728 // JUnitTestCase.assertNotNull(element);
718 // } 729 // }
719 // void test_getLibrarySources() { 730 // void test_getLibrarySources() {
720 // List<Source> sources = _context.librarySources; 731 // List<Source> sources = _context.librarySources;
721 // EngineTestCase.assertLength(0, sources); 732 // int originalLength = sources.length;
722 // Source source = _addSource("/test.dart", "library lib;"); 733 // Source source = _addSource("/test.dart", "library lib;");
723 // _context.computeKindOf(source); 734 // _context.computeKindOf(source);
724 // sources = _context.librarySources; 735 // sources = _context.librarySources;
725 // EngineTestCase.assertLength(1, sources); 736 // EngineTestCase.assertLength(originalLength + 1, sources);
726 // JUnitTestCase.assertEquals(source, sources[0]); 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");
727 // } 743 // }
728 // void test_getLineInfo() { 744 // void test_getLineInfo() {
729 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["li brary lib;", "", "main() {}"])); 745 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["li brary lib;", "", "main() {}"]));
730 // LineInfo info = _context.getLineInfo(source); 746 // LineInfo info = _context.getLineInfo(source);
731 // JUnitTestCase.assertNull(info); 747 // JUnitTestCase.assertNull(info);
732 // _context.parseCompilationUnit(source); 748 // _context.parseCompilationUnit(source);
733 // info = _context.getLineInfo(source); 749 // info = _context.getLineInfo(source);
734 // JUnitTestCase.assertNotNull(info); 750 // JUnitTestCase.assertNotNull(info);
735 // } 751 // }
736 // void test_getModificationStamp_fromSource() { 752 // void test_getModificationStamp_fromSource() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 // JUnitTestCase.assertNull(_context.getResolvedHtmlUnit(source)); 820 // JUnitTestCase.assertNull(_context.getResolvedHtmlUnit(source));
805 // _context.resolveHtmlUnit(source); 821 // _context.resolveHtmlUnit(source);
806 // JUnitTestCase.assertNotNull(_context.getResolvedHtmlUnit(source)); 822 // JUnitTestCase.assertNotNull(_context.getResolvedHtmlUnit(source));
807 // } 823 // }
808 // void test_getSourceFactory() { 824 // void test_getSourceFactory() {
809 // JUnitTestCase.assertSame(_sourceFactory, _context.sourceFactory); 825 // JUnitTestCase.assertSame(_sourceFactory, _context.sourceFactory);
810 // } 826 // }
811 // void test_getStatistics() { 827 // void test_getStatistics() {
812 // AnalysisContextStatistics statistics = _context.statistics; 828 // AnalysisContextStatistics statistics = _context.statistics;
813 // JUnitTestCase.assertNotNull(statistics); 829 // JUnitTestCase.assertNotNull(statistics);
814 // EngineTestCase.assertLength(0, statistics.cacheRows);
815 // EngineTestCase.assertLength(0, statistics.exceptions);
816 // EngineTestCase.assertLength(0, statistics.sources);
817 // } 830 // }
818 // void test_isClientLibrary_dart() { 831 // void test_isClientLibrary_dart() {
819 // _context = AnalysisContextFactory.contextWithCore(); 832 // _context = AnalysisContextFactory.contextWithCore();
820 // _sourceFactory = _context.sourceFactory; 833 // _sourceFactory = _context.sourceFactory;
821 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["im port 'dart:html';", "", "main() {}"])); 834 // Source source = _addSource("/test.dart", EngineTestCase.createSource(["im port 'dart:html';", "", "main() {}"]));
822 // JUnitTestCase.assertFalse(_context.isClientLibrary(source)); 835 // JUnitTestCase.assertFalse(_context.isClientLibrary(source));
823 // JUnitTestCase.assertFalse(_context.isServerLibrary(source)); 836 // JUnitTestCase.assertFalse(_context.isServerLibrary(source));
824 // _context.computeLibraryElement(source); 837 // _context.computeLibraryElement(source);
825 // JUnitTestCase.assertTrue(_context.isClientLibrary(source)); 838 // JUnitTestCase.assertTrue(_context.isClientLibrary(source));
826 // JUnitTestCase.assertFalse(_context.isServerLibrary(source)); 839 // JUnitTestCase.assertFalse(_context.isServerLibrary(source));
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 // JUnitTestCase.assertNotNullMsg("libB resolved 1", _context.getResolvedCom pilationUnit2(libBSource, libBSource)); 1061 // JUnitTestCase.assertNotNullMsg("libB resolved 1", _context.getResolvedCom pilationUnit2(libBSource, libBSource));
1049 // JUnitTestCase.assertTrueMsg("libA doesn't have errors", !_hasAnalysisErro rWithErrorSeverity(_context.getErrors(libASource))); 1062 // JUnitTestCase.assertTrueMsg("libA doesn't have errors", !_hasAnalysisErro rWithErrorSeverity(_context.getErrors(libASource)));
1050 // // remove libB.dart content and analyze 1063 // // remove libB.dart content and analyze
1051 // _context.setContents(libBSource, null); 1064 // _context.setContents(libBSource, null);
1052 // _analyzeAll_assertFinished(); 1065 // _analyzeAll_assertFinished();
1053 // JUnitTestCase.assertNotNullMsg("libA resolved 2", _context.getResolvedCom pilationUnit2(libASource, libASource)); 1066 // JUnitTestCase.assertNotNullMsg("libA resolved 2", _context.getResolvedCom pilationUnit2(libASource, libASource));
1054 // JUnitTestCase.assertTrueMsg("libA has an error", _hasAnalysisErrorWithErr orSeverity(_context.getErrors(libASource))); 1067 // JUnitTestCase.assertTrueMsg("libA has an error", _hasAnalysisErrorWithErr orSeverity(_context.getErrors(libASource)));
1055 // } 1068 // }
1056 // void test_performAnalysisTask_IOException() { 1069 // void test_performAnalysisTask_IOException() {
1057 // TestSource source = _addSourceWithException2("/test.dart", "library test; "); 1070 // TestSource source = _addSourceWithException2("/test.dart", "library test; ");
1071 // int oldTimestamp = _context.getModificationStamp(source);
1058 // source.generateExceptionOnRead = false; 1072 // source.generateExceptionOnRead = false;
1059 // _analyzeAll_assertFinished(); 1073 // _analyzeAll_assertFinished();
1060 // JUnitTestCase.assertEquals(1, source.readCount); 1074 // JUnitTestCase.assertEquals(1, source.readCount);
1061 // source.generateExceptionOnRead = true; 1075 // source.generateExceptionOnRead = true;
1062 // _changeSource(source, ""); 1076 // do {
1063 // _context.performAnalysisTask(); 1077 // _changeSource(source, "");
1064 // JUnitTestCase.assertNull(_context.performAnalysisTask().changeNotices); 1078 // } while (oldTimestamp == _context.getModificationStamp(source));
1079 // _analyzeAll_assertFinished();
1065 // JUnitTestCase.assertEquals(2, source.readCount); 1080 // JUnitTestCase.assertEquals(2, source.readCount);
1066 // } 1081 // }
1067 // void test_performAnalysisTask_missingPart() { 1082 // void test_performAnalysisTask_missingPart() {
1068 // Source source = _addSource("/test.dart", "library lib; part 'no-such-file .dart';"); 1083 // Source source = _addSource("/test.dart", "library lib; part 'no-such-file .dart';");
1069 // _analyzeAll_assertFinished(); 1084 // _analyzeAll_assertFinished();
1070 // JUnitTestCase.assertNotNullMsg("performAnalysisTask failed to compute an element model", _context.getLibraryElement(source)); 1085 // JUnitTestCase.assertNotNullMsg("performAnalysisTask failed to compute an element model", _context.getLibraryElement(source));
1071 // } 1086 // }
1072 // void test_performAnalysisTask_modifiedAfterParse() { 1087 // void test_performAnalysisTask_modifiedAfterParse() {
1073 // Source source = _addSource("/test.dart", "library lib;"); 1088 // Source source = _addSource("/test.dart", "library lib;");
1074 // int initialTime = _context.getModificationStamp(source); 1089 // int initialTime = _context.getModificationStamp(source);
1075 // List<Source> sources = new List<Source>(); 1090 // List<Source> sources = new List<Source>();
1076 // sources.add(source); 1091 // sources.add(source);
1077 // _context.analysisPriorityOrder = sources; 1092 // _context.analysisPriorityOrder = sources;
1078 // _context.parseCompilationUnit(source); 1093 // _context.parseCompilationUnit(source);
1079 // while (initialTime == JavaSystem.currentTimeMillis()) { 1094 // while (initialTime == JavaSystem.currentTimeMillis()) {
1080 // Thread.sleep(1); 1095 // Thread.sleep(1);
1081 // } 1096 // }
1082 // _context.setContents(source, "library test;"); 1097 // _context.setContents(source, "library test;");
1083 // JUnitTestCase.assertTrue(initialTime != _context.getModificationStamp(sou rce)); 1098 // JUnitTestCase.assertTrue(initialTime != _context.getModificationStamp(sou rce));
1084 // _analyzeAll_assertFinished(); 1099 // _analyzeAll_assertFinished();
1085 // JUnitTestCase.assertNotNullMsg("performAnalysisTask failed to compute an element model", _context.getLibraryElement(source)); 1100 // JUnitTestCase.assertNotNullMsg("performAnalysisTask failed to compute an element model", _context.getLibraryElement(source));
1086 // } 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 // }
1087 // void test_resolveCompilationUnit_library() { 1124 // void test_resolveCompilationUnit_library() {
1088 // _context = AnalysisContextFactory.contextWithCore(); 1125 // _context = AnalysisContextFactory.contextWithCore();
1089 // _sourceFactory = _context.sourceFactory; 1126 // _sourceFactory = _context.sourceFactory;
1090 // Source source = _addSource("/lib.dart", "library lib;"); 1127 // Source source = _addSource("/lib.dart", "library lib;");
1091 // LibraryElement library = _context.computeLibraryElement(source); 1128 // LibraryElement library = _context.computeLibraryElement(source);
1092 // CompilationUnit compilationUnit = _context.resolveCompilationUnit(source, library); 1129 // CompilationUnit compilationUnit = _context.resolveCompilationUnit(source, library);
1093 // JUnitTestCase.assertNotNull(compilationUnit); 1130 // JUnitTestCase.assertNotNull(compilationUnit);
1131 // JUnitTestCase.assertNotNull(compilationUnit.element);
1094 // } 1132 // }
1095 // void test_resolveCompilationUnit_source() { 1133 // void test_resolveCompilationUnit_source() {
1096 // _context = AnalysisContextFactory.contextWithCore(); 1134 // _context = AnalysisContextFactory.contextWithCore();
1097 // _sourceFactory = _context.sourceFactory; 1135 // _sourceFactory = _context.sourceFactory;
1098 // Source source = _addSource("/lib.dart", "library lib;"); 1136 // Source source = _addSource("/lib.dart", "library lib;");
1099 // CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source , source); 1137 // CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source , source);
1100 // JUnitTestCase.assertNotNull(compilationUnit); 1138 // JUnitTestCase.assertNotNull(compilationUnit);
1101 // } 1139 // }
1102 // void test_resolveCompilationUnit_sourceChangeDuringResolution() { 1140 // void test_resolveCompilationUnit_sourceChangeDuringResolution() {
1103 // _context = new AnalysisContextImpl_AnalysisContextImplTest_test_resolveCo mpilationUnit_sourceChangeDuringResolution(); 1141 // _context = new AnalysisContextFactory_AnalysisContextForTests_AnalysisCon textImplTest_test_resolveCompilationUnit_sourceChangeDuringResolution();
1104 // AnalysisContextFactory.initContextWithCore(_context); 1142 // AnalysisContextFactory.initContextWithCore(_context);
1105 // _sourceFactory = _context.sourceFactory; 1143 // _sourceFactory = _context.sourceFactory;
1106 // Source source = _addSource("/lib.dart", "library lib;"); 1144 // Source source = _addSource("/lib.dart", "library lib;");
1107 // CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source , source); 1145 // CompilationUnit compilationUnit = _context.resolveCompilationUnit2(source , source);
1108 // JUnitTestCase.assertNotNull(compilationUnit); 1146 // JUnitTestCase.assertNotNull(compilationUnit);
1109 // JUnitTestCase.assertNotNull(_context.getLineInfo(source)); 1147 // JUnitTestCase.assertNotNull(_context.getLineInfo(source));
1110 // } 1148 // }
1111 // void test_resolveHtmlUnit() { 1149 // void test_resolveHtmlUnit() {
1112 // Source source = _addSource("/lib.html", "<html></html>"); 1150 // Source source = _addSource("/lib.html", "<html></html>");
1113 // HtmlUnit unit = _context.resolveHtmlUnit(source); 1151 // HtmlUnit unit = _context.resolveHtmlUnit(source);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 // if (notice == null) { 1306 // if (notice == null) {
1269 // //System.out.println("test_performAnalysisTask_stress: " + i); 1307 // //System.out.println("test_performAnalysisTask_stress: " + i);
1270 // break; 1308 // break;
1271 // } 1309 // }
1272 // } 1310 // }
1273 // List<ChangeNotice> notice = _context.performAnalysisTask().changeNotices; 1311 // List<ChangeNotice> notice = _context.performAnalysisTask().changeNotices;
1274 // if (notice != null) { 1312 // if (notice != null) {
1275 // JUnitTestCase.fail("performAnalysisTask failed to terminate after analy zing all sources"); 1313 // JUnitTestCase.fail("performAnalysisTask failed to terminate after analy zing all sources");
1276 // } 1314 // }
1277 // } 1315 // }
1316 // @override
1317 // void tearDown() {
1318 // _context = null;
1319 // _sourceFactory = null;
1320 // super.tearDown();
1321 // }
1278 // Source _addSource(String fileName, String contents) { 1322 // Source _addSource(String fileName, String contents) {
1279 // Source source = new FileBasedSource.con1(FileUtilities2.createFile(fileNa me)); 1323 // Source source = new FileBasedSource.con1(FileUtilities2.createFile(fileNa me));
1280 // ChangeSet changeSet = new ChangeSet(); 1324 // ChangeSet changeSet = new ChangeSet();
1281 // changeSet.addedSource(source); 1325 // changeSet.addedSource(source);
1282 // _context.applyChanges(changeSet); 1326 // _context.applyChanges(changeSet);
1283 // _context.setContents(source, contents); 1327 // _context.setContents(source, contents);
1284 // return source; 1328 // return source;
1285 // } 1329 // }
1286 // TestSource _addSourceWithException(String fileName) => _addSourceWithExcept ion2(fileName, ""); 1330 // TestSource _addSourceWithException(String fileName) => _addSourceWithExcept ion2(fileName, "");
1287 // TestSource _addSourceWithException2(String fileName, String contents) { 1331 // TestSource _addSourceWithException2(String fileName, String contents) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 // runJUnitTest(__test, __test.test_computeLibraryElement); 1503 // runJUnitTest(__test, __test.test_computeLibraryElement);
1460 // }); 1504 // });
1461 // _ut.test('test_computeLineInfo_dart', () { 1505 // _ut.test('test_computeLineInfo_dart', () {
1462 // final __test = new AnalysisContextImplTest(); 1506 // final __test = new AnalysisContextImplTest();
1463 // runJUnitTest(__test, __test.test_computeLineInfo_dart); 1507 // runJUnitTest(__test, __test.test_computeLineInfo_dart);
1464 // }); 1508 // });
1465 // _ut.test('test_computeLineInfo_html', () { 1509 // _ut.test('test_computeLineInfo_html', () {
1466 // final __test = new AnalysisContextImplTest(); 1510 // final __test = new AnalysisContextImplTest();
1467 // runJUnitTest(__test, __test.test_computeLineInfo_html); 1511 // runJUnitTest(__test, __test.test_computeLineInfo_html);
1468 // }); 1512 // });
1469 // _ut.test('test_computeResolvableCompilationUnit_exception', () { 1513 // _ut.test('test_computeResolvableCompilationUnit_dart_exception', () {
1470 // final __test = new AnalysisContextImplTest(); 1514 // final __test = new AnalysisContextImplTest();
1471 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_exc eption); 1515 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_dar t_exception);
1472 // }); 1516 // });
1473 // _ut.test('test_computeResolvableCompilationUnit_html', () { 1517 // _ut.test('test_computeResolvableCompilationUnit_html_exception', () {
1474 // final __test = new AnalysisContextImplTest(); 1518 // final __test = new AnalysisContextImplTest();
1475 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_htm l); 1519 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_htm l_exception);
1476 // }); 1520 // });
1477 // _ut.test('test_computeResolvableCompilationUnit_valid', () { 1521 // _ut.test('test_computeResolvableCompilationUnit_valid', () {
1478 // final __test = new AnalysisContextImplTest(); 1522 // final __test = new AnalysisContextImplTest();
1479 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_val id); 1523 // runJUnitTest(__test, __test.test_computeResolvableCompilationUnit_val id);
1480 // }); 1524 // });
1481 // _ut.test('test_dispose', () { 1525 // _ut.test('test_dispose', () {
1482 // final __test = new AnalysisContextImplTest(); 1526 // final __test = new AnalysisContextImplTest();
1483 // runJUnitTest(__test, __test.test_dispose); 1527 // runJUnitTest(__test, __test.test_dispose);
1484 // }); 1528 // });
1485 // _ut.test('test_exists_false', () { 1529 // _ut.test('test_exists_false', () {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 // runJUnitTest(__test, __test.test_performAnalysisTask_importedLibraryD elete); 1795 // runJUnitTest(__test, __test.test_performAnalysisTask_importedLibraryD elete);
1752 // }); 1796 // });
1753 // _ut.test('test_performAnalysisTask_missingPart', () { 1797 // _ut.test('test_performAnalysisTask_missingPart', () {
1754 // final __test = new AnalysisContextImplTest(); 1798 // final __test = new AnalysisContextImplTest();
1755 // runJUnitTest(__test, __test.test_performAnalysisTask_missingPart); 1799 // runJUnitTest(__test, __test.test_performAnalysisTask_missingPart);
1756 // }); 1800 // });
1757 // _ut.test('test_performAnalysisTask_modifiedAfterParse', () { 1801 // _ut.test('test_performAnalysisTask_modifiedAfterParse', () {
1758 // final __test = new AnalysisContextImplTest(); 1802 // final __test = new AnalysisContextImplTest();
1759 // runJUnitTest(__test, __test.test_performAnalysisTask_modifiedAfterPar se); 1803 // runJUnitTest(__test, __test.test_performAnalysisTask_modifiedAfterPar se);
1760 // }); 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 // });
1761 // _ut.test('test_resolveCompilationUnit_library', () { 1813 // _ut.test('test_resolveCompilationUnit_library', () {
1762 // final __test = new AnalysisContextImplTest(); 1814 // final __test = new AnalysisContextImplTest();
1763 // runJUnitTest(__test, __test.test_resolveCompilationUnit_library); 1815 // runJUnitTest(__test, __test.test_resolveCompilationUnit_library);
1764 // }); 1816 // });
1765 // _ut.test('test_resolveCompilationUnit_source', () { 1817 // _ut.test('test_resolveCompilationUnit_source', () {
1766 // final __test = new AnalysisContextImplTest(); 1818 // final __test = new AnalysisContextImplTest();
1767 // runJUnitTest(__test, __test.test_resolveCompilationUnit_source); 1819 // runJUnitTest(__test, __test.test_resolveCompilationUnit_source);
1768 // }); 1820 // });
1769 // _ut.test('test_resolveCompilationUnit_sourceChangeDuringResolution', () { 1821 // _ut.test('test_resolveCompilationUnit_sourceChangeDuringResolution', () {
1770 // final __test = new AnalysisContextImplTest(); 1822 // final __test = new AnalysisContextImplTest();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 // final __test = new AnalysisContextImplTest(); 1870 // final __test = new AnalysisContextImplTest();
1819 // runJUnitTest(__test, __test.test_unreadableSource); 1871 // runJUnitTest(__test, __test.test_unreadableSource);
1820 // }); 1872 // });
1821 // _ut.test('test_updateAnalysis', () { 1873 // _ut.test('test_updateAnalysis', () {
1822 // final __test = new AnalysisContextImplTest(); 1874 // final __test = new AnalysisContextImplTest();
1823 // runJUnitTest(__test, __test.test_updateAnalysis); 1875 // runJUnitTest(__test, __test.test_updateAnalysis);
1824 // }); 1876 // });
1825 // }); 1877 // });
1826 // } 1878 // }
1827 // } 1879 // }
1828 // class AnalysisContextImpl_AnalysisContextImplTest_test_resolveCompilationUnit _sourceChangeDuringResolution extends AnalysisContextImpl {
1829 // @override
1830 // DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task) {
1831 // ChangeSet changeSet = new ChangeSet();
1832 // changeSet.changedSource(task.librarySource);
1833 // applyChanges(changeSet);
1834 // return super.recordResolveDartLibraryTaskResults(task);
1835 // }
1836 // }
1837 // class AnalysisOptionsImplTest extends EngineTestCase { 1880 // class AnalysisOptionsImplTest extends EngineTestCase {
1838 // void test_AnalysisOptionsImpl_copy() { 1881 // void test_AnalysisOptionsImpl_copy() {
1839 // bool booleanValue = true; 1882 // bool booleanValue = true;
1840 // for (int i = 0; i < 2; i++, booleanValue = !booleanValue) { 1883 // for (int i = 0; i < 2; i++, booleanValue = !booleanValue) {
1841 // AnalysisOptionsImpl options = new AnalysisOptionsImpl(); 1884 // AnalysisOptionsImpl options = new AnalysisOptionsImpl();
1842 // options.analyzeAngular = booleanValue; 1885 // options.analyzeAngular = booleanValue;
1843 // options.analyzeFunctionBodies = booleanValue; 1886 // options.analyzeFunctionBodies = booleanValue;
1844 // options.analyzePolymer = booleanValue; 1887 // options.analyzePolymer = booleanValue;
1845 // options.cacheSize = i; 1888 // options.cacheSize = i;
1846 // options.dart2jsHint = booleanValue; 1889 // options.dart2jsHint = booleanValue;
(...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after
4901 // runJUnitTest(__test, __test.test_perform_non_existing_source_referenc e); 4944 // runJUnitTest(__test, __test.test_perform_non_existing_source_referenc e);
4902 // }); 4945 // });
4903 // _ut.test('test_perform_referenced_source', () { 4946 // _ut.test('test_perform_referenced_source', () {
4904 // final __test = new ParseHtmlTaskTest(); 4947 // final __test = new ParseHtmlTaskTest();
4905 // runJUnitTest(__test, __test.test_perform_referenced_source); 4948 // runJUnitTest(__test, __test.test_perform_referenced_source);
4906 // }); 4949 // });
4907 // }); 4950 // });
4908 // } 4951 // }
4909 // } 4952 // }
4910 // class PartitionManagerTest extends EngineTestCase { 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 // }
4911 // void test_creation() { 4962 // void test_creation() {
4912 // JUnitTestCase.assertNotNull(new PartitionManager()); 4963 // JUnitTestCase.assertNotNull(new PartitionManager());
4913 // } 4964 // }
4914 // void test_forSdk() { 4965 // void test_forSdk() {
4915 // PartitionManager manager = new PartitionManager(); 4966 // PartitionManager manager = new PartitionManager();
4916 // DartSdk sdk1 = new MockDartSdk(); 4967 // DartSdk sdk1 = new MockDartSdk();
4917 // SdkCachePartition partition1 = manager.forSdk(sdk1); 4968 // SdkCachePartition partition1 = manager.forSdk(sdk1);
4918 // JUnitTestCase.assertNotNull(partition1); 4969 // JUnitTestCase.assertNotNull(partition1);
4919 // JUnitTestCase.assertSame(partition1, manager.forSdk(sdk1)); 4970 // JUnitTestCase.assertSame(partition1, manager.forSdk(sdk1));
4920 // DartSdk sdk2 = new MockDartSdk(); 4971 // DartSdk sdk2 = new MockDartSdk();
4921 // SdkCachePartition partition2 = manager.forSdk(sdk2); 4972 // SdkCachePartition partition2 = manager.forSdk(sdk2);
4922 // JUnitTestCase.assertNotNull(partition2); 4973 // JUnitTestCase.assertNotNull(partition2);
4923 // JUnitTestCase.assertSame(partition2, manager.forSdk(sdk2)); 4974 // JUnitTestCase.assertSame(partition2, manager.forSdk(sdk2));
4924 // JUnitTestCase.assertNotSame(partition1, partition2); 4975 // JUnitTestCase.assertNotSame(partition1, partition2);
4925 // } 4976 // }
4926 // static dartSuite() { 4977 // static dartSuite() {
4927 // _ut.group('PartitionManagerTest', () { 4978 // _ut.group('PartitionManagerTest', () {
4979 // _ut.test('test_clearCache', () {
4980 // final __test = new PartitionManagerTest();
4981 // runJUnitTest(__test, __test.test_clearCache);
4982 // });
4928 // _ut.test('test_creation', () { 4983 // _ut.test('test_creation', () {
4929 // final __test = new PartitionManagerTest(); 4984 // final __test = new PartitionManagerTest();
4930 // runJUnitTest(__test, __test.test_creation); 4985 // runJUnitTest(__test, __test.test_creation);
4931 // }); 4986 // });
4932 // _ut.test('test_forSdk', () { 4987 // _ut.test('test_forSdk', () {
4933 // final __test = new PartitionManagerTest(); 4988 // final __test = new PartitionManagerTest();
4934 // runJUnitTest(__test, __test.test_forSdk); 4989 // runJUnitTest(__test, __test.test_forSdk);
4935 // }); 4990 // });
4936 // }); 4991 // });
4937 // } 4992 // }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
5037 // } 5092 // }
5038 // void test_perform_exception() { 5093 // void test_perform_exception() {
5039 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore( ); 5094 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore( );
5040 // LibraryElementImpl element = ElementFactory.library(context, "lib"); 5095 // LibraryElementImpl element = ElementFactory.library(context, "lib");
5041 // TestSource source = new TestSource(); 5096 // TestSource source = new TestSource();
5042 // source.generateExceptionOnRead = true; 5097 // source.generateExceptionOnRead = true;
5043 // (element.definingCompilationUnit as CompilationUnitElementImpl).source = source; 5098 // (element.definingCompilationUnit as CompilationUnitElementImpl).source = source;
5044 // ResolveDartUnitTask task = new ResolveDartUnitTask(context, source, eleme nt); 5099 // ResolveDartUnitTask task = new ResolveDartUnitTask(context, source, eleme nt);
5045 // task.perform(new TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_exc eption()); 5100 // task.perform(new TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_exc eption());
5046 // } 5101 // }
5047 // void xtest_perform_library() { 5102 // void test_perform_library() {
5048 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore( ); 5103 // InternalAnalysisContext context = AnalysisContextFactory.contextWithCore( );
5049 // LibraryElementImpl libraryElement = ElementFactory.library(context, "lib" ); 5104 // LibraryElementImpl libraryElement = ElementFactory.library(context, "lib" );
5050 // CompilationUnitElementImpl unitElement = libraryElement.definingCompilati onUnit as CompilationUnitElementImpl; 5105 // CompilationUnitElementImpl unitElement = libraryElement.definingCompilati onUnit as CompilationUnitElementImpl;
5051 // ClassElementImpl classElement = ElementFactory.classElement2("A", []); 5106 // ClassElementImpl classElement = ElementFactory.classElement2("A", []);
5052 // classElement.nameOffset = 19; 5107 // classElement.nameOffset = 19;
5053 // ConstructorElementImpl constructorElement = ElementFactory.constructorEle ment2(classElement, null, []); 5108 // ConstructorElementImpl constructorElement = ElementFactory.constructorEle ment2(classElement, null, []);
5054 // constructorElement.synthetic = true; 5109 // constructorElement.synthetic = true;
5055 // classElement.constructors = <ConstructorElement> [constructorElement]; 5110 // classElement.constructors = <ConstructorElement> [constructorElement];
5056 // unitElement.types = <ClassElement> [classElement]; 5111 // unitElement.types = <ClassElement> [classElement];
5057 // Source source = unitElement.source; 5112 // Source source = unitElement.source;
5058 // context.setContents(source, EngineTestCase.createSource(["library lib;", "class A {}"])); 5113 // context.setContents(source, EngineTestCase.createSource(["library lib;", "class A {}"]));
5059 // ResolveDartUnitTask task = new ResolveDartUnitTask(context, source, libra ryElement); 5114 // ResolveDartUnitTask task = new ResolveDartUnitTask(context, source, libra ryElement);
5060 // task.perform(new TestTaskVisitor_ResolveDartUnitTaskTest_xtest_perform_li brary(source, context)); 5115 // task.perform(new TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_lib rary(source, context));
5061 // } 5116 // }
5062 // static dartSuite() { 5117 // static dartSuite() {
5063 // _ut.group('ResolveDartUnitTaskTest', () { 5118 // _ut.group('ResolveDartUnitTaskTest', () {
5064 // _ut.test('test_accept', () { 5119 // _ut.test('test_accept', () {
5065 // final __test = new ResolveDartUnitTaskTest(); 5120 // final __test = new ResolveDartUnitTaskTest();
5066 // runJUnitTest(__test, __test.test_accept); 5121 // runJUnitTest(__test, __test.test_accept);
5067 // }); 5122 // });
5068 // _ut.test('test_getException', () { 5123 // _ut.test('test_getException', () {
5069 // final __test = new ResolveDartUnitTaskTest(); 5124 // final __test = new ResolveDartUnitTaskTest();
5070 // runJUnitTest(__test, __test.test_getException); 5125 // runJUnitTest(__test, __test.test_getException);
(...skipping 11 matching lines...) Expand all
5082 // runJUnitTest(__test, __test.test_getResolvedUnit); 5137 // runJUnitTest(__test, __test.test_getResolvedUnit);
5083 // }); 5138 // });
5084 // _ut.test('test_getSource', () { 5139 // _ut.test('test_getSource', () {
5085 // final __test = new ResolveDartUnitTaskTest(); 5140 // final __test = new ResolveDartUnitTaskTest();
5086 // runJUnitTest(__test, __test.test_getSource); 5141 // runJUnitTest(__test, __test.test_getSource);
5087 // }); 5142 // });
5088 // _ut.test('test_perform_exception', () { 5143 // _ut.test('test_perform_exception', () {
5089 // final __test = new ResolveDartUnitTaskTest(); 5144 // final __test = new ResolveDartUnitTaskTest();
5090 // runJUnitTest(__test, __test.test_perform_exception); 5145 // runJUnitTest(__test, __test.test_perform_exception);
5091 // }); 5146 // });
5147 // _ut.test('test_perform_library', () {
5148 // final __test = new ResolveDartUnitTaskTest();
5149 // runJUnitTest(__test, __test.test_perform_library);
5150 // });
5092 // }); 5151 // });
5093 // } 5152 // }
5094 // } 5153 // }
5095 // class ResolveHtmlTaskTest extends EngineTestCase { 5154 // class ResolveHtmlTaskTest extends EngineTestCase {
5096 // void test_accept() { 5155 // void test_accept() {
5097 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); 5156 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null);
5098 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_ResolveHtmlTaskT est_test_accept())); 5157 // JUnitTestCase.assertTrue(task.accept(new TestTaskVisitor_ResolveHtmlTaskT est_test_accept()));
5099 // } 5158 // }
5100 // void test_getElement() { 5159 // void test_getElement() {
5101 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); 5160 // ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null);
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
6466 // @override 6525 // @override
6467 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) => true; 6526 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) => true;
6468 // } 6527 // }
6469 // class TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_exception extends TestTaskVisitor<Boolean> { 6528 // class TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_exception extends TestTaskVisitor<Boolean> {
6470 // @override 6529 // @override
6471 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) { 6530 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) {
6472 // JUnitTestCase.assertNotNull(task.exception); 6531 // JUnitTestCase.assertNotNull(task.exception);
6473 // return true; 6532 // return true;
6474 // } 6533 // }
6475 // } 6534 // }
6476 // class TestTaskVisitor_ResolveDartUnitTaskTest_xtest_perform_library extends T estTaskVisitor<Boolean> { 6535 // class TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_library extends Te stTaskVisitor<Boolean> {
6477 // Source source; 6536 // Source source;
6478 // InternalAnalysisContext context; 6537 // InternalAnalysisContext context;
6479 // TestTaskVisitor_ResolveDartUnitTaskTest_xtest_perform_library(this.source, this.context) : super(); 6538 // TestTaskVisitor_ResolveDartUnitTaskTest_test_perform_library(this.source, t his.context) : super();
6480 // @override 6539 // @override
6481 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) { 6540 // bool visitResolveDartUnitTask(ResolveDartUnitTask task) {
6482 // CaughtException exception = task.exception; 6541 // CaughtException exception = task.exception;
6483 // if (exception != null) { 6542 // if (exception != null) {
6484 // throw exception; 6543 // throw exception;
6485 // } 6544 // }
6486 // JUnitTestCase.assertSame(source, task.librarySource); 6545 // JUnitTestCase.assertSame(source, task.librarySource);
6487 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod ificationTime); 6546 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod ificationTime);
6488 // JUnitTestCase.assertNotNull(task.resolvedUnit); 6547 // JUnitTestCase.assertNotNull(task.resolvedUnit);
6489 // JUnitTestCase.assertSame(source, task.source); 6548 // JUnitTestCase.assertSame(source, task.source);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
6770 // AnalysisCacheTest.dartSuite(); 6829 // AnalysisCacheTest.dartSuite();
6771 // DartEntryImplTest.dartSuite(); 6830 // DartEntryImplTest.dartSuite();
6772 // HtmlEntryImplTest.dartSuite(); 6831 // HtmlEntryImplTest.dartSuite();
6773 // PartitionManagerTest.dartSuite(); 6832 // PartitionManagerTest.dartSuite();
6774 // SdkCachePartitionTest.dartSuite(); 6833 // SdkCachePartitionTest.dartSuite();
6775 // UniversalCachePartitionTest.dartSuite(); 6834 // UniversalCachePartitionTest.dartSuite();
6776 // } 6835 // }
6777 6836
6778 main() { 6837 main() {
6779 } 6838 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/element_test.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698