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 analyzer_cli.test.driver; | 5 library analyzer_cli.test.driver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 test('extra part file', () async { | 111 test('extra part file', () async { |
112 Driver driver = new Driver(); | 112 Driver driver = new Driver(); |
113 await driver.start([ | 113 await driver.start([ |
114 path.join(testDirectory, 'data/library_and_parts/lib.dart'), | 114 path.join(testDirectory, 'data/library_and_parts/lib.dart'), |
115 path.join(testDirectory, 'data/library_and_parts/part1.dart'), | 115 path.join(testDirectory, 'data/library_and_parts/part1.dart'), |
116 path.join(testDirectory, 'data/library_and_parts/part2.dart') | 116 path.join(testDirectory, 'data/library_and_parts/part2.dart') |
117 ]); | 117 ]); |
118 expect(exitCode, 3); | 118 expect(exitCode, 3); |
119 }); | 119 }); |
| 120 |
| 121 test('bazel workspace relative path', () async { |
| 122 // Copy to temp dir so that existing analysis options |
| 123 // in the test directory hierarchy do not interfere |
| 124 await withTempDirAsync((String tempDirPath) async { |
| 125 await recursiveCopy( |
| 126 new Directory(path.join(testDirectory, 'data', 'bazel')), |
| 127 tempDirPath); |
| 128 Directory origWorkingDir = Directory.current; |
| 129 try { |
| 130 Directory.current = path.join(tempDirPath, 'proj'); |
| 131 Driver driver = new Driver(); |
| 132 await driver.start([path.join('lib', 'file.dart')]); |
| 133 expect(errorSink.toString(), isEmpty); |
| 134 expect(outSink.toString(), contains('No issues found')); |
| 135 expect(exitCode, 0); |
| 136 } finally { |
| 137 Directory.current = origWorkingDir; |
| 138 } |
| 139 }); |
| 140 }); |
120 }); | 141 }); |
121 | 142 |
122 group('linter', () { | 143 group('linter', () { |
123 void createTests(String designator, String optionsFileName) { | 144 void createTests(String designator, String optionsFileName) { |
124 group('lints in options - $designator', () { | 145 group('lints in options - $designator', () { |
125 // Shared lint command. | 146 // Shared lint command. |
126 Future<Null> runLinter() async { | 147 Future<Null> runLinter() async { |
127 return await drive('data/linter_project/test_file.dart', | 148 return await drive('data/linter_project/test_file.dart', |
128 options: 'data/linter_project/$optionsFileName', | 149 options: 'data/linter_project/$optionsFileName', |
129 args: ['--lints']); | 150 args: ['--lints']); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 548 |
528 ErrorProcessor processorFor(AnalysisError error) => | 549 ErrorProcessor processorFor(AnalysisError error) => |
529 processors.firstWhere((p) => p.appliesTo(error)); | 550 processors.firstWhere((p) => p.appliesTo(error)); |
530 | 551 |
531 class TestSource implements Source { | 552 class TestSource implements Source { |
532 TestSource(); | 553 TestSource(); |
533 | 554 |
534 @override | 555 @override |
535 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 556 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
536 } | 557 } |
OLD | NEW |