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 linter.test.integration; | 5 library linter.test.integration; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:linter/src/config.dart'; | 10 import 'package:linter/src/config.dart'; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 .main(['test/_data/p8', '-c', 'test/_data/p8/lintconfig.yaml']); | 143 .main(['test/_data/p8', '-c', 'test/_data/p8/lintconfig.yaml']); |
144 expect(exitCode, 0); | 144 expect(exitCode, 0); |
145 expect( | 145 expect( |
146 collectingOut.trim(), | 146 collectingOut.trim(), |
147 stringContainsInOrder( | 147 stringContainsInOrder( |
148 ['2 files analyzed, 0 issues found (1 filtered), in'])); | 148 ['2 files analyzed, 0 issues found (1 filtered), in'])); |
149 }); | 149 }); |
150 }); | 150 }); |
151 }); | 151 }); |
152 | 152 |
| 153 group('overridden_field', () { |
| 154 IOSink currentOut = outSink; |
| 155 CollectingSink collectingOut = new CollectingSink(); |
| 156 setUp(() { |
| 157 exitCode = 0; |
| 158 outSink = collectingOut; |
| 159 }); |
| 160 tearDown(() { |
| 161 collectingOut.buffer.clear(); |
| 162 outSink = currentOut; |
| 163 exitCode = 0; |
| 164 }); |
| 165 |
| 166 // https://github.com/dart-lang/linter/issues/246 |
| 167 test('overrides across libraries', () { |
| 168 dartlint.main([ |
| 169 'test/_data/overridden_field', |
| 170 '-c', |
| 171 'test/_data/overridden_field/lintconfig.yaml' |
| 172 ]); |
| 173 expect(exitCode, 0); |
| 174 expect(collectingOut.trim(), |
| 175 stringContainsInOrder(['2 files analyzed, 0 issues found, in'])); |
| 176 }); |
| 177 }); |
| 178 |
153 group('examples', () { | 179 group('examples', () { |
154 test('lintconfig.yaml', () { | 180 test('lintconfig.yaml', () { |
155 var src = readFile('example/lintconfig.yaml'); | 181 var src = readFile('example/lintconfig.yaml'); |
156 var config = new LintConfig.parse(src); | 182 var config = new LintConfig.parse(src); |
157 expect(config.fileIncludes, unorderedEquals(['foo/**'])); | 183 expect(config.fileIncludes, unorderedEquals(['foo/**'])); |
158 expect( | 184 expect( |
159 config.fileExcludes, unorderedEquals(['**/_data.dart', 'test/**'])); | 185 config.fileExcludes, unorderedEquals(['**/_data.dart', 'test/**'])); |
160 expect(config.ruleConfigs, hasLength(1)); | 186 expect(config.ruleConfigs, hasLength(1)); |
161 var ruleConfig = config.ruleConfigs[0]; | 187 var ruleConfig = config.ruleConfigs[0]; |
162 expect(ruleConfig.group, 'style_guide'); | 188 expect(ruleConfig.group, 'style_guide'); |
163 expect(ruleConfig.name, 'unnecessary_getters'); | 189 expect(ruleConfig.name, 'unnecessary_getters'); |
164 expect(ruleConfig.args, {'enabled': false}); | 190 expect(ruleConfig.args, {'enabled': false}); |
165 }); | 191 }); |
166 }); | 192 }); |
167 }); | 193 }); |
168 } | 194 } |
169 | 195 |
170 class MockProcessResult extends Mock implements ProcessResult {} | 196 class MockProcessResult extends Mock implements ProcessResult {} |
OLD | NEW |