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 library analyzer.test.generated.engine_test; | 5 library analyzer.test.generated.engine_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 import 'package:analyzer/src/generated/source_io.dart'; | 21 import 'package:analyzer/src/generated/source_io.dart'; |
22 import 'package:analyzer/src/string_source.dart'; | 22 import 'package:analyzer/src/string_source.dart'; |
23 import 'package:analyzer/task/model.dart'; | 23 import 'package:analyzer/task/model.dart'; |
24 import 'package:html/dom.dart' show Document; | 24 import 'package:html/dom.dart' show Document; |
25 import 'package:test/test.dart'; | 25 import 'package:test/test.dart'; |
26 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 26 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
27 import 'package:typed_mock/typed_mock.dart'; | 27 import 'package:typed_mock/typed_mock.dart'; |
28 | 28 |
29 main() { | 29 main() { |
30 defineReflectiveSuite(() { | 30 defineReflectiveSuite(() { |
| 31 defineReflectiveTests(AnalysisOptionsImplTest); |
31 defineReflectiveTests(SourcesChangedEventTest); | 32 defineReflectiveTests(SourcesChangedEventTest); |
32 }); | 33 }); |
33 } | 34 } |
34 | 35 |
| 36 @reflectiveTest |
| 37 class AnalysisOptionsImplTest { |
| 38 test_resetToDefaults() { |
| 39 // Note that this only tests options visible from the interface. |
| 40 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); |
| 41 AnalysisOptionsImpl modifiedOptions = new AnalysisOptionsImpl(); |
| 42 modifiedOptions.dart2jsHint = true; |
| 43 modifiedOptions.disableCacheFlushing = true; |
| 44 modifiedOptions.enableAssertInitializer = true; |
| 45 modifiedOptions.enableAssertMessage = true; |
| 46 modifiedOptions.enableLazyAssignmentOperators = true; |
| 47 modifiedOptions.enableStrictCallChecks = true; |
| 48 modifiedOptions.enableSuperMixins = true; |
| 49 modifiedOptions.enableTiming = true; |
| 50 modifiedOptions.enableUriInPartOf = true; |
| 51 modifiedOptions.errorProcessors = [null]; |
| 52 modifiedOptions.excludePatterns = ['a']; |
| 53 modifiedOptions.finerGrainedInvalidation = true; |
| 54 modifiedOptions.generateImplicitErrors = false; |
| 55 modifiedOptions.generateSdkErrors = true; |
| 56 modifiedOptions.hint = false; |
| 57 modifiedOptions.incremental = true; |
| 58 modifiedOptions.incrementalApi = true; |
| 59 modifiedOptions.incrementalValidation = true; |
| 60 modifiedOptions.lint = true; |
| 61 modifiedOptions.lintRules = [null]; |
| 62 modifiedOptions.patchPlatform = 3; |
| 63 modifiedOptions.preserveComments = false; |
| 64 modifiedOptions.strongMode = true; |
| 65 modifiedOptions.trackCacheDependencies = false; |
| 66 |
| 67 modifiedOptions.resetToDefaults(); |
| 68 |
| 69 expect(modifiedOptions.dart2jsHint, defaultOptions.dart2jsHint); |
| 70 expect(modifiedOptions.disableCacheFlushing, |
| 71 defaultOptions.disableCacheFlushing); |
| 72 expect(modifiedOptions.enableAssertInitializer, |
| 73 defaultOptions.enableAssertInitializer); |
| 74 expect(modifiedOptions.enableAssertMessage, |
| 75 defaultOptions.enableAssertMessage); |
| 76 expect(modifiedOptions.enableLazyAssignmentOperators, |
| 77 defaultOptions.enableLazyAssignmentOperators); |
| 78 expect(modifiedOptions.enableStrictCallChecks, |
| 79 defaultOptions.enableStrictCallChecks); |
| 80 expect(modifiedOptions.enableSuperMixins, defaultOptions.enableSuperMixins); |
| 81 expect(modifiedOptions.enableTiming, defaultOptions.enableTiming); |
| 82 expect(modifiedOptions.enableUriInPartOf, defaultOptions.enableUriInPartOf); |
| 83 expect(modifiedOptions.errorProcessors, defaultOptions.errorProcessors); |
| 84 expect(modifiedOptions.excludePatterns, defaultOptions.excludePatterns); |
| 85 expect(modifiedOptions.finerGrainedInvalidation, |
| 86 defaultOptions.finerGrainedInvalidation); |
| 87 expect(modifiedOptions.generateImplicitErrors, |
| 88 defaultOptions.generateImplicitErrors); |
| 89 expect(modifiedOptions.generateSdkErrors, defaultOptions.generateSdkErrors); |
| 90 expect(modifiedOptions.hint, defaultOptions.hint); |
| 91 expect(modifiedOptions.incremental, defaultOptions.incremental); |
| 92 expect(modifiedOptions.incrementalApi, defaultOptions.incrementalApi); |
| 93 expect(modifiedOptions.incrementalValidation, |
| 94 defaultOptions.incrementalValidation); |
| 95 expect(modifiedOptions.lint, defaultOptions.lint); |
| 96 expect(modifiedOptions.lintRules, defaultOptions.lintRules); |
| 97 expect(modifiedOptions.patchPlatform, defaultOptions.patchPlatform); |
| 98 expect(modifiedOptions.preserveComments, defaultOptions.preserveComments); |
| 99 expect(modifiedOptions.strongMode, defaultOptions.strongMode); |
| 100 expect(modifiedOptions.trackCacheDependencies, |
| 101 defaultOptions.trackCacheDependencies); |
| 102 } |
| 103 } |
| 104 |
35 /** | 105 /** |
36 * A listener used to gather the [ImplicitAnalysisEvent]s that are produced | 106 * A listener used to gather the [ImplicitAnalysisEvent]s that are produced |
37 * during analysis. | 107 * during analysis. |
38 */ | 108 */ |
39 class AnalyzedSourcesListener { | 109 class AnalyzedSourcesListener { |
40 /** | 110 /** |
41 * The events that have been gathered. | 111 * The events that have been gathered. |
42 */ | 112 */ |
43 List<ImplicitAnalysisEvent> actualEvents = <ImplicitAnalysisEvent>[]; | 113 List<ImplicitAnalysisEvent> actualEvents = <ImplicitAnalysisEvent>[]; |
44 | 114 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 @override | 776 @override |
707 void test_flushAstStructures(Source source) { | 777 void test_flushAstStructures(Source source) { |
708 fail("Unexpected invocation of test_flushAstStructures"); | 778 fail("Unexpected invocation of test_flushAstStructures"); |
709 } | 779 } |
710 | 780 |
711 @override | 781 @override |
712 void visitContentCache(ContentCacheVisitor visitor) { | 782 void visitContentCache(ContentCacheVisitor visitor) { |
713 fail("Unexpected invocation of visitContentCache"); | 783 fail("Unexpected invocation of visitContentCache"); |
714 } | 784 } |
715 } | 785 } |
OLD | NEW |