OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 test.source.analysis_options_provider; | 5 library test.source.analysis_options_provider; |
6 | 6 |
7 import 'package:analyzer/file_system/memory_file_system.dart'; | 7 import 'package:analyzer/file_system/memory_file_system.dart'; |
8 import 'package:analyzer/source/analysis_options_provider.dart'; | 8 import 'package:analyzer/source/analysis_options_provider.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 import 'package:yaml/yaml.dart'; | 10 import 'package:yaml/yaml.dart'; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 setUp(() { | 45 setUp(() { |
46 buildResourceProvider(true); | 46 buildResourceProvider(true); |
47 }); | 47 }); |
48 tearDown(() { | 48 tearDown(() { |
49 clearResourceProvider(); | 49 clearResourceProvider(); |
50 }); | 50 }); |
51 test('test_empty', () { | 51 test('test_empty', () { |
52 var optionsProvider = new AnalysisOptionsProvider(); | 52 var optionsProvider = new AnalysisOptionsProvider(); |
53 Map<String, YamlNode> options = | 53 Map<String, YamlNode> options = |
54 optionsProvider.getOptions(resourceProvider.getFolder('/')); | 54 optionsProvider.getOptions(resourceProvider.getFolder('/')); |
| 55 expect(options, isNotNull); |
55 }); | 56 }); |
56 }); | 57 }); |
57 group('AnalysisOptionsProvider', () { | 58 group('AnalysisOptionsProvider', () { |
58 setUp(() { | 59 setUp(() { |
59 buildResourceProvider(false, true); | 60 buildResourceProvider(false, true); |
60 }); | 61 }); |
61 tearDown(() { | 62 tearDown(() { |
62 clearResourceProvider(); | 63 clearResourceProvider(); |
63 }); | 64 }); |
64 test('test_invalid', () { | 65 test('test_invalid', () { |
65 var optionsProvider = new AnalysisOptionsProvider(); | 66 var optionsProvider = new AnalysisOptionsProvider(); |
66 bool exceptionCaught = false; | 67 bool exceptionCaught = false; |
67 try { | 68 try { |
68 Map<String, YamlNode> options = | 69 Map<String, YamlNode> options = |
69 optionsProvider.getOptions(resourceProvider.getFolder('/')); | 70 optionsProvider.getOptions(resourceProvider.getFolder('/')); |
70 } catch (e, st) { | 71 expect(options, isNotNull); |
| 72 } catch (e) { |
71 exceptionCaught = true; | 73 exceptionCaught = true; |
72 } | 74 } |
73 expect(exceptionCaught, isTrue); | 75 expect(exceptionCaught, isTrue); |
74 }); | 76 }); |
75 }); | 77 }); |
76 } | 78 } |
77 | 79 |
78 MemoryResourceProvider resourceProvider; | 80 MemoryResourceProvider resourceProvider; |
79 | 81 |
80 buildResourceProvider([bool emptyAnalysisOptions = false, | 82 buildResourceProvider([bool emptyAnalysisOptions = false, |
(...skipping 17 matching lines...) Expand all Loading... |
98 } | 100 } |
99 } | 101 } |
100 | 102 |
101 clearResourceProvider() { | 103 clearResourceProvider() { |
102 resourceProvider = null; | 104 resourceProvider = null; |
103 } | 105 } |
104 | 106 |
105 emptyResourceProvider() { | 107 emptyResourceProvider() { |
106 resourceProvider = new MemoryResourceProvider(); | 108 resourceProvider = new MemoryResourceProvider(); |
107 } | 109 } |
OLD | NEW |