Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.engine_test; | 8 library engine.engine_test; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); | 71 AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); |
| 72 TestSource source = new TestSource(); | 72 TestSource source = new TestSource(); |
| 73 JUnitTestCase.assertNull(cache.get(source)); | 73 JUnitTestCase.assertNull(cache.get(source)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void test_iterator() { | 76 void test_iterator() { |
| 77 CachePartition partition = | 77 CachePartition partition = |
| 78 new UniversalCachePartition(null, 8, new DefaultRetentionPolicy()); | 78 new UniversalCachePartition(null, 8, new DefaultRetentionPolicy()); |
| 79 AnalysisCache cache = new AnalysisCache(<CachePartition>[partition]); | 79 AnalysisCache cache = new AnalysisCache(<CachePartition>[partition]); |
| 80 TestSource source = new TestSource(); | 80 TestSource source = new TestSource(); |
| 81 DartEntryImpl entry = new DartEntryImpl(); | 81 DartEntry entry = new DartEntry(); |
| 82 cache.put(source, entry); | 82 cache.put(source, entry); |
| 83 MapIterator<Source, SourceEntry> iterator = cache.iterator(); | 83 MapIterator<Source, SourceEntry> iterator = cache.iterator(); |
| 84 JUnitTestCase.assertTrue(iterator.moveNext()); | 84 JUnitTestCase.assertTrue(iterator.moveNext()); |
| 85 JUnitTestCase.assertSame(source, iterator.key); | 85 JUnitTestCase.assertSame(source, iterator.key); |
| 86 JUnitTestCase.assertSame(entry, iterator.value); | 86 JUnitTestCase.assertSame(entry, iterator.value); |
| 87 JUnitTestCase.assertFalse(iterator.moveNext()); | 87 JUnitTestCase.assertFalse(iterator.moveNext()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void test_put_noFlush() { | 90 void test_put_noFlush() { |
| 91 CachePartition partition = | 91 CachePartition partition = |
| 92 new UniversalCachePartition(null, 8, new DefaultRetentionPolicy()); | 92 new UniversalCachePartition(null, 8, new DefaultRetentionPolicy()); |
| 93 AnalysisCache cache = new AnalysisCache(<CachePartition>[partition]); | 93 AnalysisCache cache = new AnalysisCache(<CachePartition>[partition]); |
| 94 TestSource source = new TestSource(); | 94 TestSource source = new TestSource(); |
| 95 DartEntryImpl entry = new DartEntryImpl(); | 95 DartEntry entry = new DartEntry(); |
| 96 cache.put(source, entry); | 96 cache.put(source, entry); |
| 97 JUnitTestCase.assertSame(entry, cache.get(source)); | 97 JUnitTestCase.assertSame(entry, cache.get(source)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void test_setMaxCacheSize() { | 100 void test_setMaxCacheSize() { |
| 101 CachePartition partition = new UniversalCachePartition( | 101 CachePartition partition = new UniversalCachePartition( |
| 102 null, | 102 null, |
| 103 8, | 103 8, |
| 104 new _AnalysisCacheTest_test_setMaxCacheSize()); | 104 new _AnalysisCacheTest_test_setMaxCacheSize()); |
| 105 AnalysisCache cache = new AnalysisCache(<CachePartition>[partition]); | 105 AnalysisCache cache = new AnalysisCache(<CachePartition>[partition]); |
| 106 int size = 6; | 106 int size = 6; |
| 107 for (int i = 0; i < size; i++) { | 107 for (int i = 0; i < size; i++) { |
| 108 Source source = new TestSource("/test${i}.dart"); | 108 Source source = new TestSource("/test${i}.dart"); |
| 109 DartEntryImpl entry = new DartEntryImpl(); | 109 DartEntry entry = new DartEntry(); |
| 110 entry.setValue(DartEntry.PARSED_UNIT, null); | 110 entry.setValue(DartEntry.PARSED_UNIT, null); |
| 111 cache.put(source, entry); | 111 cache.put(source, entry); |
| 112 cache.accessedAst(source); | 112 cache.accessedAst(source); |
| 113 } | 113 } |
| 114 _assertNonFlushedCount(size, cache); | 114 _assertNonFlushedCount(size, cache); |
| 115 int newSize = size - 2; | 115 int newSize = size - 2; |
| 116 partition.maxCacheSize = newSize; | 116 partition.maxCacheSize = newSize; |
| 117 _assertNonFlushedCount(newSize, cache); | 117 _assertNonFlushedCount(newSize, cache); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void test_size() { | 120 void test_size() { |
| 121 CachePartition partition = | 121 CachePartition partition = |
| 122 new UniversalCachePartition(null, 8, new DefaultRetentionPolicy()); | 122 new UniversalCachePartition(null, 8, new DefaultRetentionPolicy()); |
| 123 AnalysisCache cache = new AnalysisCache(<CachePartition>[partition]); | 123 AnalysisCache cache = new AnalysisCache(<CachePartition>[partition]); |
| 124 int size = 4; | 124 int size = 4; |
| 125 for (int i = 0; i < size; i++) { | 125 for (int i = 0; i < size; i++) { |
| 126 Source source = new TestSource("/test${i}.dart"); | 126 Source source = new TestSource("/test${i}.dart"); |
| 127 cache.put(source, new DartEntryImpl()); | 127 cache.put(source, new DartEntry()); |
| 128 cache.accessedAst(source); | 128 cache.accessedAst(source); |
| 129 } | 129 } |
| 130 JUnitTestCase.assertEquals(size, cache.size()); | 130 JUnitTestCase.assertEquals(size, cache.size()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void _assertNonFlushedCount(int expectedCount, AnalysisCache cache) { | 133 void _assertNonFlushedCount(int expectedCount, AnalysisCache cache) { |
| 134 int nonFlushedCount = 0; | 134 int nonFlushedCount = 0; |
| 135 MapIterator<Source, SourceEntry> iterator = cache.iterator(); | 135 MapIterator<Source, SourceEntry> iterator = cache.iterator(); |
| 136 while (iterator.moveNext()) { | 136 while (iterator.moveNext()) { |
| 137 if (iterator.value.getState(DartEntry.PARSED_UNIT) != | 137 if (iterator.value.getState(DartEntry.PARSED_UNIT) != |
| (...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2700 throw new AnalysisException("Forced exception"); | 2700 throw new AnalysisException("Forced exception"); |
| 2701 } | 2701 } |
| 2702 } | 2702 } |
| 2703 | 2703 |
| 2704 | 2704 |
| 2705 class CompilationUnitMock extends TypedMock implements CompilationUnit { | 2705 class CompilationUnitMock extends TypedMock implements CompilationUnit { |
| 2706 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 2706 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 2707 } | 2707 } |
| 2708 | 2708 |
| 2709 | 2709 |
| 2710 class DartEntryImplTest extends EngineTestCase { | 2710 class DartEntryImplTest extends EngineTestCase { |
|
scheglov
2014/10/06 19:30:22
You could also rename the corresponding Test class
Brian Wilkerson
2014/10/06 19:43:27
Done
| |
| 2711 void set state2(DataDescriptor descriptor) { | 2711 void set state2(DataDescriptor descriptor) { |
| 2712 DartEntryImpl entry = new DartEntryImpl(); | 2712 DartEntry entry = new DartEntry(); |
| 2713 JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getState(descriptor)); | 2713 JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getState(descriptor)); |
| 2714 entry.setState(descriptor, CacheState.FLUSHED); | 2714 entry.setState(descriptor, CacheState.FLUSHED); |
| 2715 JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getState(descriptor)); | 2715 JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getState(descriptor)); |
| 2716 } | 2716 } |
| 2717 | 2717 |
| 2718 void set state3(DataDescriptor descriptor) { | 2718 void set state3(DataDescriptor descriptor) { |
| 2719 Source source = new TestSource(); | 2719 Source source = new TestSource(); |
| 2720 DartEntryImpl entry = new DartEntryImpl(); | 2720 DartEntry entry = new DartEntry(); |
| 2721 JUnitTestCase.assertNotSame( | 2721 JUnitTestCase.assertNotSame( |
| 2722 CacheState.FLUSHED, | 2722 CacheState.FLUSHED, |
| 2723 entry.getStateInLibrary(descriptor, source)); | 2723 entry.getStateInLibrary(descriptor, source)); |
| 2724 entry.setStateInLibrary(descriptor, source, CacheState.FLUSHED); | 2724 entry.setStateInLibrary(descriptor, source, CacheState.FLUSHED); |
| 2725 JUnitTestCase.assertSame( | 2725 JUnitTestCase.assertSame( |
| 2726 CacheState.FLUSHED, | 2726 CacheState.FLUSHED, |
| 2727 entry.getStateInLibrary(descriptor, source)); | 2727 entry.getStateInLibrary(descriptor, source)); |
| 2728 } | 2728 } |
| 2729 | 2729 |
| 2730 void test_creation() { | 2730 void test_creation() { |
| 2731 Source librarySource = new TestSource(); | 2731 Source librarySource = new TestSource(); |
| 2732 DartEntryImpl entry = new DartEntryImpl(); | 2732 DartEntry entry = new DartEntry(); |
| 2733 JUnitTestCase.assertSame( | 2733 JUnitTestCase.assertSame( |
| 2734 CacheState.INVALID, | 2734 CacheState.INVALID, |
| 2735 entry.getState(SourceEntry.CONTENT)); | 2735 entry.getState(SourceEntry.CONTENT)); |
| 2736 JUnitTestCase.assertSame( | 2736 JUnitTestCase.assertSame( |
| 2737 CacheState.INVALID, | 2737 CacheState.INVALID, |
| 2738 entry.getState(DartEntry.ELEMENT)); | 2738 entry.getState(DartEntry.ELEMENT)); |
| 2739 JUnitTestCase.assertSame( | 2739 JUnitTestCase.assertSame( |
| 2740 CacheState.INVALID, | 2740 CacheState.INVALID, |
| 2741 entry.getState(DartEntry.EXPORTED_LIBRARIES)); | 2741 entry.getState(DartEntry.EXPORTED_LIBRARIES)); |
| 2742 JUnitTestCase.assertSame( | 2742 JUnitTestCase.assertSame( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2781 JUnitTestCase.assertSame( | 2781 JUnitTestCase.assertSame( |
| 2782 CacheState.INVALID, | 2782 CacheState.INVALID, |
| 2783 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource)); | 2783 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource)); |
| 2784 JUnitTestCase.assertSame( | 2784 JUnitTestCase.assertSame( |
| 2785 CacheState.INVALID, | 2785 CacheState.INVALID, |
| 2786 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource)); | 2786 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource)); |
| 2787 } | 2787 } |
| 2788 | 2788 |
| 2789 void test_getAllErrors() { | 2789 void test_getAllErrors() { |
| 2790 Source source = new TestSource(); | 2790 Source source = new TestSource(); |
| 2791 DartEntryImpl entry = new DartEntryImpl(); | 2791 DartEntry entry = new DartEntry(); |
| 2792 EngineTestCase.assertLength(0, entry.allErrors); | 2792 EngineTestCase.assertLength(0, entry.allErrors); |
| 2793 entry.setValue( | 2793 entry.setValue( |
| 2794 DartEntry.SCAN_ERRORS, | 2794 DartEntry.SCAN_ERRORS, |
| 2795 <AnalysisError>[ | 2795 <AnalysisError>[ |
| 2796 new AnalysisError.con1( | 2796 new AnalysisError.con1( |
| 2797 source, | 2797 source, |
| 2798 ScannerErrorCode.UNTERMINATED_STRING_LITERAL, | 2798 ScannerErrorCode.UNTERMINATED_STRING_LITERAL, |
| 2799 [])]); | 2799 [])]); |
| 2800 entry.setValue( | 2800 entry.setValue( |
| 2801 DartEntry.PARSE_ERRORS, | 2801 DartEntry.PARSE_ERRORS, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 2818 StaticWarningCode.CASE_BLOCK_NOT_TERMINATED, | 2818 StaticWarningCode.CASE_BLOCK_NOT_TERMINATED, |
| 2819 [])]); | 2819 [])]); |
| 2820 entry.setValueInLibrary( | 2820 entry.setValueInLibrary( |
| 2821 DartEntry.HINTS, | 2821 DartEntry.HINTS, |
| 2822 source, | 2822 source, |
| 2823 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE, [])]) ; | 2823 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE, [])]) ; |
| 2824 EngineTestCase.assertLength(5, entry.allErrors); | 2824 EngineTestCase.assertLength(5, entry.allErrors); |
| 2825 } | 2825 } |
| 2826 | 2826 |
| 2827 void test_getResolvableCompilationUnit_none() { | 2827 void test_getResolvableCompilationUnit_none() { |
| 2828 DartEntryImpl entry = new DartEntryImpl(); | 2828 DartEntry entry = new DartEntry(); |
| 2829 JUnitTestCase.assertNull(entry.resolvableCompilationUnit); | 2829 JUnitTestCase.assertNull(entry.resolvableCompilationUnit); |
| 2830 } | 2830 } |
| 2831 | 2831 |
| 2832 void test_getResolvableCompilationUnit_parsed_accessed() { | 2832 void test_getResolvableCompilationUnit_parsed_accessed() { |
| 2833 String importUri = "f1.dart"; | 2833 String importUri = "f1.dart"; |
| 2834 Source importSource = new TestSource(importUri); | 2834 Source importSource = new TestSource(importUri); |
| 2835 ImportDirective importDirective = | 2835 ImportDirective importDirective = |
| 2836 AstFactory.importDirective3(importUri, null, []); | 2836 AstFactory.importDirective3(importUri, null, []); |
| 2837 importDirective.source = importSource; | 2837 importDirective.source = importSource; |
| 2838 importDirective.uriContent = importUri; | 2838 importDirective.uriContent = importUri; |
| 2839 String exportUri = "f2.dart"; | 2839 String exportUri = "f2.dart"; |
| 2840 Source exportSource = new TestSource(exportUri); | 2840 Source exportSource = new TestSource(exportUri); |
| 2841 ExportDirective exportDirective = | 2841 ExportDirective exportDirective = |
| 2842 AstFactory.exportDirective2(exportUri, []); | 2842 AstFactory.exportDirective2(exportUri, []); |
| 2843 exportDirective.source = exportSource; | 2843 exportDirective.source = exportSource; |
| 2844 exportDirective.uriContent = exportUri; | 2844 exportDirective.uriContent = exportUri; |
| 2845 String partUri = "f3.dart"; | 2845 String partUri = "f3.dart"; |
| 2846 Source partSource = new TestSource(partUri); | 2846 Source partSource = new TestSource(partUri); |
| 2847 PartDirective partDirective = AstFactory.partDirective2(partUri); | 2847 PartDirective partDirective = AstFactory.partDirective2(partUri); |
| 2848 partDirective.source = partSource; | 2848 partDirective.source = partSource; |
| 2849 partDirective.uriContent = partUri; | 2849 partDirective.uriContent = partUri; |
| 2850 CompilationUnit unit = | 2850 CompilationUnit unit = |
| 2851 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]); | 2851 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]); |
| 2852 DartEntryImpl entry = new DartEntryImpl(); | 2852 DartEntry entry = new DartEntry(); |
| 2853 entry.setValue(DartEntry.PARSED_UNIT, unit); | 2853 entry.setValue(DartEntry.PARSED_UNIT, unit); |
| 2854 entry.getValue(DartEntry.PARSED_UNIT); | 2854 entry.getValue(DartEntry.PARSED_UNIT); |
| 2855 CompilationUnit result = entry.resolvableCompilationUnit; | 2855 CompilationUnit result = entry.resolvableCompilationUnit; |
| 2856 JUnitTestCase.assertNotSame(unit, result); | 2856 JUnitTestCase.assertNotSame(unit, result); |
| 2857 NodeList<Directive> directives = result.directives; | 2857 NodeList<Directive> directives = result.directives; |
| 2858 ImportDirective resultImportDirective = directives[0] as ImportDirective; | 2858 ImportDirective resultImportDirective = directives[0] as ImportDirective; |
| 2859 JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); | 2859 JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); |
| 2860 JUnitTestCase.assertSame(importSource, resultImportDirective.source); | 2860 JUnitTestCase.assertSame(importSource, resultImportDirective.source); |
| 2861 ExportDirective resultExportDirective = directives[1] as ExportDirective; | 2861 ExportDirective resultExportDirective = directives[1] as ExportDirective; |
| 2862 JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); | 2862 JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); |
| 2863 JUnitTestCase.assertSame(exportSource, resultExportDirective.source); | 2863 JUnitTestCase.assertSame(exportSource, resultExportDirective.source); |
| 2864 PartDirective resultPartDirective = directives[2] as PartDirective; | 2864 PartDirective resultPartDirective = directives[2] as PartDirective; |
| 2865 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); | 2865 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); |
| 2866 JUnitTestCase.assertSame(partSource, resultPartDirective.source); | 2866 JUnitTestCase.assertSame(partSource, resultPartDirective.source); |
| 2867 } | 2867 } |
| 2868 | 2868 |
| 2869 void test_getResolvableCompilationUnit_parsed_notAccessed() { | 2869 void test_getResolvableCompilationUnit_parsed_notAccessed() { |
| 2870 CompilationUnit unit = AstFactory.compilationUnit(); | 2870 CompilationUnit unit = AstFactory.compilationUnit(); |
| 2871 DartEntryImpl entry = new DartEntryImpl(); | 2871 DartEntry entry = new DartEntry(); |
| 2872 entry.setValue(DartEntry.PARSED_UNIT, unit); | 2872 entry.setValue(DartEntry.PARSED_UNIT, unit); |
| 2873 JUnitTestCase.assertSame(unit, entry.resolvableCompilationUnit); | 2873 JUnitTestCase.assertSame(unit, entry.resolvableCompilationUnit); |
| 2874 } | 2874 } |
| 2875 | 2875 |
| 2876 void test_getResolvableCompilationUnit_resolved() { | 2876 void test_getResolvableCompilationUnit_resolved() { |
| 2877 String importUri = "f1.dart"; | 2877 String importUri = "f1.dart"; |
| 2878 Source importSource = new TestSource(importUri); | 2878 Source importSource = new TestSource(importUri); |
| 2879 ImportDirective importDirective = | 2879 ImportDirective importDirective = |
| 2880 AstFactory.importDirective3(importUri, null, []); | 2880 AstFactory.importDirective3(importUri, null, []); |
| 2881 importDirective.source = importSource; | 2881 importDirective.source = importSource; |
| 2882 importDirective.uriContent = importUri; | 2882 importDirective.uriContent = importUri; |
| 2883 String exportUri = "f2.dart"; | 2883 String exportUri = "f2.dart"; |
| 2884 Source exportSource = new TestSource(exportUri); | 2884 Source exportSource = new TestSource(exportUri); |
| 2885 ExportDirective exportDirective = | 2885 ExportDirective exportDirective = |
| 2886 AstFactory.exportDirective2(exportUri, []); | 2886 AstFactory.exportDirective2(exportUri, []); |
| 2887 exportDirective.source = exportSource; | 2887 exportDirective.source = exportSource; |
| 2888 exportDirective.uriContent = exportUri; | 2888 exportDirective.uriContent = exportUri; |
| 2889 String partUri = "f3.dart"; | 2889 String partUri = "f3.dart"; |
| 2890 Source partSource = new TestSource(partUri); | 2890 Source partSource = new TestSource(partUri); |
| 2891 PartDirective partDirective = AstFactory.partDirective2(partUri); | 2891 PartDirective partDirective = AstFactory.partDirective2(partUri); |
| 2892 partDirective.source = partSource; | 2892 partDirective.source = partSource; |
| 2893 partDirective.uriContent = partUri; | 2893 partDirective.uriContent = partUri; |
| 2894 CompilationUnit unit = | 2894 CompilationUnit unit = |
| 2895 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]); | 2895 AstFactory.compilationUnit3([importDirective, exportDirective, partDirec tive]); |
| 2896 DartEntryImpl entry = new DartEntryImpl(); | 2896 DartEntry entry = new DartEntry(); |
| 2897 entry.setValueInLibrary( | 2897 entry.setValueInLibrary( |
| 2898 DartEntry.RESOLVED_UNIT, | 2898 DartEntry.RESOLVED_UNIT, |
| 2899 new TestSource("lib.dart"), | 2899 new TestSource("lib.dart"), |
| 2900 unit); | 2900 unit); |
| 2901 CompilationUnit result = entry.resolvableCompilationUnit; | 2901 CompilationUnit result = entry.resolvableCompilationUnit; |
| 2902 JUnitTestCase.assertNotSame(unit, result); | 2902 JUnitTestCase.assertNotSame(unit, result); |
| 2903 NodeList<Directive> directives = result.directives; | 2903 NodeList<Directive> directives = result.directives; |
| 2904 ImportDirective resultImportDirective = directives[0] as ImportDirective; | 2904 ImportDirective resultImportDirective = directives[0] as ImportDirective; |
| 2905 JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); | 2905 JUnitTestCase.assertEquals(importUri, resultImportDirective.uriContent); |
| 2906 JUnitTestCase.assertSame(importSource, resultImportDirective.source); | 2906 JUnitTestCase.assertSame(importSource, resultImportDirective.source); |
| 2907 ExportDirective resultExportDirective = directives[1] as ExportDirective; | 2907 ExportDirective resultExportDirective = directives[1] as ExportDirective; |
| 2908 JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); | 2908 JUnitTestCase.assertEquals(exportUri, resultExportDirective.uriContent); |
| 2909 JUnitTestCase.assertSame(exportSource, resultExportDirective.source); | 2909 JUnitTestCase.assertSame(exportSource, resultExportDirective.source); |
| 2910 PartDirective resultPartDirective = directives[2] as PartDirective; | 2910 PartDirective resultPartDirective = directives[2] as PartDirective; |
| 2911 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); | 2911 JUnitTestCase.assertEquals(partUri, resultPartDirective.uriContent); |
| 2912 JUnitTestCase.assertSame(partSource, resultPartDirective.source); | 2912 JUnitTestCase.assertSame(partSource, resultPartDirective.source); |
| 2913 } | 2913 } |
| 2914 | 2914 |
| 2915 void test_getStateInLibrary_invalid_element() { | 2915 void test_getStateInLibrary_invalid_element() { |
| 2916 DartEntryImpl entry = new DartEntryImpl(); | 2916 DartEntry entry = new DartEntry(); |
| 2917 try { | 2917 try { |
| 2918 entry.getStateInLibrary(DartEntry.ELEMENT, new TestSource()); | 2918 entry.getStateInLibrary(DartEntry.ELEMENT, new TestSource()); |
| 2919 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); | 2919 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); |
| 2920 } on IllegalArgumentException catch (exception) { | 2920 } on IllegalArgumentException catch (exception) { |
| 2921 // Expected | 2921 // Expected |
| 2922 } | 2922 } |
| 2923 } | 2923 } |
| 2924 | 2924 |
| 2925 void test_getState_invalid_resolutionErrors() { | 2925 void test_getState_invalid_resolutionErrors() { |
| 2926 DartEntryImpl entry = new DartEntryImpl(); | 2926 DartEntry entry = new DartEntry(); |
| 2927 try { | 2927 try { |
| 2928 entry.getState(DartEntry.RESOLUTION_ERRORS); | 2928 entry.getState(DartEntry.RESOLUTION_ERRORS); |
| 2929 JUnitTestCase.fail( | 2929 JUnitTestCase.fail( |
| 2930 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); | 2930 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); |
| 2931 } on IllegalArgumentException catch (exception) { | 2931 } on IllegalArgumentException catch (exception) { |
| 2932 // Expected | 2932 // Expected |
| 2933 } | 2933 } |
| 2934 } | 2934 } |
| 2935 | 2935 |
| 2936 void test_getState_invalid_verificationErrors() { | 2936 void test_getState_invalid_verificationErrors() { |
| 2937 DartEntryImpl entry = new DartEntryImpl(); | 2937 DartEntry entry = new DartEntry(); |
| 2938 try { | 2938 try { |
| 2939 entry.getState(DartEntry.VERIFICATION_ERRORS); | 2939 entry.getState(DartEntry.VERIFICATION_ERRORS); |
| 2940 JUnitTestCase.fail( | 2940 JUnitTestCase.fail( |
| 2941 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); | 2941 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); |
| 2942 } on IllegalArgumentException catch (exception) { | 2942 } on IllegalArgumentException catch (exception) { |
| 2943 // Expected | 2943 // Expected |
| 2944 } | 2944 } |
| 2945 } | 2945 } |
| 2946 | 2946 |
| 2947 void test_getValueInLibrary_invalid_element() { | 2947 void test_getValueInLibrary_invalid_element() { |
| 2948 DartEntryImpl entry = new DartEntryImpl(); | 2948 DartEntry entry = new DartEntry(); |
| 2949 try { | 2949 try { |
| 2950 entry.getValueInLibrary(DartEntry.ELEMENT, new TestSource()); | 2950 entry.getValueInLibrary(DartEntry.ELEMENT, new TestSource()); |
| 2951 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); | 2951 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); |
| 2952 } on IllegalArgumentException catch (exception) { | 2952 } on IllegalArgumentException catch (exception) { |
| 2953 // Expected | 2953 // Expected |
| 2954 } | 2954 } |
| 2955 } | 2955 } |
| 2956 | 2956 |
| 2957 void test_getValueInLibrary_invalid_resolutionErrors_multiple() { | 2957 void test_getValueInLibrary_invalid_resolutionErrors_multiple() { |
| 2958 Source source1 = new TestSource(); | 2958 Source source1 = new TestSource(); |
| 2959 Source source2 = new TestSource(); | 2959 Source source2 = new TestSource(); |
| 2960 Source source3 = new TestSource(); | 2960 Source source3 = new TestSource(); |
| 2961 DartEntryImpl entry = new DartEntryImpl(); | 2961 DartEntry entry = new DartEntry(); |
| 2962 entry.setValueInLibrary( | 2962 entry.setValueInLibrary( |
| 2963 DartEntry.RESOLVED_UNIT, | 2963 DartEntry.RESOLVED_UNIT, |
| 2964 source1, | 2964 source1, |
| 2965 AstFactory.compilationUnit()); | 2965 AstFactory.compilationUnit()); |
| 2966 entry.setValueInLibrary( | 2966 entry.setValueInLibrary( |
| 2967 DartEntry.RESOLVED_UNIT, | 2967 DartEntry.RESOLVED_UNIT, |
| 2968 source2, | 2968 source2, |
| 2969 AstFactory.compilationUnit()); | 2969 AstFactory.compilationUnit()); |
| 2970 entry.setValueInLibrary( | 2970 entry.setValueInLibrary( |
| 2971 DartEntry.RESOLVED_UNIT, | 2971 DartEntry.RESOLVED_UNIT, |
| 2972 source3, | 2972 source3, |
| 2973 AstFactory.compilationUnit()); | 2973 AstFactory.compilationUnit()); |
| 2974 try { | 2974 try { |
| 2975 entry.getValueInLibrary(DartEntry.ELEMENT, source3); | 2975 entry.getValueInLibrary(DartEntry.ELEMENT, source3); |
| 2976 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); | 2976 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); |
| 2977 } on IllegalArgumentException catch (exception) { | 2977 } on IllegalArgumentException catch (exception) { |
| 2978 // Expected | 2978 // Expected |
| 2979 } | 2979 } |
| 2980 } | 2980 } |
| 2981 | 2981 |
| 2982 void test_getValue_containingLibraries() { | 2982 void test_getValue_containingLibraries() { |
| 2983 Source testSource = new TestSource(); | 2983 Source testSource = new TestSource(); |
| 2984 DartEntryImpl entry = new DartEntryImpl(); | 2984 DartEntry entry = new DartEntry(); |
| 2985 List<Source> value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); | 2985 List<Source> value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); |
| 2986 EngineTestCase.assertLength(0, value); | 2986 EngineTestCase.assertLength(0, value); |
| 2987 entry.addContainingLibrary(testSource); | 2987 entry.addContainingLibrary(testSource); |
| 2988 value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); | 2988 value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); |
| 2989 EngineTestCase.assertLength(1, value); | 2989 EngineTestCase.assertLength(1, value); |
| 2990 JUnitTestCase.assertEquals(testSource, value[0]); | 2990 JUnitTestCase.assertEquals(testSource, value[0]); |
| 2991 entry.removeContainingLibrary(testSource); | 2991 entry.removeContainingLibrary(testSource); |
| 2992 value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); | 2992 value = entry.getValue(DartEntry.CONTAINING_LIBRARIES); |
| 2993 EngineTestCase.assertLength(0, value); | 2993 EngineTestCase.assertLength(0, value); |
| 2994 } | 2994 } |
| 2995 | 2995 |
| 2996 void test_getValue_invalid_resolutionErrors() { | 2996 void test_getValue_invalid_resolutionErrors() { |
| 2997 DartEntryImpl entry = new DartEntryImpl(); | 2997 DartEntry entry = new DartEntry(); |
| 2998 try { | 2998 try { |
| 2999 entry.getValue(DartEntry.RESOLUTION_ERRORS); | 2999 entry.getValue(DartEntry.RESOLUTION_ERRORS); |
| 3000 JUnitTestCase.fail( | 3000 JUnitTestCase.fail( |
| 3001 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); | 3001 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); |
| 3002 } on IllegalArgumentException catch (exception) { | 3002 } on IllegalArgumentException catch (exception) { |
| 3003 } | 3003 } |
| 3004 } | 3004 } |
| 3005 | 3005 |
| 3006 void test_getValue_invalid_verificationErrors() { | 3006 void test_getValue_invalid_verificationErrors() { |
| 3007 DartEntryImpl entry = new DartEntryImpl(); | 3007 DartEntry entry = new DartEntry(); |
| 3008 try { | 3008 try { |
| 3009 entry.getValue(DartEntry.VERIFICATION_ERRORS); | 3009 entry.getValue(DartEntry.VERIFICATION_ERRORS); |
| 3010 JUnitTestCase.fail( | 3010 JUnitTestCase.fail( |
| 3011 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); | 3011 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); |
| 3012 } on IllegalArgumentException catch (exception) { | 3012 } on IllegalArgumentException catch (exception) { |
| 3013 // Expected | 3013 // Expected |
| 3014 } | 3014 } |
| 3015 } | 3015 } |
| 3016 | 3016 |
| 3017 void test_hasInvalidData_false() { | 3017 void test_hasInvalidData_false() { |
| 3018 DartEntryImpl entry = new DartEntryImpl(); | 3018 DartEntry entry = new DartEntry(); |
| 3019 entry.recordScanError(new CaughtException(new AnalysisException(), null)); | 3019 entry.recordScanError(new CaughtException(new AnalysisException(), null)); |
| 3020 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.ELEMENT)); | 3020 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.ELEMENT)); |
| 3021 JUnitTestCase.assertFalse( | 3021 JUnitTestCase.assertFalse( |
| 3022 entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIES)); | 3022 entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIES)); |
| 3023 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.HINTS)); | 3023 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.HINTS)); |
| 3024 JUnitTestCase.assertFalse( | 3024 JUnitTestCase.assertFalse( |
| 3025 entry.hasInvalidData(DartEntry.IMPORTED_LIBRARIES)); | 3025 entry.hasInvalidData(DartEntry.IMPORTED_LIBRARIES)); |
| 3026 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.INCLUDED_PARTS)); | 3026 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.INCLUDED_PARTS)); |
| 3027 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IS_CLIENT)); | 3027 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IS_CLIENT)); |
| 3028 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IS_LAUNCHABLE)); | 3028 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.IS_LAUNCHABLE)); |
| 3029 JUnitTestCase.assertFalse(entry.hasInvalidData(SourceEntry.LINE_INFO)); | 3029 JUnitTestCase.assertFalse(entry.hasInvalidData(SourceEntry.LINE_INFO)); |
| 3030 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PARSE_ERRORS)); | 3030 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PARSE_ERRORS)); |
| 3031 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PARSED_UNIT)); | 3031 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PARSED_UNIT)); |
| 3032 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PUBLIC_NAMESPACE)); | 3032 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.PUBLIC_NAMESPACE)); |
| 3033 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.SOURCE_KIND)); | 3033 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.SOURCE_KIND)); |
| 3034 JUnitTestCase.assertFalse( | 3034 JUnitTestCase.assertFalse( |
| 3035 entry.hasInvalidData(DartEntry.RESOLUTION_ERRORS)); | 3035 entry.hasInvalidData(DartEntry.RESOLUTION_ERRORS)); |
| 3036 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.RESOLVED_UNIT)); | 3036 JUnitTestCase.assertFalse(entry.hasInvalidData(DartEntry.RESOLVED_UNIT)); |
| 3037 JUnitTestCase.assertFalse( | 3037 JUnitTestCase.assertFalse( |
| 3038 entry.hasInvalidData(DartEntry.VERIFICATION_ERRORS)); | 3038 entry.hasInvalidData(DartEntry.VERIFICATION_ERRORS)); |
| 3039 } | 3039 } |
| 3040 | 3040 |
| 3041 void test_hasInvalidData_true() { | 3041 void test_hasInvalidData_true() { |
| 3042 DartEntryImpl entry = new DartEntryImpl(); | 3042 DartEntry entry = new DartEntry(); |
| 3043 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.ELEMENT)); | 3043 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.ELEMENT)); |
| 3044 JUnitTestCase.assertTrue( | 3044 JUnitTestCase.assertTrue( |
| 3045 entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIES)); | 3045 entry.hasInvalidData(DartEntry.EXPORTED_LIBRARIES)); |
| 3046 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.HINTS)); | 3046 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.HINTS)); |
| 3047 JUnitTestCase.assertTrue( | 3047 JUnitTestCase.assertTrue( |
| 3048 entry.hasInvalidData(DartEntry.IMPORTED_LIBRARIES)); | 3048 entry.hasInvalidData(DartEntry.IMPORTED_LIBRARIES)); |
| 3049 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.INCLUDED_PARTS)); | 3049 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.INCLUDED_PARTS)); |
| 3050 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IS_CLIENT)); | 3050 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IS_CLIENT)); |
| 3051 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IS_LAUNCHABLE)); | 3051 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.IS_LAUNCHABLE)); |
| 3052 JUnitTestCase.assertTrue(entry.hasInvalidData(SourceEntry.LINE_INFO)); | 3052 JUnitTestCase.assertTrue(entry.hasInvalidData(SourceEntry.LINE_INFO)); |
| 3053 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PARSE_ERRORS)); | 3053 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PARSE_ERRORS)); |
| 3054 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PARSED_UNIT)); | 3054 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PARSED_UNIT)); |
| 3055 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PUBLIC_NAMESPACE)); | 3055 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.PUBLIC_NAMESPACE)); |
| 3056 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.SOURCE_KIND)); | 3056 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.SOURCE_KIND)); |
| 3057 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.RESOLUTION_ERRORS)); | 3057 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.RESOLUTION_ERRORS)); |
| 3058 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.RESOLVED_UNIT)); | 3058 JUnitTestCase.assertTrue(entry.hasInvalidData(DartEntry.RESOLVED_UNIT)); |
| 3059 JUnitTestCase.assertTrue( | 3059 JUnitTestCase.assertTrue( |
| 3060 entry.hasInvalidData(DartEntry.VERIFICATION_ERRORS)); | 3060 entry.hasInvalidData(DartEntry.VERIFICATION_ERRORS)); |
| 3061 } | 3061 } |
| 3062 | 3062 |
| 3063 void test_invalidateAllInformation() { | 3063 void test_invalidateAllInformation() { |
| 3064 DartEntryImpl entry = _entryWithValidState(); | 3064 DartEntry entry = _entryWithValidState(); |
| 3065 entry.invalidateAllInformation(); | 3065 entry.invalidateAllInformation(); |
| 3066 JUnitTestCase.assertSame( | 3066 JUnitTestCase.assertSame( |
| 3067 CacheState.INVALID, | 3067 CacheState.INVALID, |
| 3068 entry.getState(DartEntry.ELEMENT)); | 3068 entry.getState(DartEntry.ELEMENT)); |
| 3069 JUnitTestCase.assertSame( | 3069 JUnitTestCase.assertSame( |
| 3070 CacheState.INVALID, | 3070 CacheState.INVALID, |
| 3071 entry.getState(DartEntry.EXPORTED_LIBRARIES)); | 3071 entry.getState(DartEntry.EXPORTED_LIBRARIES)); |
| 3072 JUnitTestCase.assertSame( | 3072 JUnitTestCase.assertSame( |
| 3073 CacheState.INVALID, | 3073 CacheState.INVALID, |
| 3074 entry.getState(DartEntry.IMPORTED_LIBRARIES)); | 3074 entry.getState(DartEntry.IMPORTED_LIBRARIES)); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 3095 entry.getState(DartEntry.PUBLIC_NAMESPACE)); | 3095 entry.getState(DartEntry.PUBLIC_NAMESPACE)); |
| 3096 JUnitTestCase.assertSame( | 3096 JUnitTestCase.assertSame( |
| 3097 CacheState.INVALID, | 3097 CacheState.INVALID, |
| 3098 entry.getState(DartEntry.SCAN_ERRORS)); | 3098 entry.getState(DartEntry.SCAN_ERRORS)); |
| 3099 JUnitTestCase.assertSame( | 3099 JUnitTestCase.assertSame( |
| 3100 CacheState.INVALID, | 3100 CacheState.INVALID, |
| 3101 entry.getState(DartEntry.TOKEN_STREAM)); | 3101 entry.getState(DartEntry.TOKEN_STREAM)); |
| 3102 } | 3102 } |
| 3103 | 3103 |
| 3104 void test_invalidateAllResolutionInformation() { | 3104 void test_invalidateAllResolutionInformation() { |
| 3105 DartEntryImpl entry = _entryWithValidState(); | 3105 DartEntry entry = _entryWithValidState(); |
| 3106 entry.invalidateAllResolutionInformation(false); | 3106 entry.invalidateAllResolutionInformation(false); |
| 3107 JUnitTestCase.assertSame( | 3107 JUnitTestCase.assertSame( |
| 3108 CacheState.INVALID, | 3108 CacheState.INVALID, |
| 3109 entry.getState(DartEntry.ELEMENT)); | 3109 entry.getState(DartEntry.ELEMENT)); |
| 3110 JUnitTestCase.assertSame( | 3110 JUnitTestCase.assertSame( |
| 3111 CacheState.INVALID, | 3111 CacheState.INVALID, |
| 3112 entry.getState(DartEntry.IS_CLIENT)); | 3112 entry.getState(DartEntry.IS_CLIENT)); |
| 3113 JUnitTestCase.assertSame( | 3113 JUnitTestCase.assertSame( |
| 3114 CacheState.INVALID, | 3114 CacheState.INVALID, |
| 3115 entry.getState(DartEntry.IS_LAUNCHABLE)); | 3115 entry.getState(DartEntry.IS_LAUNCHABLE)); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 3130 entry.getState(DartEntry.EXPORTED_LIBRARIES)); | 3130 entry.getState(DartEntry.EXPORTED_LIBRARIES)); |
| 3131 JUnitTestCase.assertSame( | 3131 JUnitTestCase.assertSame( |
| 3132 CacheState.VALID, | 3132 CacheState.VALID, |
| 3133 entry.getState(DartEntry.IMPORTED_LIBRARIES)); | 3133 entry.getState(DartEntry.IMPORTED_LIBRARIES)); |
| 3134 JUnitTestCase.assertSame( | 3134 JUnitTestCase.assertSame( |
| 3135 CacheState.VALID, | 3135 CacheState.VALID, |
| 3136 entry.getState(DartEntry.INCLUDED_PARTS)); | 3136 entry.getState(DartEntry.INCLUDED_PARTS)); |
| 3137 } | 3137 } |
| 3138 | 3138 |
| 3139 void test_invalidateAllResolutionInformation_includingUris() { | 3139 void test_invalidateAllResolutionInformation_includingUris() { |
| 3140 DartEntryImpl entry = _entryWithValidState(); | 3140 DartEntry entry = _entryWithValidState(); |
| 3141 entry.invalidateAllResolutionInformation(true); | 3141 entry.invalidateAllResolutionInformation(true); |
| 3142 JUnitTestCase.assertSame( | 3142 JUnitTestCase.assertSame( |
| 3143 CacheState.INVALID, | 3143 CacheState.INVALID, |
| 3144 entry.getState(DartEntry.ELEMENT)); | 3144 entry.getState(DartEntry.ELEMENT)); |
| 3145 JUnitTestCase.assertSame( | 3145 JUnitTestCase.assertSame( |
| 3146 CacheState.INVALID, | 3146 CacheState.INVALID, |
| 3147 entry.getState(DartEntry.IS_CLIENT)); | 3147 entry.getState(DartEntry.IS_CLIENT)); |
| 3148 JUnitTestCase.assertSame( | 3148 JUnitTestCase.assertSame( |
| 3149 CacheState.INVALID, | 3149 CacheState.INVALID, |
| 3150 entry.getState(DartEntry.IS_LAUNCHABLE)); | 3150 entry.getState(DartEntry.IS_LAUNCHABLE)); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 3165 entry.getState(DartEntry.EXPORTED_LIBRARIES)); | 3165 entry.getState(DartEntry.EXPORTED_LIBRARIES)); |
| 3166 JUnitTestCase.assertSame( | 3166 JUnitTestCase.assertSame( |
| 3167 CacheState.INVALID, | 3167 CacheState.INVALID, |
| 3168 entry.getState(DartEntry.IMPORTED_LIBRARIES)); | 3168 entry.getState(DartEntry.IMPORTED_LIBRARIES)); |
| 3169 JUnitTestCase.assertSame( | 3169 JUnitTestCase.assertSame( |
| 3170 CacheState.INVALID, | 3170 CacheState.INVALID, |
| 3171 entry.getState(DartEntry.INCLUDED_PARTS)); | 3171 entry.getState(DartEntry.INCLUDED_PARTS)); |
| 3172 } | 3172 } |
| 3173 | 3173 |
| 3174 void test_isClient() { | 3174 void test_isClient() { |
| 3175 DartEntryImpl entry = new DartEntryImpl(); | 3175 DartEntry entry = new DartEntry(); |
| 3176 // true | 3176 // true |
| 3177 entry.setValue(DartEntry.IS_CLIENT, true); | 3177 entry.setValue(DartEntry.IS_CLIENT, true); |
| 3178 JUnitTestCase.assertTrue(entry.getValue(DartEntry.IS_CLIENT)); | 3178 JUnitTestCase.assertTrue(entry.getValue(DartEntry.IS_CLIENT)); |
| 3179 JUnitTestCase.assertSame( | 3179 JUnitTestCase.assertSame( |
| 3180 CacheState.VALID, | 3180 CacheState.VALID, |
| 3181 entry.getState(DartEntry.IS_CLIENT)); | 3181 entry.getState(DartEntry.IS_CLIENT)); |
| 3182 // invalidate | 3182 // invalidate |
| 3183 entry.setState(DartEntry.IS_CLIENT, CacheState.INVALID); | 3183 entry.setState(DartEntry.IS_CLIENT, CacheState.INVALID); |
| 3184 JUnitTestCase.assertSame( | 3184 JUnitTestCase.assertSame( |
| 3185 CacheState.INVALID, | 3185 CacheState.INVALID, |
| 3186 entry.getState(DartEntry.IS_CLIENT)); | 3186 entry.getState(DartEntry.IS_CLIENT)); |
| 3187 // false | 3187 // false |
| 3188 entry.setValue(DartEntry.IS_CLIENT, false); | 3188 entry.setValue(DartEntry.IS_CLIENT, false); |
| 3189 JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_CLIENT)); | 3189 JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_CLIENT)); |
| 3190 JUnitTestCase.assertSame( | 3190 JUnitTestCase.assertSame( |
| 3191 CacheState.VALID, | 3191 CacheState.VALID, |
| 3192 entry.getState(DartEntry.IS_CLIENT)); | 3192 entry.getState(DartEntry.IS_CLIENT)); |
| 3193 } | 3193 } |
| 3194 | 3194 |
| 3195 void test_isLaunchable() { | 3195 void test_isLaunchable() { |
| 3196 DartEntryImpl entry = new DartEntryImpl(); | 3196 DartEntry entry = new DartEntry(); |
| 3197 // true | 3197 // true |
| 3198 entry.setValue(DartEntry.IS_LAUNCHABLE, true); | 3198 entry.setValue(DartEntry.IS_LAUNCHABLE, true); |
| 3199 JUnitTestCase.assertTrue(entry.getValue(DartEntry.IS_LAUNCHABLE)); | 3199 JUnitTestCase.assertTrue(entry.getValue(DartEntry.IS_LAUNCHABLE)); |
| 3200 JUnitTestCase.assertSame( | 3200 JUnitTestCase.assertSame( |
| 3201 CacheState.VALID, | 3201 CacheState.VALID, |
| 3202 entry.getState(DartEntry.IS_LAUNCHABLE)); | 3202 entry.getState(DartEntry.IS_LAUNCHABLE)); |
| 3203 // invalidate | 3203 // invalidate |
| 3204 entry.setState(DartEntry.IS_LAUNCHABLE, CacheState.INVALID); | 3204 entry.setState(DartEntry.IS_LAUNCHABLE, CacheState.INVALID); |
| 3205 JUnitTestCase.assertSame( | 3205 JUnitTestCase.assertSame( |
| 3206 CacheState.INVALID, | 3206 CacheState.INVALID, |
| 3207 entry.getState(DartEntry.IS_LAUNCHABLE)); | 3207 entry.getState(DartEntry.IS_LAUNCHABLE)); |
| 3208 // false | 3208 // false |
| 3209 entry.setValue(DartEntry.IS_LAUNCHABLE, false); | 3209 entry.setValue(DartEntry.IS_LAUNCHABLE, false); |
| 3210 JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_LAUNCHABLE)); | 3210 JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_LAUNCHABLE)); |
| 3211 JUnitTestCase.assertSame( | 3211 JUnitTestCase.assertSame( |
| 3212 CacheState.VALID, | 3212 CacheState.VALID, |
| 3213 entry.getState(DartEntry.IS_LAUNCHABLE)); | 3213 entry.getState(DartEntry.IS_LAUNCHABLE)); |
| 3214 } | 3214 } |
| 3215 | 3215 |
| 3216 void test_recordBuildElementErrorInLibrary() { | 3216 void test_recordBuildElementErrorInLibrary() { |
| 3217 // TODO(brianwilkerson) This test should set the state for two libraries, | 3217 // TODO(brianwilkerson) This test should set the state for two libraries, |
| 3218 // record an error in one library, then verify that the data for the other | 3218 // record an error in one library, then verify that the data for the other |
| 3219 // library is still valid. | 3219 // library is still valid. |
| 3220 Source source = new TestSource(); | 3220 Source source = new TestSource(); |
| 3221 DartEntryImpl entry = new DartEntryImpl(); | 3221 DartEntry entry = new DartEntry(); |
| 3222 entry.recordBuildElementErrorInLibrary( | 3222 entry.recordBuildElementErrorInLibrary( |
| 3223 source, | 3223 source, |
| 3224 new CaughtException(new AnalysisException(), null)); | 3224 new CaughtException(new AnalysisException(), null)); |
| 3225 JUnitTestCase.assertSame( | 3225 JUnitTestCase.assertSame( |
| 3226 CacheState.INVALID, | 3226 CacheState.INVALID, |
| 3227 entry.getState(SourceEntry.CONTENT)); | 3227 entry.getState(SourceEntry.CONTENT)); |
| 3228 JUnitTestCase.assertSame( | 3228 JUnitTestCase.assertSame( |
| 3229 CacheState.ERROR, | 3229 CacheState.ERROR, |
| 3230 entry.getState(DartEntry.ELEMENT)); | 3230 entry.getState(DartEntry.ELEMENT)); |
| 3231 JUnitTestCase.assertSame( | 3231 JUnitTestCase.assertSame( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3272 entry.getStateInLibrary(DartEntry.RESOLUTION_ERRORS, source)); | 3272 entry.getStateInLibrary(DartEntry.RESOLUTION_ERRORS, source)); |
| 3273 JUnitTestCase.assertSame( | 3273 JUnitTestCase.assertSame( |
| 3274 CacheState.ERROR, | 3274 CacheState.ERROR, |
| 3275 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); | 3275 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); |
| 3276 JUnitTestCase.assertSame( | 3276 JUnitTestCase.assertSame( |
| 3277 CacheState.ERROR, | 3277 CacheState.ERROR, |
| 3278 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); | 3278 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); |
| 3279 } | 3279 } |
| 3280 | 3280 |
| 3281 void test_recordContentError() { | 3281 void test_recordContentError() { |
| 3282 // Source source = new TestSource(); | 3282 DartEntry entry = new DartEntry(); |
| 3283 DartEntryImpl entry = new DartEntryImpl(); | |
| 3284 entry.recordContentError( | 3283 entry.recordContentError( |
| 3285 new CaughtException(new AnalysisException(), null)); | 3284 new CaughtException(new AnalysisException(), null)); |
| 3286 JUnitTestCase.assertSame( | 3285 JUnitTestCase.assertSame( |
| 3287 CacheState.ERROR, | 3286 CacheState.ERROR, |
| 3288 entry.getState(SourceEntry.CONTENT)); | 3287 entry.getState(SourceEntry.CONTENT)); |
| 3289 JUnitTestCase.assertSame( | 3288 JUnitTestCase.assertSame( |
| 3290 CacheState.ERROR, | 3289 CacheState.ERROR, |
| 3291 entry.getState(DartEntry.ELEMENT)); | 3290 entry.getState(DartEntry.ELEMENT)); |
| 3292 JUnitTestCase.assertSame( | 3291 JUnitTestCase.assertSame( |
| 3293 CacheState.ERROR, | 3292 CacheState.ERROR, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3334 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); | 3333 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); |
| 3335 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); | 3334 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); |
| 3336 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); | 3335 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); |
| 3337 } | 3336 } |
| 3338 | 3337 |
| 3339 void test_recordHintErrorInLibrary() { | 3338 void test_recordHintErrorInLibrary() { |
| 3340 // TODO(brianwilkerson) This test should set the state for two libraries, | 3339 // TODO(brianwilkerson) This test should set the state for two libraries, |
| 3341 // record an error in one library, then verify that the data for the other | 3340 // record an error in one library, then verify that the data for the other |
| 3342 // library is still valid. | 3341 // library is still valid. |
| 3343 Source source = new TestSource(); | 3342 Source source = new TestSource(); |
| 3344 DartEntryImpl entry = new DartEntryImpl(); | 3343 DartEntry entry = new DartEntry(); |
| 3345 entry.recordHintErrorInLibrary( | 3344 entry.recordHintErrorInLibrary( |
| 3346 source, | 3345 source, |
| 3347 new CaughtException(new AnalysisException(), null)); | 3346 new CaughtException(new AnalysisException(), null)); |
| 3348 JUnitTestCase.assertSame( | 3347 JUnitTestCase.assertSame( |
| 3349 CacheState.INVALID, | 3348 CacheState.INVALID, |
| 3350 entry.getState(SourceEntry.CONTENT)); | 3349 entry.getState(SourceEntry.CONTENT)); |
| 3351 JUnitTestCase.assertSame( | 3350 JUnitTestCase.assertSame( |
| 3352 CacheState.INVALID, | 3351 CacheState.INVALID, |
| 3353 entry.getState(DartEntry.ELEMENT)); | 3352 entry.getState(DartEntry.ELEMENT)); |
| 3354 JUnitTestCase.assertSame( | 3353 JUnitTestCase.assertSame( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3395 entry.getStateInLibrary(DartEntry.RESOLUTION_ERRORS, source)); | 3394 entry.getStateInLibrary(DartEntry.RESOLUTION_ERRORS, source)); |
| 3396 JUnitTestCase.assertSame( | 3395 JUnitTestCase.assertSame( |
| 3397 CacheState.INVALID, | 3396 CacheState.INVALID, |
| 3398 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); | 3397 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); |
| 3399 JUnitTestCase.assertSame( | 3398 JUnitTestCase.assertSame( |
| 3400 CacheState.INVALID, | 3399 CacheState.INVALID, |
| 3401 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); | 3400 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); |
| 3402 } | 3401 } |
| 3403 | 3402 |
| 3404 void test_recordParseError() { | 3403 void test_recordParseError() { |
| 3405 // Source source = new TestSource(); | 3404 DartEntry entry = new DartEntry(); |
| 3406 DartEntryImpl entry = new DartEntryImpl(); | |
| 3407 entry.recordParseError(new CaughtException(new AnalysisException(), null)); | 3405 entry.recordParseError(new CaughtException(new AnalysisException(), null)); |
| 3408 JUnitTestCase.assertSame( | 3406 JUnitTestCase.assertSame( |
| 3409 CacheState.INVALID, | 3407 CacheState.INVALID, |
| 3410 entry.getState(SourceEntry.CONTENT)); | 3408 entry.getState(SourceEntry.CONTENT)); |
| 3411 JUnitTestCase.assertSame( | 3409 JUnitTestCase.assertSame( |
| 3412 CacheState.ERROR, | 3410 CacheState.ERROR, |
| 3413 entry.getState(DartEntry.ELEMENT)); | 3411 entry.getState(DartEntry.ELEMENT)); |
| 3414 JUnitTestCase.assertSame( | 3412 JUnitTestCase.assertSame( |
| 3415 CacheState.ERROR, | 3413 CacheState.ERROR, |
| 3416 entry.getState(DartEntry.EXPORTED_LIBRARIES)); | 3414 entry.getState(DartEntry.EXPORTED_LIBRARIES)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3452 // don't know anything about. | 3450 // don't know anything about. |
| 3453 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME NT_ERRORS, source)); | 3451 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME NT_ERRORS, source)); |
| 3454 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT, source)); | 3452 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT, source)); |
| 3455 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour ce)); | 3453 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour ce)); |
| 3456 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); | 3454 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); |
| 3457 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); | 3455 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); |
| 3458 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); | 3456 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); |
| 3459 } | 3457 } |
| 3460 | 3458 |
| 3461 void test_recordParseInProcess() { | 3459 void test_recordParseInProcess() { |
| 3462 DartEntryImpl entry = new DartEntryImpl(); | 3460 DartEntry entry = new DartEntry(); |
| 3463 entry.recordParseInProcess(); | 3461 entry.recordParseInProcess(); |
| 3464 JUnitTestCase.assertSame( | 3462 JUnitTestCase.assertSame( |
| 3465 CacheState.IN_PROCESS, | 3463 CacheState.IN_PROCESS, |
| 3466 entry.getState(DartEntry.PARSE_ERRORS)); | 3464 entry.getState(DartEntry.PARSE_ERRORS)); |
| 3467 JUnitTestCase.assertSame( | 3465 JUnitTestCase.assertSame( |
| 3468 CacheState.IN_PROCESS, | 3466 CacheState.IN_PROCESS, |
| 3469 entry.getState(DartEntry.PARSED_UNIT)); | 3467 entry.getState(DartEntry.PARSED_UNIT)); |
| 3470 JUnitTestCase.assertSame( | 3468 JUnitTestCase.assertSame( |
| 3471 CacheState.IN_PROCESS, | 3469 CacheState.IN_PROCESS, |
| 3472 entry.getState(DartEntry.SOURCE_KIND)); | 3470 entry.getState(DartEntry.SOURCE_KIND)); |
| 3473 } | 3471 } |
| 3474 | 3472 |
| 3475 void test_recordResolutionError() { | 3473 void test_recordResolutionError() { |
| 3476 // Source source = new TestSource(); | 3474 // Source source = new TestSource(); |
| 3477 DartEntryImpl entry = new DartEntryImpl(); | 3475 DartEntry entry = new DartEntry(); |
| 3478 entry.recordResolutionError( | 3476 entry.recordResolutionError( |
| 3479 new CaughtException(new AnalysisException(), null)); | 3477 new CaughtException(new AnalysisException(), null)); |
| 3480 JUnitTestCase.assertSame( | 3478 JUnitTestCase.assertSame( |
| 3481 CacheState.INVALID, | 3479 CacheState.INVALID, |
| 3482 entry.getState(SourceEntry.CONTENT)); | 3480 entry.getState(SourceEntry.CONTENT)); |
| 3483 JUnitTestCase.assertSame( | 3481 JUnitTestCase.assertSame( |
| 3484 CacheState.ERROR, | 3482 CacheState.ERROR, |
| 3485 entry.getState(DartEntry.ELEMENT)); | 3483 entry.getState(DartEntry.ELEMENT)); |
| 3486 JUnitTestCase.assertSame( | 3484 JUnitTestCase.assertSame( |
| 3487 CacheState.INVALID, | 3485 CacheState.INVALID, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3528 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); | 3526 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); |
| 3529 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); | 3527 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); |
| 3530 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); | 3528 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); |
| 3531 } | 3529 } |
| 3532 | 3530 |
| 3533 void test_recordResolutionErrorInLibrary() { | 3531 void test_recordResolutionErrorInLibrary() { |
| 3534 // TODO(brianwilkerson) This test should set the state for two libraries, | 3532 // TODO(brianwilkerson) This test should set the state for two libraries, |
| 3535 // record an error in one library, then verify that the data for the other | 3533 // record an error in one library, then verify that the data for the other |
| 3536 // library is still valid. | 3534 // library is still valid. |
| 3537 Source source = new TestSource(); | 3535 Source source = new TestSource(); |
| 3538 DartEntryImpl entry = new DartEntryImpl(); | 3536 DartEntry entry = new DartEntry(); |
| 3539 entry.recordResolutionErrorInLibrary( | 3537 entry.recordResolutionErrorInLibrary( |
| 3540 source, | 3538 source, |
| 3541 new CaughtException(new AnalysisException(), null)); | 3539 new CaughtException(new AnalysisException(), null)); |
| 3542 JUnitTestCase.assertSame( | 3540 JUnitTestCase.assertSame( |
| 3543 CacheState.INVALID, | 3541 CacheState.INVALID, |
| 3544 entry.getState(SourceEntry.CONTENT)); | 3542 entry.getState(SourceEntry.CONTENT)); |
| 3545 JUnitTestCase.assertSame( | 3543 JUnitTestCase.assertSame( |
| 3546 CacheState.ERROR, | 3544 CacheState.ERROR, |
| 3547 entry.getState(DartEntry.ELEMENT)); | 3545 entry.getState(DartEntry.ELEMENT)); |
| 3548 JUnitTestCase.assertSame( | 3546 JUnitTestCase.assertSame( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3590 JUnitTestCase.assertSame( | 3588 JUnitTestCase.assertSame( |
| 3591 CacheState.ERROR, | 3589 CacheState.ERROR, |
| 3592 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); | 3590 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); |
| 3593 JUnitTestCase.assertSame( | 3591 JUnitTestCase.assertSame( |
| 3594 CacheState.ERROR, | 3592 CacheState.ERROR, |
| 3595 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); | 3593 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); |
| 3596 } | 3594 } |
| 3597 | 3595 |
| 3598 void test_recordScanError() { | 3596 void test_recordScanError() { |
| 3599 // Source source = new TestSource(); | 3597 // Source source = new TestSource(); |
| 3600 DartEntryImpl entry = new DartEntryImpl(); | 3598 DartEntry entry = new DartEntry(); |
| 3601 entry.recordScanError(new CaughtException(new AnalysisException(), null)); | 3599 entry.recordScanError(new CaughtException(new AnalysisException(), null)); |
| 3602 JUnitTestCase.assertSame( | 3600 JUnitTestCase.assertSame( |
| 3603 CacheState.INVALID, | 3601 CacheState.INVALID, |
| 3604 entry.getState(SourceEntry.CONTENT)); | 3602 entry.getState(SourceEntry.CONTENT)); |
| 3605 JUnitTestCase.assertSame( | 3603 JUnitTestCase.assertSame( |
| 3606 CacheState.ERROR, | 3604 CacheState.ERROR, |
| 3607 entry.getState(DartEntry.ELEMENT)); | 3605 entry.getState(DartEntry.ELEMENT)); |
| 3608 JUnitTestCase.assertSame( | 3606 JUnitTestCase.assertSame( |
| 3609 CacheState.ERROR, | 3607 CacheState.ERROR, |
| 3610 entry.getState(DartEntry.EXPORTED_LIBRARIES)); | 3608 entry.getState(DartEntry.EXPORTED_LIBRARIES)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3646 // don't know anything about. | 3644 // don't know anything about. |
| 3647 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME NT_ERRORS, source)); | 3645 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME NT_ERRORS, source)); |
| 3648 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT, source)); | 3646 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT, source)); |
| 3649 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour ce)); | 3647 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour ce)); |
| 3650 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); | 3648 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_ ERRORS, source)); |
| 3651 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); | 3649 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN IT, source)); |
| 3652 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); | 3650 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO N_ERRORS, source)); |
| 3653 } | 3651 } |
| 3654 | 3652 |
| 3655 void test_recordScanInProcess() { | 3653 void test_recordScanInProcess() { |
| 3656 DartEntryImpl entry = new DartEntryImpl(); | 3654 DartEntry entry = new DartEntry(); |
| 3657 entry.recordScanInProcess(); | 3655 entry.recordScanInProcess(); |
| 3658 JUnitTestCase.assertSame( | 3656 JUnitTestCase.assertSame( |
| 3659 CacheState.IN_PROCESS, | 3657 CacheState.IN_PROCESS, |
| 3660 entry.getState(SourceEntry.LINE_INFO)); | 3658 entry.getState(SourceEntry.LINE_INFO)); |
| 3661 JUnitTestCase.assertSame( | 3659 JUnitTestCase.assertSame( |
| 3662 CacheState.IN_PROCESS, | 3660 CacheState.IN_PROCESS, |
| 3663 entry.getState(DartEntry.SCAN_ERRORS)); | 3661 entry.getState(DartEntry.SCAN_ERRORS)); |
| 3664 JUnitTestCase.assertSame( | 3662 JUnitTestCase.assertSame( |
| 3665 CacheState.IN_PROCESS, | 3663 CacheState.IN_PROCESS, |
| 3666 entry.getState(DartEntry.TOKEN_STREAM)); | 3664 entry.getState(DartEntry.TOKEN_STREAM)); |
| 3667 } | 3665 } |
| 3668 | 3666 |
| 3669 void test_recordVerificationErrorInLibrary() { | 3667 void test_recordVerificationErrorInLibrary() { |
| 3670 // TODO(brianwilkerson) This test should set the state for two libraries, | 3668 // TODO(brianwilkerson) This test should set the state for two libraries, |
| 3671 // record an error in one library, then verify that the data for the other | 3669 // record an error in one library, then verify that the data for the other |
| 3672 // library is still valid. | 3670 // library is still valid. |
| 3673 Source source = new TestSource(); | 3671 Source source = new TestSource(); |
| 3674 DartEntryImpl entry = new DartEntryImpl(); | 3672 DartEntry entry = new DartEntry(); |
| 3675 entry.recordVerificationErrorInLibrary( | 3673 entry.recordVerificationErrorInLibrary( |
| 3676 source, | 3674 source, |
| 3677 new CaughtException(new AnalysisException(), null)); | 3675 new CaughtException(new AnalysisException(), null)); |
| 3678 JUnitTestCase.assertSame( | 3676 JUnitTestCase.assertSame( |
| 3679 CacheState.INVALID, | 3677 CacheState.INVALID, |
| 3680 entry.getState(SourceEntry.CONTENT)); | 3678 entry.getState(SourceEntry.CONTENT)); |
| 3681 JUnitTestCase.assertSame( | 3679 JUnitTestCase.assertSame( |
| 3682 CacheState.INVALID, | 3680 CacheState.INVALID, |
| 3683 entry.getState(DartEntry.ELEMENT)); | 3681 entry.getState(DartEntry.ELEMENT)); |
| 3684 JUnitTestCase.assertSame( | 3682 JUnitTestCase.assertSame( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3728 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); | 3726 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); |
| 3729 JUnitTestCase.assertSame( | 3727 JUnitTestCase.assertSame( |
| 3730 CacheState.ERROR, | 3728 CacheState.ERROR, |
| 3731 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); | 3729 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); |
| 3732 } | 3730 } |
| 3733 | 3731 |
| 3734 void test_removeResolution_multiple_first() { | 3732 void test_removeResolution_multiple_first() { |
| 3735 Source source1 = new TestSource(); | 3733 Source source1 = new TestSource(); |
| 3736 Source source2 = new TestSource(); | 3734 Source source2 = new TestSource(); |
| 3737 Source source3 = new TestSource(); | 3735 Source source3 = new TestSource(); |
| 3738 DartEntryImpl entry = new DartEntryImpl(); | 3736 DartEntry entry = new DartEntry(); |
| 3739 entry.setValueInLibrary( | 3737 entry.setValueInLibrary( |
| 3740 DartEntry.RESOLVED_UNIT, | 3738 DartEntry.RESOLVED_UNIT, |
| 3741 source1, | 3739 source1, |
| 3742 AstFactory.compilationUnit()); | 3740 AstFactory.compilationUnit()); |
| 3743 entry.setValueInLibrary( | 3741 entry.setValueInLibrary( |
| 3744 DartEntry.RESOLVED_UNIT, | 3742 DartEntry.RESOLVED_UNIT, |
| 3745 source2, | 3743 source2, |
| 3746 AstFactory.compilationUnit()); | 3744 AstFactory.compilationUnit()); |
| 3747 entry.setValueInLibrary( | 3745 entry.setValueInLibrary( |
| 3748 DartEntry.RESOLVED_UNIT, | 3746 DartEntry.RESOLVED_UNIT, |
| 3749 source3, | 3747 source3, |
| 3750 AstFactory.compilationUnit()); | 3748 AstFactory.compilationUnit()); |
| 3751 entry.removeResolution(source1); | 3749 entry.removeResolution(source1); |
| 3752 } | 3750 } |
| 3753 | 3751 |
| 3754 void test_removeResolution_multiple_last() { | 3752 void test_removeResolution_multiple_last() { |
| 3755 Source source1 = new TestSource(); | 3753 Source source1 = new TestSource(); |
| 3756 Source source2 = new TestSource(); | 3754 Source source2 = new TestSource(); |
| 3757 Source source3 = new TestSource(); | 3755 Source source3 = new TestSource(); |
| 3758 DartEntryImpl entry = new DartEntryImpl(); | 3756 DartEntry entry = new DartEntry(); |
| 3759 entry.setValueInLibrary( | 3757 entry.setValueInLibrary( |
| 3760 DartEntry.RESOLVED_UNIT, | 3758 DartEntry.RESOLVED_UNIT, |
| 3761 source1, | 3759 source1, |
| 3762 AstFactory.compilationUnit()); | 3760 AstFactory.compilationUnit()); |
| 3763 entry.setValueInLibrary( | 3761 entry.setValueInLibrary( |
| 3764 DartEntry.RESOLVED_UNIT, | 3762 DartEntry.RESOLVED_UNIT, |
| 3765 source2, | 3763 source2, |
| 3766 AstFactory.compilationUnit()); | 3764 AstFactory.compilationUnit()); |
| 3767 entry.setValueInLibrary( | 3765 entry.setValueInLibrary( |
| 3768 DartEntry.RESOLVED_UNIT, | 3766 DartEntry.RESOLVED_UNIT, |
| 3769 source3, | 3767 source3, |
| 3770 AstFactory.compilationUnit()); | 3768 AstFactory.compilationUnit()); |
| 3771 entry.removeResolution(source3); | 3769 entry.removeResolution(source3); |
| 3772 } | 3770 } |
| 3773 | 3771 |
| 3774 void test_removeResolution_multiple_middle() { | 3772 void test_removeResolution_multiple_middle() { |
| 3775 Source source1 = new TestSource(); | 3773 Source source1 = new TestSource(); |
| 3776 Source source2 = new TestSource(); | 3774 Source source2 = new TestSource(); |
| 3777 Source source3 = new TestSource(); | 3775 Source source3 = new TestSource(); |
| 3778 DartEntryImpl entry = new DartEntryImpl(); | 3776 DartEntry entry = new DartEntry(); |
| 3779 entry.setValueInLibrary( | 3777 entry.setValueInLibrary( |
| 3780 DartEntry.RESOLVED_UNIT, | 3778 DartEntry.RESOLVED_UNIT, |
| 3781 source1, | 3779 source1, |
| 3782 AstFactory.compilationUnit()); | 3780 AstFactory.compilationUnit()); |
| 3783 entry.setValueInLibrary( | 3781 entry.setValueInLibrary( |
| 3784 DartEntry.RESOLVED_UNIT, | 3782 DartEntry.RESOLVED_UNIT, |
| 3785 source2, | 3783 source2, |
| 3786 AstFactory.compilationUnit()); | 3784 AstFactory.compilationUnit()); |
| 3787 entry.setValueInLibrary( | 3785 entry.setValueInLibrary( |
| 3788 DartEntry.RESOLVED_UNIT, | 3786 DartEntry.RESOLVED_UNIT, |
| 3789 source3, | 3787 source3, |
| 3790 AstFactory.compilationUnit()); | 3788 AstFactory.compilationUnit()); |
| 3791 entry.removeResolution(source2); | 3789 entry.removeResolution(source2); |
| 3792 } | 3790 } |
| 3793 | 3791 |
| 3794 void test_removeResolution_single() { | 3792 void test_removeResolution_single() { |
| 3795 Source source1 = new TestSource(); | 3793 Source source1 = new TestSource(); |
| 3796 DartEntryImpl entry = new DartEntryImpl(); | 3794 DartEntry entry = new DartEntry(); |
| 3797 entry.setValueInLibrary( | 3795 entry.setValueInLibrary( |
| 3798 DartEntry.RESOLVED_UNIT, | 3796 DartEntry.RESOLVED_UNIT, |
| 3799 source1, | 3797 source1, |
| 3800 AstFactory.compilationUnit()); | 3798 AstFactory.compilationUnit()); |
| 3801 entry.removeResolution(source1); | 3799 entry.removeResolution(source1); |
| 3802 } | 3800 } |
| 3803 | 3801 |
| 3804 void test_setState_element() { | 3802 void test_setState_element() { |
| 3805 state2 = DartEntry.ELEMENT; | 3803 state2 = DartEntry.ELEMENT; |
| 3806 } | 3804 } |
| 3807 | 3805 |
| 3808 void test_setState_exportedLibraries() { | 3806 void test_setState_exportedLibraries() { |
| 3809 state2 = DartEntry.EXPORTED_LIBRARIES; | 3807 state2 = DartEntry.EXPORTED_LIBRARIES; |
| 3810 } | 3808 } |
| 3811 | 3809 |
| 3812 void test_setState_hints() { | 3810 void test_setState_hints() { |
| 3813 state3 = DartEntry.HINTS; | 3811 state3 = DartEntry.HINTS; |
| 3814 } | 3812 } |
| 3815 | 3813 |
| 3816 void test_setState_importedLibraries() { | 3814 void test_setState_importedLibraries() { |
| 3817 state2 = DartEntry.IMPORTED_LIBRARIES; | 3815 state2 = DartEntry.IMPORTED_LIBRARIES; |
| 3818 } | 3816 } |
| 3819 | 3817 |
| 3820 void test_setState_includedParts() { | 3818 void test_setState_includedParts() { |
| 3821 state2 = DartEntry.INCLUDED_PARTS; | 3819 state2 = DartEntry.INCLUDED_PARTS; |
| 3822 } | 3820 } |
| 3823 | 3821 |
| 3824 void test_setState_invalid_element() { | 3822 void test_setState_invalid_element() { |
| 3825 DartEntryImpl entry = new DartEntryImpl(); | 3823 DartEntry entry = new DartEntry(); |
| 3826 try { | 3824 try { |
| 3827 entry.setStateInLibrary(DartEntry.ELEMENT, null, CacheState.FLUSHED); | 3825 entry.setStateInLibrary(DartEntry.ELEMENT, null, CacheState.FLUSHED); |
| 3828 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); | 3826 JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT"); |
| 3829 } on IllegalArgumentException catch (exception) { | 3827 } on IllegalArgumentException catch (exception) { |
| 3830 // Expected | 3828 // Expected |
| 3831 } | 3829 } |
| 3832 } | 3830 } |
| 3833 | 3831 |
| 3834 void test_setState_invalid_resolutionErrors() { | 3832 void test_setState_invalid_resolutionErrors() { |
| 3835 DartEntryImpl entry = new DartEntryImpl(); | 3833 DartEntry entry = new DartEntry(); |
| 3836 try { | 3834 try { |
| 3837 entry.setState(DartEntry.RESOLUTION_ERRORS, CacheState.FLUSHED); | 3835 entry.setState(DartEntry.RESOLUTION_ERRORS, CacheState.FLUSHED); |
| 3838 JUnitTestCase.fail( | 3836 JUnitTestCase.fail( |
| 3839 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); | 3837 "Expected IllegalArgumentException for RESOLUTION_ERRORS"); |
| 3840 } on IllegalArgumentException catch (exception) { | 3838 } on IllegalArgumentException catch (exception) { |
| 3841 // Expected | 3839 // Expected |
| 3842 } | 3840 } |
| 3843 } | 3841 } |
| 3844 | 3842 |
| 3845 void test_setState_invalid_validState() { | 3843 void test_setState_invalid_validState() { |
| 3846 DartEntryImpl entry = new DartEntryImpl(); | 3844 DartEntry entry = new DartEntry(); |
| 3847 try { | 3845 try { |
| 3848 entry.setState(SourceEntry.LINE_INFO, CacheState.VALID); | 3846 entry.setState(SourceEntry.LINE_INFO, CacheState.VALID); |
| 3849 JUnitTestCase.fail( | 3847 JUnitTestCase.fail( |
| 3850 "Expected IllegalArgumentException for a state of VALID"); | 3848 "Expected IllegalArgumentException for a state of VALID"); |
| 3851 } on IllegalArgumentException catch (exception) { | 3849 } on IllegalArgumentException catch (exception) { |
| 3852 } | 3850 } |
| 3853 } | 3851 } |
| 3854 | 3852 |
| 3855 void test_setState_invalid_verificationErrors() { | 3853 void test_setState_invalid_verificationErrors() { |
| 3856 DartEntryImpl entry = new DartEntryImpl(); | 3854 DartEntry entry = new DartEntry(); |
| 3857 try { | 3855 try { |
| 3858 entry.setState(DartEntry.VERIFICATION_ERRORS, CacheState.FLUSHED); | 3856 entry.setState(DartEntry.VERIFICATION_ERRORS, CacheState.FLUSHED); |
| 3859 JUnitTestCase.fail( | 3857 JUnitTestCase.fail( |
| 3860 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); | 3858 "Expected IllegalArgumentException for VERIFICATION_ERRORS"); |
| 3861 } on IllegalArgumentException catch (exception) { | 3859 } on IllegalArgumentException catch (exception) { |
| 3862 // Expected | 3860 // Expected |
| 3863 } | 3861 } |
| 3864 } | 3862 } |
| 3865 | 3863 |
| 3866 void test_setState_isClient() { | 3864 void test_setState_isClient() { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3996 _setValue2(DartEntry.TOKEN_STREAM, new Token(TokenType.LT, 5)); | 3994 _setValue2(DartEntry.TOKEN_STREAM, new Token(TokenType.LT, 5)); |
| 3997 } | 3995 } |
| 3998 | 3996 |
| 3999 void test_setValue_verificationErrors() { | 3997 void test_setValue_verificationErrors() { |
| 4000 _setValue3( | 3998 _setValue3( |
| 4001 DartEntry.VERIFICATION_ERRORS, | 3999 DartEntry.VERIFICATION_ERRORS, |
| 4002 <AnalysisError>[ | 4000 <AnalysisError>[ |
| 4003 new AnalysisError.con1(null, StaticWarningCode.CASE_BLOCK_NOT_TERMIN ATED, [])]); | 4001 new AnalysisError.con1(null, StaticWarningCode.CASE_BLOCK_NOT_TERMIN ATED, [])]); |
| 4004 } | 4002 } |
| 4005 | 4003 |
| 4006 DartEntryImpl _entryWithValidState() { | 4004 DartEntry _entryWithValidState() { |
| 4007 DartEntryImpl entry = new DartEntryImpl(); | 4005 DartEntry entry = new DartEntry(); |
| 4008 entry.setValue(DartEntry.ELEMENT, null); | 4006 entry.setValue(DartEntry.ELEMENT, null); |
| 4009 entry.setValue(DartEntry.EXPORTED_LIBRARIES, null); | 4007 entry.setValue(DartEntry.EXPORTED_LIBRARIES, null); |
| 4010 entry.setValue(DartEntry.IMPORTED_LIBRARIES, null); | 4008 entry.setValue(DartEntry.IMPORTED_LIBRARIES, null); |
| 4011 entry.setValue(DartEntry.INCLUDED_PARTS, null); | 4009 entry.setValue(DartEntry.INCLUDED_PARTS, null); |
| 4012 entry.setValue(DartEntry.IS_CLIENT, true); | 4010 entry.setValue(DartEntry.IS_CLIENT, true); |
| 4013 entry.setValue(DartEntry.IS_LAUNCHABLE, true); | 4011 entry.setValue(DartEntry.IS_LAUNCHABLE, true); |
| 4014 entry.setValue(SourceEntry.LINE_INFO, null); | 4012 entry.setValue(SourceEntry.LINE_INFO, null); |
| 4015 entry.setValue(DartEntry.PARSE_ERRORS, null); | 4013 entry.setValue(DartEntry.PARSE_ERRORS, null); |
| 4016 entry.setValue(DartEntry.PARSED_UNIT, null); | 4014 entry.setValue(DartEntry.PARSED_UNIT, null); |
| 4017 entry.setValue(DartEntry.PUBLIC_NAMESPACE, null); | 4015 entry.setValue(DartEntry.PUBLIC_NAMESPACE, null); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 4042 JUnitTestCase.assertSame( | 4040 JUnitTestCase.assertSame( |
| 4043 CacheState.VALID, | 4041 CacheState.VALID, |
| 4044 entry.getState(DartEntry.PARSED_UNIT)); | 4042 entry.getState(DartEntry.PARSED_UNIT)); |
| 4045 JUnitTestCase.assertSame( | 4043 JUnitTestCase.assertSame( |
| 4046 CacheState.VALID, | 4044 CacheState.VALID, |
| 4047 entry.getState(DartEntry.PUBLIC_NAMESPACE)); | 4045 entry.getState(DartEntry.PUBLIC_NAMESPACE)); |
| 4048 return entry; | 4046 return entry; |
| 4049 } | 4047 } |
| 4050 | 4048 |
| 4051 void _setValue2(DataDescriptor descriptor, Object newValue) { | 4049 void _setValue2(DataDescriptor descriptor, Object newValue) { |
| 4052 DartEntryImpl entry = new DartEntryImpl(); | 4050 DartEntry entry = new DartEntry(); |
| 4053 Object value = entry.getValue(descriptor); | 4051 Object value = entry.getValue(descriptor); |
| 4054 JUnitTestCase.assertNotSame(value, newValue); | 4052 JUnitTestCase.assertNotSame(value, newValue); |
| 4055 entry.setValue(descriptor, newValue); | 4053 entry.setValue(descriptor, newValue); |
| 4056 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(descriptor)); | 4054 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(descriptor)); |
| 4057 JUnitTestCase.assertSame(newValue, entry.getValue(descriptor)); | 4055 JUnitTestCase.assertSame(newValue, entry.getValue(descriptor)); |
| 4058 } | 4056 } |
| 4059 | 4057 |
| 4060 void _setValue3(DataDescriptor descriptor, Object newValue) { | 4058 void _setValue3(DataDescriptor descriptor, Object newValue) { |
| 4061 Source source = new TestSource(); | 4059 Source source = new TestSource(); |
| 4062 DartEntryImpl entry = new DartEntryImpl(); | 4060 DartEntry entry = new DartEntry(); |
| 4063 Object value = entry.getValueInLibrary(descriptor, source); | 4061 Object value = entry.getValueInLibrary(descriptor, source); |
| 4064 JUnitTestCase.assertNotSame(value, newValue); | 4062 JUnitTestCase.assertNotSame(value, newValue); |
| 4065 entry.setValueInLibrary(descriptor, source, newValue); | 4063 entry.setValueInLibrary(descriptor, source, newValue); |
| 4066 JUnitTestCase.assertSame( | 4064 JUnitTestCase.assertSame( |
| 4067 CacheState.VALID, | 4065 CacheState.VALID, |
| 4068 entry.getStateInLibrary(descriptor, source)); | 4066 entry.getStateInLibrary(descriptor, source)); |
| 4069 JUnitTestCase.assertSame( | 4067 JUnitTestCase.assertSame( |
| 4070 newValue, | 4068 newValue, |
| 4071 entry.getValueInLibrary(descriptor, source)); | 4069 entry.getValueInLibrary(descriptor, source)); |
| 4072 } | 4070 } |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4758 context.getModificationStamp(source), | 4756 context.getModificationStamp(source), |
| 4759 task.modificationTime); | 4757 task.modificationTime); |
| 4760 JUnitTestCase.assertSame(source, task.source); | 4758 JUnitTestCase.assertSame(source, task.source); |
| 4761 return true; | 4759 return true; |
| 4762 } | 4760 } |
| 4763 } | 4761 } |
| 4764 | 4762 |
| 4765 | 4763 |
| 4766 class HtmlEntryImplTest extends EngineTestCase { | 4764 class HtmlEntryImplTest extends EngineTestCase { |
| 4767 void set state(DataDescriptor descriptor) { | 4765 void set state(DataDescriptor descriptor) { |
| 4768 HtmlEntryImpl entry = new HtmlEntryImpl(); | 4766 HtmlEntry entry = new HtmlEntry(); |
| 4769 JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getState(descriptor)); | 4767 JUnitTestCase.assertNotSame(CacheState.FLUSHED, entry.getState(descriptor)); |
| 4770 entry.setState(descriptor, CacheState.FLUSHED); | 4768 entry.setState(descriptor, CacheState.FLUSHED); |
| 4771 JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getState(descriptor)); | 4769 JUnitTestCase.assertSame(CacheState.FLUSHED, entry.getState(descriptor)); |
| 4772 } | 4770 } |
| 4773 | 4771 |
| 4774 void test_creation() { | 4772 void test_creation() { |
| 4775 HtmlEntryImpl entry = new HtmlEntryImpl(); | 4773 HtmlEntry entry = new HtmlEntry(); |
| 4776 JUnitTestCase.assertNotNull(entry); | 4774 JUnitTestCase.assertNotNull(entry); |
| 4777 } | 4775 } |
| 4778 | 4776 |
| 4779 void test_getAllErrors() { | 4777 void test_getAllErrors() { |
| 4780 Source source = new TestSource(); | 4778 Source source = new TestSource(); |
| 4781 HtmlEntryImpl entry = new HtmlEntryImpl(); | 4779 HtmlEntry entry = new HtmlEntry(); |
| 4782 EngineTestCase.assertLength(0, entry.allErrors); | 4780 EngineTestCase.assertLength(0, entry.allErrors); |
| 4783 entry.setValue( | 4781 entry.setValue( |
| 4784 HtmlEntry.PARSE_ERRORS, | 4782 HtmlEntry.PARSE_ERRORS, |
| 4785 <AnalysisError>[ | 4783 <AnalysisError>[ |
| 4786 new AnalysisError.con1(source, ParserErrorCode.EXPECTED_TOKEN, [";"] )]); | 4784 new AnalysisError.con1(source, ParserErrorCode.EXPECTED_TOKEN, [";"] )]); |
| 4787 entry.setValue( | 4785 entry.setValue( |
| 4788 HtmlEntry.RESOLUTION_ERRORS, | 4786 HtmlEntry.RESOLUTION_ERRORS, |
| 4789 <AnalysisError>[ | 4787 <AnalysisError>[ |
| 4790 new AnalysisError.con1(source, HtmlWarningCode.INVALID_URI, ["-"])]) ; | 4788 new AnalysisError.con1(source, HtmlWarningCode.INVALID_URI, ["-"])]) ; |
| 4791 entry.setValue( | 4789 entry.setValue( |
| 4792 HtmlEntry.ANGULAR_ERRORS, | 4790 HtmlEntry.ANGULAR_ERRORS, |
| 4793 <AnalysisError>[ | 4791 <AnalysisError>[ |
| 4794 new AnalysisError.con1(source, AngularCode.INVALID_REPEAT_SYNTAX, [" -"])]); | 4792 new AnalysisError.con1(source, AngularCode.INVALID_REPEAT_SYNTAX, [" -"])]); |
| 4795 entry.setValue( | 4793 entry.setValue( |
| 4796 HtmlEntry.POLYMER_BUILD_ERRORS, | 4794 HtmlEntry.POLYMER_BUILD_ERRORS, |
| 4797 <AnalysisError>[ | 4795 <AnalysisError>[ |
| 4798 new AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, [ "-"])]); | 4796 new AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, [ "-"])]); |
| 4799 entry.setValue( | 4797 entry.setValue( |
| 4800 HtmlEntry.POLYMER_RESOLUTION_ERRORS, | 4798 HtmlEntry.POLYMER_RESOLUTION_ERRORS, |
| 4801 <AnalysisError>[ | 4799 <AnalysisError>[ |
| 4802 new AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, [ "-"])]); | 4800 new AnalysisError.con1(source, PolymerCode.INVALID_ATTRIBUTE_NAME, [ "-"])]); |
| 4803 entry.setValue( | 4801 entry.setValue( |
| 4804 HtmlEntry.HINTS, | 4802 HtmlEntry.HINTS, |
| 4805 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE, [])]) ; | 4803 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE, [])]) ; |
| 4806 EngineTestCase.assertLength(6, entry.allErrors); | 4804 EngineTestCase.assertLength(6, entry.allErrors); |
| 4807 } | 4805 } |
| 4808 | 4806 |
| 4809 void test_invalidateAllResolutionInformation() { | 4807 void test_invalidateAllResolutionInformation() { |
| 4810 HtmlEntryImpl entry = _entryWithValidState(); | 4808 HtmlEntry entry = _entryWithValidState(); |
| 4811 entry.invalidateAllResolutionInformation(false); | 4809 entry.invalidateAllResolutionInformation(false); |
| 4812 JUnitTestCase.assertSame( | 4810 JUnitTestCase.assertSame( |
| 4813 CacheState.VALID, | 4811 CacheState.VALID, |
| 4814 entry.getState(HtmlEntry.ANGULAR_APPLICATION)); | 4812 entry.getState(HtmlEntry.ANGULAR_APPLICATION)); |
| 4815 JUnitTestCase.assertSame( | 4813 JUnitTestCase.assertSame( |
| 4816 CacheState.VALID, | 4814 CacheState.VALID, |
| 4817 entry.getState(HtmlEntry.ANGULAR_COMPONENT)); | 4815 entry.getState(HtmlEntry.ANGULAR_COMPONENT)); |
| 4818 JUnitTestCase.assertSame( | 4816 JUnitTestCase.assertSame( |
| 4819 CacheState.INVALID, | 4817 CacheState.INVALID, |
| 4820 entry.getState(HtmlEntry.ANGULAR_ENTRY)); | 4818 entry.getState(HtmlEntry.ANGULAR_ENTRY)); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 4844 entry.getState(HtmlEntry.PARSED_UNIT)); | 4842 entry.getState(HtmlEntry.PARSED_UNIT)); |
| 4845 JUnitTestCase.assertSame( | 4843 JUnitTestCase.assertSame( |
| 4846 CacheState.VALID, | 4844 CacheState.VALID, |
| 4847 entry.getState(HtmlEntry.REFERENCED_LIBRARIES)); | 4845 entry.getState(HtmlEntry.REFERENCED_LIBRARIES)); |
| 4848 JUnitTestCase.assertSame( | 4846 JUnitTestCase.assertSame( |
| 4849 CacheState.INVALID, | 4847 CacheState.INVALID, |
| 4850 entry.getState(HtmlEntry.RESOLUTION_ERRORS)); | 4848 entry.getState(HtmlEntry.RESOLUTION_ERRORS)); |
| 4851 } | 4849 } |
| 4852 | 4850 |
| 4853 void test_invalidateAllResolutionInformation_includingUris() { | 4851 void test_invalidateAllResolutionInformation_includingUris() { |
| 4854 HtmlEntryImpl entry = _entryWithValidState(); | 4852 HtmlEntry entry = _entryWithValidState(); |
| 4855 entry.invalidateAllResolutionInformation(true); | 4853 entry.invalidateAllResolutionInformation(true); |
| 4856 JUnitTestCase.assertSame( | 4854 JUnitTestCase.assertSame( |
| 4857 CacheState.VALID, | 4855 CacheState.VALID, |
| 4858 entry.getState(HtmlEntry.ANGULAR_APPLICATION)); | 4856 entry.getState(HtmlEntry.ANGULAR_APPLICATION)); |
| 4859 JUnitTestCase.assertSame( | 4857 JUnitTestCase.assertSame( |
| 4860 CacheState.VALID, | 4858 CacheState.VALID, |
| 4861 entry.getState(HtmlEntry.ANGULAR_COMPONENT)); | 4859 entry.getState(HtmlEntry.ANGULAR_COMPONENT)); |
| 4862 JUnitTestCase.assertSame( | 4860 JUnitTestCase.assertSame( |
| 4863 CacheState.INVALID, | 4861 CacheState.INVALID, |
| 4864 entry.getState(HtmlEntry.ANGULAR_ENTRY)); | 4862 entry.getState(HtmlEntry.ANGULAR_ENTRY)); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4945 _setValue(HtmlEntry.ELEMENT, new HtmlElementImpl(null, "test.html")); | 4943 _setValue(HtmlEntry.ELEMENT, new HtmlElementImpl(null, "test.html")); |
| 4946 } | 4944 } |
| 4947 | 4945 |
| 4948 void test_setValue_hints() { | 4946 void test_setValue_hints() { |
| 4949 _setValue( | 4947 _setValue( |
| 4950 HtmlEntry.HINTS, | 4948 HtmlEntry.HINTS, |
| 4951 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE, [])]); | 4949 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE, [])]); |
| 4952 } | 4950 } |
| 4953 | 4951 |
| 4954 void test_setValue_illegal() { | 4952 void test_setValue_illegal() { |
| 4955 HtmlEntryImpl entry = new HtmlEntryImpl(); | 4953 HtmlEntry entry = new HtmlEntry(); |
| 4956 try { | 4954 try { |
| 4957 entry.setValue(DartEntry.ELEMENT, null); | 4955 entry.setValue(DartEntry.ELEMENT, null); |
| 4958 JUnitTestCase.fail( | 4956 JUnitTestCase.fail( |
| 4959 "Expected IllegalArgumentException for DartEntry.ELEMENT"); | 4957 "Expected IllegalArgumentException for DartEntry.ELEMENT"); |
| 4960 } on IllegalArgumentException catch (exception) { | 4958 } on IllegalArgumentException catch (exception) { |
| 4961 } | 4959 } |
| 4962 } | 4960 } |
| 4963 | 4961 |
| 4964 void test_setValue_lineInfo() { | 4962 void test_setValue_lineInfo() { |
| 4965 _setValue(SourceEntry.LINE_INFO, new LineInfo(<int>[0])); | 4963 _setValue(SourceEntry.LINE_INFO, new LineInfo(<int>[0])); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 4994 _setValue(HtmlEntry.REFERENCED_LIBRARIES, <Source>[new TestSource()]); | 4992 _setValue(HtmlEntry.REFERENCED_LIBRARIES, <Source>[new TestSource()]); |
| 4995 } | 4993 } |
| 4996 | 4994 |
| 4997 void test_setValue_resolutionErrors() { | 4995 void test_setValue_resolutionErrors() { |
| 4998 _setValue( | 4996 _setValue( |
| 4999 HtmlEntry.RESOLUTION_ERRORS, | 4997 HtmlEntry.RESOLUTION_ERRORS, |
| 5000 <AnalysisError>[ | 4998 <AnalysisError>[ |
| 5001 new AnalysisError.con1(null, HtmlWarningCode.INVALID_URI, ["-"])]); | 4999 new AnalysisError.con1(null, HtmlWarningCode.INVALID_URI, ["-"])]); |
| 5002 } | 5000 } |
| 5003 | 5001 |
| 5004 HtmlEntryImpl _entryWithValidState() { | 5002 HtmlEntry _entryWithValidState() { |
| 5005 HtmlEntryImpl entry = new HtmlEntryImpl(); | 5003 HtmlEntry entry = new HtmlEntry(); |
| 5006 entry.setValue(HtmlEntry.ANGULAR_ERRORS, null); | 5004 entry.setValue(HtmlEntry.ANGULAR_ERRORS, null); |
| 5007 entry.setValue(HtmlEntry.ELEMENT, null); | 5005 entry.setValue(HtmlEntry.ELEMENT, null); |
| 5008 entry.setValue(HtmlEntry.HINTS, null); | 5006 entry.setValue(HtmlEntry.HINTS, null); |
| 5009 entry.setValue(SourceEntry.LINE_INFO, null); | 5007 entry.setValue(SourceEntry.LINE_INFO, null); |
| 5010 entry.setValue(HtmlEntry.PARSE_ERRORS, null); | 5008 entry.setValue(HtmlEntry.PARSE_ERRORS, null); |
| 5011 entry.setValue(HtmlEntry.PARSED_UNIT, null); | 5009 entry.setValue(HtmlEntry.PARSED_UNIT, null); |
| 5012 entry.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, null); | 5010 entry.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, null); |
| 5013 entry.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, null); | 5011 entry.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, null); |
| 5014 entry.setValue(HtmlEntry.REFERENCED_LIBRARIES, null); | 5012 entry.setValue(HtmlEntry.REFERENCED_LIBRARIES, null); |
| 5015 entry.setValue(HtmlEntry.RESOLUTION_ERRORS, null); | 5013 entry.setValue(HtmlEntry.RESOLUTION_ERRORS, null); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 5038 JUnitTestCase.assertSame( | 5036 JUnitTestCase.assertSame( |
| 5039 CacheState.VALID, | 5037 CacheState.VALID, |
| 5040 entry.getState(HtmlEntry.REFERENCED_LIBRARIES)); | 5038 entry.getState(HtmlEntry.REFERENCED_LIBRARIES)); |
| 5041 JUnitTestCase.assertSame( | 5039 JUnitTestCase.assertSame( |
| 5042 CacheState.VALID, | 5040 CacheState.VALID, |
| 5043 entry.getState(HtmlEntry.RESOLUTION_ERRORS)); | 5041 entry.getState(HtmlEntry.RESOLUTION_ERRORS)); |
| 5044 return entry; | 5042 return entry; |
| 5045 } | 5043 } |
| 5046 | 5044 |
| 5047 void _setValue(DataDescriptor descriptor, Object newValue) { | 5045 void _setValue(DataDescriptor descriptor, Object newValue) { |
| 5048 HtmlEntryImpl entry = new HtmlEntryImpl(); | 5046 HtmlEntry entry = new HtmlEntry(); |
| 5049 Object value = entry.getValue(descriptor); | 5047 Object value = entry.getValue(descriptor); |
| 5050 JUnitTestCase.assertNotSame(value, newValue); | 5048 JUnitTestCase.assertNotSame(value, newValue); |
| 5051 entry.setValue(descriptor, newValue); | 5049 entry.setValue(descriptor, newValue); |
| 5052 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(descriptor)); | 5050 JUnitTestCase.assertSame(CacheState.VALID, entry.getState(descriptor)); |
| 5053 JUnitTestCase.assertSame(newValue, entry.getValue(descriptor)); | 5051 JUnitTestCase.assertSame(newValue, entry.getValue(descriptor)); |
| 5054 } | 5052 } |
| 5055 | 5053 |
| 5056 static dartSuite() { | 5054 static dartSuite() { |
| 5057 _ut.group('HtmlEntryImplTest', () { | 5055 _ut.group('HtmlEntryImplTest', () { |
| 5058 _ut.test('test_creation', () { | 5056 _ut.test('test_creation', () { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5157 final __test = new HtmlEntryImplTest(); | 5155 final __test = new HtmlEntryImplTest(); |
| 5158 runJUnitTest(__test, __test.test_setValue_resolutionErrors); | 5156 runJUnitTest(__test, __test.test_setValue_resolutionErrors); |
| 5159 }); | 5157 }); |
| 5160 }); | 5158 }); |
| 5161 } | 5159 } |
| 5162 } | 5160 } |
| 5163 | 5161 |
| 5164 | 5162 |
| 5165 class IncrementalAnalysisCacheTest extends JUnitTestCase { | 5163 class IncrementalAnalysisCacheTest extends JUnitTestCase { |
| 5166 Source _source = new TestSource(); | 5164 Source _source = new TestSource(); |
| 5167 DartEntryImpl _entry = new DartEntryImpl(); | 5165 DartEntry _entry = new DartEntry(); |
| 5168 CompilationUnit _unit = new CompilationUnitMock(); | 5166 CompilationUnit _unit = new CompilationUnitMock(); |
| 5169 IncrementalAnalysisCache _result; | 5167 IncrementalAnalysisCache _result; |
| 5170 @override | 5168 @override |
| 5171 void setUp() { | 5169 void setUp() { |
| 5172 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, _unit); | 5170 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, _unit); |
| 5173 } | 5171 } |
| 5174 void test_cacheResult() { | 5172 void test_cacheResult() { |
| 5175 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5173 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5176 null, | 5174 null, |
| 5177 _source, | 5175 _source, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5253 void test_update_append() { | 5251 void test_update_append() { |
| 5254 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5252 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5255 null, | 5253 null, |
| 5256 _source, | 5254 _source, |
| 5257 "hello", | 5255 "hello", |
| 5258 "hbazlo", | 5256 "hbazlo", |
| 5259 1, | 5257 1, |
| 5260 2, | 5258 2, |
| 5261 3, | 5259 3, |
| 5262 _entry); | 5260 _entry); |
| 5263 DartEntryImpl newEntry = new DartEntryImpl(); | 5261 DartEntry newEntry = new DartEntry(); |
| 5264 _result = IncrementalAnalysisCache.update( | 5262 _result = IncrementalAnalysisCache.update( |
| 5265 cache, | 5263 cache, |
| 5266 _source, | 5264 _source, |
| 5267 "hbazlo", | 5265 "hbazlo", |
| 5268 "hbazxlo", | 5266 "hbazxlo", |
| 5269 4, | 5267 4, |
| 5270 0, | 5268 0, |
| 5271 1, | 5269 1, |
| 5272 newEntry); | 5270 newEntry); |
| 5273 JUnitTestCase.assertNotNull(_result); | 5271 JUnitTestCase.assertNotNull(_result); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 5285 _source, | 5283 _source, |
| 5286 "hello", | 5284 "hello", |
| 5287 "hbazlo", | 5285 "hbazlo", |
| 5288 1, | 5286 1, |
| 5289 2, | 5287 2, |
| 5290 3, | 5288 3, |
| 5291 _entry); | 5289 _entry); |
| 5292 CompilationUnit newUnit = new CompilationUnitMock(); | 5290 CompilationUnit newUnit = new CompilationUnitMock(); |
| 5293 cache = IncrementalAnalysisCache.cacheResult(cache, newUnit); | 5291 cache = IncrementalAnalysisCache.cacheResult(cache, newUnit); |
| 5294 JUnitTestCase.assertNotNull(cache); | 5292 JUnitTestCase.assertNotNull(cache); |
| 5295 DartEntryImpl newEntry = new DartEntryImpl(); | 5293 DartEntry newEntry = new DartEntry(); |
| 5296 _result = IncrementalAnalysisCache.update( | 5294 _result = IncrementalAnalysisCache.update( |
| 5297 cache, | 5295 cache, |
| 5298 _source, | 5296 _source, |
| 5299 "hbazlo", | 5297 "hbazlo", |
| 5300 "hbazxlo", | 5298 "hbazxlo", |
| 5301 4, | 5299 4, |
| 5302 0, | 5300 0, |
| 5303 1, | 5301 1, |
| 5304 newEntry); | 5302 newEntry); |
| 5305 JUnitTestCase.assertNotNull(_result); | 5303 JUnitTestCase.assertNotNull(_result); |
| 5306 JUnitTestCase.assertSame(_source, _result.source); | 5304 JUnitTestCase.assertSame(_source, _result.source); |
| 5307 JUnitTestCase.assertSame(newUnit, _result.resolvedUnit); | 5305 JUnitTestCase.assertSame(newUnit, _result.resolvedUnit); |
| 5308 JUnitTestCase.assertEquals("hbazlo", _result.oldContents); | 5306 JUnitTestCase.assertEquals("hbazlo", _result.oldContents); |
| 5309 JUnitTestCase.assertEquals("hbazxlo", _result.newContents); | 5307 JUnitTestCase.assertEquals("hbazxlo", _result.newContents); |
| 5310 JUnitTestCase.assertEquals(4, _result.offset); | 5308 JUnitTestCase.assertEquals(4, _result.offset); |
| 5311 JUnitTestCase.assertEquals(0, _result.oldLength); | 5309 JUnitTestCase.assertEquals(0, _result.oldLength); |
| 5312 JUnitTestCase.assertEquals(1, _result.newLength); | 5310 JUnitTestCase.assertEquals(1, _result.newLength); |
| 5313 } | 5311 } |
| 5314 void test_update_appendWithNewResolvedUnit() { | 5312 void test_update_appendWithNewResolvedUnit() { |
| 5315 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5313 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5316 null, | 5314 null, |
| 5317 _source, | 5315 _source, |
| 5318 "hello", | 5316 "hello", |
| 5319 "hbazlo", | 5317 "hbazlo", |
| 5320 1, | 5318 1, |
| 5321 2, | 5319 2, |
| 5322 3, | 5320 3, |
| 5323 _entry); | 5321 _entry); |
| 5324 DartEntryImpl newEntry = new DartEntryImpl(); | 5322 DartEntry newEntry = new DartEntry(); |
| 5325 CompilationUnit newUnit = new CompilationUnitMock(); | 5323 CompilationUnit newUnit = new CompilationUnitMock(); |
| 5326 newEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, newUnit); | 5324 newEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, newUnit); |
| 5327 _result = IncrementalAnalysisCache.update( | 5325 _result = IncrementalAnalysisCache.update( |
| 5328 cache, | 5326 cache, |
| 5329 _source, | 5327 _source, |
| 5330 "hbazlo", | 5328 "hbazlo", |
| 5331 "hbazxlo", | 5329 "hbazxlo", |
| 5332 4, | 5330 4, |
| 5333 0, | 5331 0, |
| 5334 1, | 5332 1, |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 5345 void test_update_appendWithNoNewResolvedUnit() { | 5343 void test_update_appendWithNoNewResolvedUnit() { |
| 5346 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5344 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5347 null, | 5345 null, |
| 5348 _source, | 5346 _source, |
| 5349 "hello", | 5347 "hello", |
| 5350 "hbazlo", | 5348 "hbazlo", |
| 5351 1, | 5349 1, |
| 5352 2, | 5350 2, |
| 5353 3, | 5351 3, |
| 5354 _entry); | 5352 _entry); |
| 5355 DartEntryImpl newEntry = new DartEntryImpl(); | 5353 DartEntry newEntry = new DartEntry(); |
| 5356 _result = IncrementalAnalysisCache.update( | 5354 _result = IncrementalAnalysisCache.update( |
| 5357 cache, | 5355 cache, |
| 5358 _source, | 5356 _source, |
| 5359 "hbazlo", | 5357 "hbazlo", |
| 5360 "hbazxlo", | 5358 "hbazxlo", |
| 5361 4, | 5359 4, |
| 5362 0, | 5360 0, |
| 5363 1, | 5361 1, |
| 5364 newEntry); | 5362 newEntry); |
| 5365 JUnitTestCase.assertNotNull(_result); | 5363 JUnitTestCase.assertNotNull(_result); |
| 5366 JUnitTestCase.assertSame(_source, _result.source); | 5364 JUnitTestCase.assertSame(_source, _result.source); |
| 5367 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | 5365 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 5368 JUnitTestCase.assertEquals("hello", _result.oldContents); | 5366 JUnitTestCase.assertEquals("hello", _result.oldContents); |
| 5369 JUnitTestCase.assertEquals("hbazxlo", _result.newContents); | 5367 JUnitTestCase.assertEquals("hbazxlo", _result.newContents); |
| 5370 JUnitTestCase.assertEquals(1, _result.offset); | 5368 JUnitTestCase.assertEquals(1, _result.offset); |
| 5371 JUnitTestCase.assertEquals(2, _result.oldLength); | 5369 JUnitTestCase.assertEquals(2, _result.oldLength); |
| 5372 JUnitTestCase.assertEquals(4, _result.newLength); | 5370 JUnitTestCase.assertEquals(4, _result.newLength); |
| 5373 } | 5371 } |
| 5374 void test_update_delete() { | 5372 void test_update_delete() { |
| 5375 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5373 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5376 null, | 5374 null, |
| 5377 _source, | 5375 _source, |
| 5378 "hello", | 5376 "hello", |
| 5379 "hbazlo", | 5377 "hbazlo", |
| 5380 1, | 5378 1, |
| 5381 2, | 5379 2, |
| 5382 3, | 5380 3, |
| 5383 _entry); | 5381 _entry); |
| 5384 DartEntryImpl newEntry = new DartEntryImpl(); | 5382 DartEntry newEntry = new DartEntry(); |
| 5385 _result = IncrementalAnalysisCache.update( | 5383 _result = IncrementalAnalysisCache.update( |
| 5386 cache, | 5384 cache, |
| 5387 _source, | 5385 _source, |
| 5388 "hbazlo", | 5386 "hbazlo", |
| 5389 "hzlo", | 5387 "hzlo", |
| 5390 1, | 5388 1, |
| 5391 2, | 5389 2, |
| 5392 0, | 5390 0, |
| 5393 newEntry); | 5391 newEntry); |
| 5394 JUnitTestCase.assertNotNull(_result); | 5392 JUnitTestCase.assertNotNull(_result); |
| 5395 JUnitTestCase.assertSame(_source, _result.source); | 5393 JUnitTestCase.assertSame(_source, _result.source); |
| 5396 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | 5394 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 5397 JUnitTestCase.assertEquals("hello", _result.oldContents); | 5395 JUnitTestCase.assertEquals("hello", _result.oldContents); |
| 5398 JUnitTestCase.assertEquals("hzlo", _result.newContents); | 5396 JUnitTestCase.assertEquals("hzlo", _result.newContents); |
| 5399 JUnitTestCase.assertEquals(1, _result.offset); | 5397 JUnitTestCase.assertEquals(1, _result.offset); |
| 5400 JUnitTestCase.assertEquals(2, _result.oldLength); | 5398 JUnitTestCase.assertEquals(2, _result.oldLength); |
| 5401 JUnitTestCase.assertEquals(1, _result.newLength); | 5399 JUnitTestCase.assertEquals(1, _result.newLength); |
| 5402 } | 5400 } |
| 5403 void test_update_insert_nonContiguous_after() { | 5401 void test_update_insert_nonContiguous_after() { |
| 5404 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5402 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5405 null, | 5403 null, |
| 5406 _source, | 5404 _source, |
| 5407 "hello", | 5405 "hello", |
| 5408 "hbazlo", | 5406 "hbazlo", |
| 5409 1, | 5407 1, |
| 5410 2, | 5408 2, |
| 5411 3, | 5409 3, |
| 5412 _entry); | 5410 _entry); |
| 5413 DartEntryImpl newEntry = new DartEntryImpl(); | 5411 DartEntry newEntry = new DartEntry(); |
| 5414 _result = IncrementalAnalysisCache.update( | 5412 _result = IncrementalAnalysisCache.update( |
| 5415 cache, | 5413 cache, |
| 5416 _source, | 5414 _source, |
| 5417 "hbazlo", | 5415 "hbazlo", |
| 5418 "hbazlox", | 5416 "hbazlox", |
| 5419 6, | 5417 6, |
| 5420 0, | 5418 0, |
| 5421 1, | 5419 1, |
| 5422 newEntry); | 5420 newEntry); |
| 5423 JUnitTestCase.assertNull(_result); | 5421 JUnitTestCase.assertNull(_result); |
| 5424 } | 5422 } |
| 5425 void test_update_insert_nonContiguous_before() { | 5423 void test_update_insert_nonContiguous_before() { |
| 5426 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5424 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5427 null, | 5425 null, |
| 5428 _source, | 5426 _source, |
| 5429 "hello", | 5427 "hello", |
| 5430 "hbazlo", | 5428 "hbazlo", |
| 5431 1, | 5429 1, |
| 5432 2, | 5430 2, |
| 5433 3, | 5431 3, |
| 5434 _entry); | 5432 _entry); |
| 5435 DartEntryImpl newEntry = new DartEntryImpl(); | 5433 DartEntry newEntry = new DartEntry(); |
| 5436 _result = IncrementalAnalysisCache.update( | 5434 _result = IncrementalAnalysisCache.update( |
| 5437 cache, | 5435 cache, |
| 5438 _source, | 5436 _source, |
| 5439 "hbazlo", | 5437 "hbazlo", |
| 5440 "xhbazlo", | 5438 "xhbazlo", |
| 5441 0, | 5439 0, |
| 5442 0, | 5440 0, |
| 5443 1, | 5441 1, |
| 5444 newEntry); | 5442 newEntry); |
| 5445 JUnitTestCase.assertNull(_result); | 5443 JUnitTestCase.assertNull(_result); |
| 5446 } | 5444 } |
| 5447 void test_update_newSource_entry() { | 5445 void test_update_newSource_entry() { |
| 5448 Source oldSource = new TestSource("blat.dart", "blat"); | 5446 Source oldSource = new TestSource("blat.dart", "blat"); |
| 5449 DartEntryImpl oldEntry = new DartEntryImpl(); | 5447 DartEntry oldEntry = new DartEntry(); |
| 5450 CompilationUnit oldUnit = new CompilationUnitMock(); | 5448 CompilationUnit oldUnit = new CompilationUnitMock(); |
| 5451 oldEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, oldUnit); | 5449 oldEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, oldUnit); |
| 5452 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5450 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5453 null, | 5451 null, |
| 5454 oldSource, | 5452 oldSource, |
| 5455 "hello", | 5453 "hello", |
| 5456 "hbazlo", | 5454 "hbazlo", |
| 5457 1, | 5455 1, |
| 5458 2, | 5456 2, |
| 5459 3, | 5457 3, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 5473 JUnitTestCase.assertSame(_source, _result.source); | 5471 JUnitTestCase.assertSame(_source, _result.source); |
| 5474 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); | 5472 JUnitTestCase.assertSame(_unit, _result.resolvedUnit); |
| 5475 JUnitTestCase.assertEquals("foo", _result.oldContents); | 5473 JUnitTestCase.assertEquals("foo", _result.oldContents); |
| 5476 JUnitTestCase.assertEquals("foobz", _result.newContents); | 5474 JUnitTestCase.assertEquals("foobz", _result.newContents); |
| 5477 JUnitTestCase.assertEquals(3, _result.offset); | 5475 JUnitTestCase.assertEquals(3, _result.offset); |
| 5478 JUnitTestCase.assertEquals(0, _result.oldLength); | 5476 JUnitTestCase.assertEquals(0, _result.oldLength); |
| 5479 JUnitTestCase.assertEquals(2, _result.newLength); | 5477 JUnitTestCase.assertEquals(2, _result.newLength); |
| 5480 } | 5478 } |
| 5481 void test_update_newSource_noEntry() { | 5479 void test_update_newSource_noEntry() { |
| 5482 Source oldSource = new TestSource("blat.dart", "blat"); | 5480 Source oldSource = new TestSource("blat.dart", "blat"); |
| 5483 DartEntryImpl oldEntry = new DartEntryImpl(); | 5481 DartEntry oldEntry = new DartEntry(); |
| 5484 CompilationUnit oldUnit = new CompilationUnitMock(); | 5482 CompilationUnit oldUnit = new CompilationUnitMock(); |
| 5485 oldEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, oldUnit); | 5483 oldEntry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, oldUnit); |
| 5486 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5484 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5487 null, | 5485 null, |
| 5488 oldSource, | 5486 oldSource, |
| 5489 "hello", | 5487 "hello", |
| 5490 "hbazlo", | 5488 "hbazlo", |
| 5491 1, | 5489 1, |
| 5492 2, | 5490 2, |
| 5493 3, | 5491 3, |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5841 } | 5839 } |
| 5842 | 5840 |
| 5843 CompilationUnit _assertTask(String prefix, String removed, String added, | 5841 CompilationUnit _assertTask(String prefix, String removed, String added, |
| 5844 String suffix) { | 5842 String suffix) { |
| 5845 String oldCode = | 5843 String oldCode = |
| 5846 EngineTestCase.createSource(["${prefix}${removed}${suffix}"]); | 5844 EngineTestCase.createSource(["${prefix}${removed}${suffix}"]); |
| 5847 String newCode = | 5845 String newCode = |
| 5848 EngineTestCase.createSource(["${prefix}${added}${suffix}"]); | 5846 EngineTestCase.createSource(["${prefix}${added}${suffix}"]); |
| 5849 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); | 5847 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 5850 Source source = new TestSource("/test.dart", oldCode); | 5848 Source source = new TestSource("/test.dart", oldCode); |
| 5851 DartEntryImpl entry = new DartEntryImpl(); | 5849 DartEntry entry = new DartEntry(); |
| 5852 CompilationUnit oldUnit = context.resolveCompilationUnit2(source, source); | 5850 CompilationUnit oldUnit = context.resolveCompilationUnit2(source, source); |
| 5853 JUnitTestCase.assertNotNull(oldUnit); | 5851 JUnitTestCase.assertNotNull(oldUnit); |
| 5854 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source, oldUnit); | 5852 entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, source, oldUnit); |
| 5855 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 5853 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| 5856 null, | 5854 null, |
| 5857 source, | 5855 source, |
| 5858 oldCode, | 5856 oldCode, |
| 5859 newCode, | 5857 newCode, |
| 5860 prefix.length, | 5858 prefix.length, |
| 5861 removed.length, | 5859 removed.length, |
| (...skipping 2922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8784 TestSource source = new TestSource(); | 8782 TestSource source = new TestSource(); |
| 8785 JUnitTestCase.assertTrue(partition.contains(source)); | 8783 JUnitTestCase.assertTrue(partition.contains(source)); |
| 8786 } | 8784 } |
| 8787 void test_creation() { | 8785 void test_creation() { |
| 8788 JUnitTestCase.assertNotNull(new UniversalCachePartition(null, 8, null)); | 8786 JUnitTestCase.assertNotNull(new UniversalCachePartition(null, 8, null)); |
| 8789 } | 8787 } |
| 8790 void test_entrySet() { | 8788 void test_entrySet() { |
| 8791 UniversalCachePartition partition = | 8789 UniversalCachePartition partition = |
| 8792 new UniversalCachePartition(null, 8, null); | 8790 new UniversalCachePartition(null, 8, null); |
| 8793 TestSource source = new TestSource(); | 8791 TestSource source = new TestSource(); |
| 8794 DartEntryImpl entry = new DartEntryImpl(); | 8792 DartEntry entry = new DartEntry(); |
| 8795 partition.put(source, entry); | 8793 partition.put(source, entry); |
| 8796 JavaIterator<MapEntry<Source, SourceEntry>> entries = | 8794 JavaIterator<MapEntry<Source, SourceEntry>> entries = |
| 8797 new JavaIterator(getMapEntrySet(partition.map)); | 8795 new JavaIterator(getMapEntrySet(partition.map)); |
| 8798 JUnitTestCase.assertTrue(entries.hasNext); | 8796 JUnitTestCase.assertTrue(entries.hasNext); |
| 8799 MapEntry<Source, SourceEntry> mapEntry = entries.next(); | 8797 MapEntry<Source, SourceEntry> mapEntry = entries.next(); |
| 8800 JUnitTestCase.assertSame(source, mapEntry.getKey()); | 8798 JUnitTestCase.assertSame(source, mapEntry.getKey()); |
| 8801 JUnitTestCase.assertSame(entry, mapEntry.getValue()); | 8799 JUnitTestCase.assertSame(entry, mapEntry.getValue()); |
| 8802 JUnitTestCase.assertFalse(entries.hasNext); | 8800 JUnitTestCase.assertFalse(entries.hasNext); |
| 8803 } | 8801 } |
| 8804 void test_get() { | 8802 void test_get() { |
| 8805 UniversalCachePartition partition = | 8803 UniversalCachePartition partition = |
| 8806 new UniversalCachePartition(null, 8, null); | 8804 new UniversalCachePartition(null, 8, null); |
| 8807 TestSource source = new TestSource(); | 8805 TestSource source = new TestSource(); |
| 8808 JUnitTestCase.assertNull(partition.get(source)); | 8806 JUnitTestCase.assertNull(partition.get(source)); |
| 8809 } | 8807 } |
| 8810 void test_put_noFlush() { | 8808 void test_put_noFlush() { |
| 8811 UniversalCachePartition partition = | 8809 UniversalCachePartition partition = |
| 8812 new UniversalCachePartition(null, 8, null); | 8810 new UniversalCachePartition(null, 8, null); |
| 8813 TestSource source = new TestSource(); | 8811 TestSource source = new TestSource(); |
| 8814 DartEntryImpl entry = new DartEntryImpl(); | 8812 DartEntry entry = new DartEntry(); |
| 8815 partition.put(source, entry); | 8813 partition.put(source, entry); |
| 8816 JUnitTestCase.assertSame(entry, partition.get(source)); | 8814 JUnitTestCase.assertSame(entry, partition.get(source)); |
| 8817 } | 8815 } |
| 8818 void test_remove() { | 8816 void test_remove() { |
| 8819 UniversalCachePartition partition = | 8817 UniversalCachePartition partition = |
| 8820 new UniversalCachePartition(null, 8, null); | 8818 new UniversalCachePartition(null, 8, null); |
| 8821 TestSource source = new TestSource(); | 8819 TestSource source = new TestSource(); |
| 8822 DartEntryImpl entry = new DartEntryImpl(); | 8820 DartEntry entry = new DartEntry(); |
| 8823 partition.put(source, entry); | 8821 partition.put(source, entry); |
| 8824 JUnitTestCase.assertSame(entry, partition.get(source)); | 8822 JUnitTestCase.assertSame(entry, partition.get(source)); |
| 8825 partition.remove(source); | 8823 partition.remove(source); |
| 8826 JUnitTestCase.assertNull(partition.get(source)); | 8824 JUnitTestCase.assertNull(partition.get(source)); |
| 8827 } | 8825 } |
| 8828 void test_setMaxCacheSize() { | 8826 void test_setMaxCacheSize() { |
| 8829 UniversalCachePartition partition = new UniversalCachePartition( | 8827 UniversalCachePartition partition = new UniversalCachePartition( |
| 8830 null, | 8828 null, |
| 8831 8, | 8829 8, |
| 8832 new _UniversalCachePartitionTest_test_setMaxCacheSize()); | 8830 new _UniversalCachePartitionTest_test_setMaxCacheSize()); |
| 8833 int size = 6; | 8831 int size = 6; |
| 8834 for (int i = 0; i < size; i++) { | 8832 for (int i = 0; i < size; i++) { |
| 8835 Source source = new TestSource("/test${i}.dart"); | 8833 Source source = new TestSource("/test${i}.dart"); |
| 8836 DartEntryImpl entry = new DartEntryImpl(); | 8834 DartEntry entry = new DartEntry(); |
| 8837 entry.setValue(DartEntry.PARSED_UNIT, null); | 8835 entry.setValue(DartEntry.PARSED_UNIT, null); |
| 8838 partition.put(source, entry); | 8836 partition.put(source, entry); |
| 8839 partition.accessedAst(source); | 8837 partition.accessedAst(source); |
| 8840 } | 8838 } |
| 8841 _assertNonFlushedCount(size, partition); | 8839 _assertNonFlushedCount(size, partition); |
| 8842 int newSize = size - 2; | 8840 int newSize = size - 2; |
| 8843 partition.maxCacheSize = newSize; | 8841 partition.maxCacheSize = newSize; |
| 8844 _assertNonFlushedCount(newSize, partition); | 8842 _assertNonFlushedCount(newSize, partition); |
| 8845 } | 8843 } |
| 8846 void test_size() { | 8844 void test_size() { |
| 8847 UniversalCachePartition partition = | 8845 UniversalCachePartition partition = |
| 8848 new UniversalCachePartition(null, 8, null); | 8846 new UniversalCachePartition(null, 8, null); |
| 8849 int size = 4; | 8847 int size = 4; |
| 8850 for (int i = 0; i < size; i++) { | 8848 for (int i = 0; i < size; i++) { |
| 8851 Source source = new TestSource("/test${i}.dart"); | 8849 Source source = new TestSource("/test${i}.dart"); |
| 8852 partition.put(source, new DartEntryImpl()); | 8850 partition.put(source, new DartEntry()); |
| 8853 partition.accessedAst(source); | 8851 partition.accessedAst(source); |
| 8854 } | 8852 } |
| 8855 JUnitTestCase.assertEquals(size, partition.size()); | 8853 JUnitTestCase.assertEquals(size, partition.size()); |
| 8856 } | 8854 } |
| 8857 void _assertNonFlushedCount(int expectedCount, | 8855 void _assertNonFlushedCount(int expectedCount, |
| 8858 UniversalCachePartition partition) { | 8856 UniversalCachePartition partition) { |
| 8859 int nonFlushedCount = 0; | 8857 int nonFlushedCount = 0; |
| 8860 JavaIterator<MapEntry<Source, SourceEntry>> entries = | 8858 JavaIterator<MapEntry<Source, SourceEntry>> entries = |
| 8861 new JavaIterator(getMapEntrySet(partition.map)); | 8859 new JavaIterator(getMapEntrySet(partition.map)); |
| 8862 while (entries.hasNext) { | 8860 while (entries.hasNext) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9027 } | 9025 } |
| 9028 } | 9026 } |
| 9029 | 9027 |
| 9030 | 9028 |
| 9031 class _UniversalCachePartitionTest_test_setMaxCacheSize implements | 9029 class _UniversalCachePartitionTest_test_setMaxCacheSize implements |
| 9032 CacheRetentionPolicy { | 9030 CacheRetentionPolicy { |
| 9033 @override | 9031 @override |
| 9034 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => | 9032 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => |
| 9035 RetentionPriority.LOW; | 9033 RetentionPriority.LOW; |
| 9036 } | 9034 } |
| OLD | NEW |