| 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 10 matching lines...) Expand all Loading... |
| 21 import 'package:analyzer/src/generated/java_junit.dart'; | 21 import 'package:analyzer/src/generated/java_junit.dart'; |
| 22 import 'package:analyzer/src/generated/parser.dart'; | 22 import 'package:analyzer/src/generated/parser.dart'; |
| 23 import 'package:analyzer/src/generated/resolver.dart'; | 23 import 'package:analyzer/src/generated/resolver.dart'; |
| 24 import 'package:analyzer/src/generated/scanner.dart'; | 24 import 'package:analyzer/src/generated/scanner.dart'; |
| 25 import 'package:analyzer/src/generated/sdk.dart'; | 25 import 'package:analyzer/src/generated/sdk.dart'; |
| 26 import 'package:analyzer/src/generated/sdk_io.dart'; | 26 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 27 import 'package:analyzer/src/generated/source_io.dart'; | 27 import 'package:analyzer/src/generated/source_io.dart'; |
| 28 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 28 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 29 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 29 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 30 import 'package:analyzer/src/generated/utilities_collection.dart'; | 30 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 31 import 'package:analyzer/src/task/task_dart.dart'; |
| 31 import 'package:typed_mock/typed_mock.dart'; | 32 import 'package:typed_mock/typed_mock.dart'; |
| 32 import 'package:unittest/unittest.dart' as _ut; | 33 import 'package:unittest/unittest.dart' as _ut; |
| 33 | 34 |
| 34 import 'all_the_rest.dart'; | 35 import 'all_the_rest.dart'; |
| 35 import 'resolver_test.dart'; | 36 import 'resolver_test.dart'; |
| 36 import 'test_support.dart'; | 37 import 'test_support.dart'; |
| 37 import '../reflective_tests.dart'; | 38 import '../reflective_tests.dart'; |
| 38 | 39 |
| 39 | 40 |
| 40 main() { | 41 main() { |
| (...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2580 CacheState.INVALID, | 2581 CacheState.INVALID, |
| 2581 entry.getState(DartEntry.IS_LAUNCHABLE)); | 2582 entry.getState(DartEntry.IS_LAUNCHABLE)); |
| 2582 // false | 2583 // false |
| 2583 entry.setValue(DartEntry.IS_LAUNCHABLE, false); | 2584 entry.setValue(DartEntry.IS_LAUNCHABLE, false); |
| 2584 JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_LAUNCHABLE)); | 2585 JUnitTestCase.assertFalse(entry.getValue(DartEntry.IS_LAUNCHABLE)); |
| 2585 JUnitTestCase.assertSame( | 2586 JUnitTestCase.assertSame( |
| 2586 CacheState.VALID, | 2587 CacheState.VALID, |
| 2587 entry.getState(DartEntry.IS_LAUNCHABLE)); | 2588 entry.getState(DartEntry.IS_LAUNCHABLE)); |
| 2588 } | 2589 } |
| 2589 | 2590 |
| 2590 void test_recordBuildElementErrorInLibrary() { | 2591 void test_recordBuildElementError() { |
| 2591 // TODO(brianwilkerson) This test should set the state for two libraries, | 2592 // TODO(brianwilkerson) This test should set the state for two libraries, |
| 2592 // record an error in one library, then verify that the data for the other | 2593 // record an error in one library, then verify that the data for the other |
| 2593 // library is still valid. | 2594 // library is still valid. |
| 2594 Source source = new TestSource(); | 2595 Source source = new TestSource(); |
| 2595 DartEntry entry = new DartEntry(); | 2596 DartEntry entry = new DartEntry(); |
| 2596 entry.recordBuildElementErrorInLibrary( | 2597 entry.recordBuildElementErrorInLibrary( |
| 2597 source, | 2598 source, |
| 2598 new CaughtException(new AnalysisException(), null)); | 2599 new CaughtException(new AnalysisException(), null)); |
| 2599 JUnitTestCase.assertSame( | 2600 JUnitTestCase.assertSame( |
| 2600 CacheState.INVALID, | 2601 CacheState.INVALID, |
| 2601 entry.getState(SourceEntry.CONTENT)); | 2602 entry.getState(SourceEntry.CONTENT)); |
| 2602 JUnitTestCase.assertSame( | 2603 JUnitTestCase.assertSame( |
| 2603 CacheState.ERROR, | 2604 CacheState.ERROR, |
| 2605 entry.getStateInLibrary(DartEntry.BUILT_ELEMENT, source)); |
| 2606 JUnitTestCase.assertSame( |
| 2607 CacheState.ERROR, |
| 2608 entry.getStateInLibrary(DartEntry.BUILT_UNIT, source)); |
| 2609 JUnitTestCase.assertSame( |
| 2610 CacheState.ERROR, |
| 2604 entry.getState(DartEntry.ELEMENT)); | 2611 entry.getState(DartEntry.ELEMENT)); |
| 2605 JUnitTestCase.assertSame( | 2612 JUnitTestCase.assertSame( |
| 2606 CacheState.INVALID, | 2613 CacheState.INVALID, |
| 2607 entry.getState(DartEntry.EXPORTED_LIBRARIES)); | 2614 entry.getState(DartEntry.EXPORTED_LIBRARIES)); |
| 2608 JUnitTestCase.assertSame( | 2615 JUnitTestCase.assertSame( |
| 2609 CacheState.INVALID, | 2616 CacheState.INVALID, |
| 2610 entry.getState(DartEntry.IMPORTED_LIBRARIES)); | 2617 entry.getState(DartEntry.IMPORTED_LIBRARIES)); |
| 2611 JUnitTestCase.assertSame( | 2618 JUnitTestCase.assertSame( |
| 2612 CacheState.INVALID, | 2619 CacheState.INVALID, |
| 2613 entry.getState(DartEntry.INCLUDED_PARTS)); | 2620 entry.getState(DartEntry.INCLUDED_PARTS)); |
| 2614 JUnitTestCase.assertSame( | 2621 JUnitTestCase.assertSame( |
| 2615 CacheState.ERROR, | 2622 CacheState.ERROR, |
| 2616 entry.getState(DartEntry.IS_CLIENT)); | 2623 entry.getState(DartEntry.IS_CLIENT)); |
| 2617 JUnitTestCase.assertSame( | 2624 JUnitTestCase.assertSame( |
| 2618 CacheState.ERROR, | 2625 CacheState.ERROR, |
| 2619 entry.getState(DartEntry.IS_LAUNCHABLE)); | 2626 entry.getState(DartEntry.IS_LAUNCHABLE)); |
| 2620 JUnitTestCase.assertSame( | 2627 JUnitTestCase.assertSame( |
| 2621 CacheState.INVALID, | 2628 CacheState.INVALID, |
| 2622 entry.getState(SourceEntry.LINE_INFO)); | 2629 entry.getState(SourceEntry.LINE_INFO)); |
| 2623 JUnitTestCase.assertSame( | 2630 JUnitTestCase.assertSame( |
| 2624 CacheState.INVALID, | 2631 CacheState.INVALID, |
| 2625 entry.getState(DartEntry.PARSE_ERRORS)); | 2632 entry.getState(DartEntry.PARSE_ERRORS)); |
| 2626 JUnitTestCase.assertSame( | 2633 JUnitTestCase.assertSame( |
| 2627 CacheState.INVALID, | 2634 CacheState.INVALID, |
| 2628 entry.getState(DartEntry.PARSED_UNIT)); | 2635 entry.getState(DartEntry.PARSED_UNIT)); |
| 2629 JUnitTestCase.assertSame( | 2636 JUnitTestCase.assertSame( |
| 2630 CacheState.INVALID, | 2637 CacheState.ERROR, |
| 2631 entry.getState(DartEntry.PUBLIC_NAMESPACE)); | 2638 entry.getState(DartEntry.PUBLIC_NAMESPACE)); |
| 2632 JUnitTestCase.assertSame( | 2639 JUnitTestCase.assertSame( |
| 2633 CacheState.INVALID, | 2640 CacheState.INVALID, |
| 2634 entry.getState(DartEntry.SCAN_ERRORS)); | 2641 entry.getState(DartEntry.SCAN_ERRORS)); |
| 2635 JUnitTestCase.assertSame( | 2642 JUnitTestCase.assertSame( |
| 2636 CacheState.INVALID, | 2643 CacheState.INVALID, |
| 2637 entry.getState(DartEntry.SOURCE_KIND)); | 2644 entry.getState(DartEntry.SOURCE_KIND)); |
| 2638 JUnitTestCase.assertSame( | 2645 JUnitTestCase.assertSame( |
| 2639 CacheState.INVALID, | 2646 CacheState.INVALID, |
| 2640 entry.getState(DartEntry.TOKEN_STREAM)); | 2647 entry.getState(DartEntry.TOKEN_STREAM)); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2947 entry.getStateInLibrary(DartEntry.RESOLUTION_ERRORS, source)); | 2954 entry.getStateInLibrary(DartEntry.RESOLUTION_ERRORS, source)); |
| 2948 JUnitTestCase.assertSame( | 2955 JUnitTestCase.assertSame( |
| 2949 CacheState.ERROR, | 2956 CacheState.ERROR, |
| 2950 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); | 2957 entry.getStateInLibrary(DartEntry.RESOLVED_UNIT, source)); |
| 2951 JUnitTestCase.assertSame( | 2958 JUnitTestCase.assertSame( |
| 2952 CacheState.ERROR, | 2959 CacheState.ERROR, |
| 2953 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); | 2960 entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source)); |
| 2954 } | 2961 } |
| 2955 | 2962 |
| 2956 void test_recordScanError() { | 2963 void test_recordScanError() { |
| 2957 // Source source = new TestSource(); | 2964 // Source source = new TestSource(); |
| 2958 DartEntry entry = new DartEntry(); | 2965 DartEntry entry = new DartEntry(); |
| 2959 entry.recordScanError(new CaughtException(new AnalysisException(), null)); | 2966 entry.recordScanError(new CaughtException(new AnalysisException(), null)); |
| 2960 JUnitTestCase.assertSame( | 2967 JUnitTestCase.assertSame( |
| 2961 CacheState.INVALID, | 2968 CacheState.INVALID, |
| 2962 entry.getState(SourceEntry.CONTENT)); | 2969 entry.getState(SourceEntry.CONTENT)); |
| 2963 JUnitTestCase.assertSame( | 2970 JUnitTestCase.assertSame( |
| 2964 CacheState.ERROR, | 2971 CacheState.ERROR, |
| 2965 entry.getState(DartEntry.ELEMENT)); | 2972 entry.getState(DartEntry.ELEMENT)); |
| 2966 JUnitTestCase.assertSame( | 2973 JUnitTestCase.assertSame( |
| 2967 CacheState.ERROR, | 2974 CacheState.ERROR, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2995 entry.getState(DartEntry.SCAN_ERRORS)); | 3002 entry.getState(DartEntry.SCAN_ERRORS)); |
| 2996 JUnitTestCase.assertSame( | 3003 JUnitTestCase.assertSame( |
| 2997 CacheState.ERROR, | 3004 CacheState.ERROR, |
| 2998 entry.getState(DartEntry.SOURCE_KIND)); | 3005 entry.getState(DartEntry.SOURCE_KIND)); |
| 2999 JUnitTestCase.assertSame( | 3006 JUnitTestCase.assertSame( |
| 3000 CacheState.ERROR, | 3007 CacheState.ERROR, |
| 3001 entry.getState(DartEntry.TOKEN_STREAM)); | 3008 entry.getState(DartEntry.TOKEN_STREAM)); |
| 3002 // The following lines are commented out because we don't currently have | 3009 // The following lines are commented out because we don't currently have |
| 3003 // any way of setting the state for data associated with a library we | 3010 // any way of setting the state for data associated with a library we |
| 3004 // don't know anything about. | 3011 // don't know anything about. |
| 3005 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILD_ELEME
NT_ERRORS, source)); | 3012 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEnt
ry.BUILT_ELEMENT, source)); |
| 3006 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.BUILT_UNIT,
source)); | 3013 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEnt
ry.BUILT_UNIT, source)); |
| 3007 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.HINTS, sour
ce)); | 3014 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEnt
ry.HINTS, source)); |
| 3008 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLUTION_
ERRORS, source)); | 3015 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEnt
ry.RESOLUTION_ERRORS, source)); |
| 3009 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.RESOLVED_UN
IT, source)); | 3016 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEnt
ry.RESOLVED_UNIT, source)); |
| 3010 // assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATIO
N_ERRORS, source)); | 3017 // JUnitTestCase.assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEnt
ry.VERIFICATION_ERRORS, source)); |
| 3011 } | 3018 } |
| 3012 | 3019 |
| 3013 void test_recordVerificationErrorInLibrary() { | 3020 void test_recordVerificationErrorInLibrary() { |
| 3014 // TODO(brianwilkerson) This test should set the state for two libraries, | 3021 // TODO(brianwilkerson) This test should set the state for two libraries, |
| 3015 // record an error in one library, then verify that the data for the other | 3022 // record an error in one library, then verify that the data for the other |
| 3016 // library is still valid. | 3023 // library is still valid. |
| 3017 Source source = new TestSource(); | 3024 Source source = new TestSource(); |
| 3018 DartEntry entry = new DartEntry(); | 3025 DartEntry entry = new DartEntry(); |
| 3019 entry.recordVerificationErrorInLibrary( | 3026 entry.recordVerificationErrorInLibrary( |
| 3020 source, | 3027 source, |
| (...skipping 3829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6850 } | 6857 } |
| 6851 | 6858 |
| 6852 | 6859 |
| 6853 /** | 6860 /** |
| 6854 * Instances of the class `TestTaskVisitor` implement a task visitor that fails
if any of its | 6861 * Instances of the class `TestTaskVisitor` implement a task visitor that fails
if any of its |
| 6855 * methods are invoked. Subclasses typically override the expected methods to no
t cause a test | 6862 * methods are invoked. Subclasses typically override the expected methods to no
t cause a test |
| 6856 * failure. | 6863 * failure. |
| 6857 */ | 6864 */ |
| 6858 class TestTaskVisitor<E> implements AnalysisTaskVisitor<E> { | 6865 class TestTaskVisitor<E> implements AnalysisTaskVisitor<E> { |
| 6859 @override | 6866 @override |
| 6867 E visitBuildUnitElementTask(BuildUnitElementTask task) { |
| 6868 JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartErrorsTask"); |
| 6869 return null; |
| 6870 } |
| 6871 |
| 6872 @override |
| 6860 E visitGenerateDartErrorsTask(GenerateDartErrorsTask task) { | 6873 E visitGenerateDartErrorsTask(GenerateDartErrorsTask task) { |
| 6861 JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartErrorsTask"); | 6874 JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartErrorsTask"); |
| 6862 return null; | 6875 return null; |
| 6863 } | 6876 } |
| 6864 @override | 6877 @override |
| 6865 E visitGenerateDartHintsTask(GenerateDartHintsTask task) { | 6878 E visitGenerateDartHintsTask(GenerateDartHintsTask task) { |
| 6866 JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartHintsTask"); | 6879 JUnitTestCase.fail("Unexpectedly invoked visitGenerateDartHintsTask"); |
| 6867 return null; | 6880 return null; |
| 6868 } | 6881 } |
| 6869 @override | 6882 @override |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7119 } | 7132 } |
| 7120 } | 7133 } |
| 7121 | 7134 |
| 7122 | 7135 |
| 7123 class _UniversalCachePartitionTest_test_setMaxCacheSize implements | 7136 class _UniversalCachePartitionTest_test_setMaxCacheSize implements |
| 7124 CacheRetentionPolicy { | 7137 CacheRetentionPolicy { |
| 7125 @override | 7138 @override |
| 7126 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => | 7139 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => |
| 7127 RetentionPriority.LOW; | 7140 RetentionPriority.LOW; |
| 7128 } | 7141 } |
| OLD | NEW |