| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.driver; | 5 library analyzer.test.driver; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2206 expect(allResults, hasLength(1)); | 2206 expect(allResults, hasLength(1)); |
| 2207 AnalysisResult result = allResults.single; | 2207 AnalysisResult result = allResults.single; |
| 2208 expect(result.path, testFile); | 2208 expect(result.path, testFile); |
| 2209 expect(result.uri.toString(), 'package:test/test.dart'); | 2209 expect(result.uri.toString(), 'package:test/test.dart'); |
| 2210 expect(result.content, isNull); | 2210 expect(result.content, isNull); |
| 2211 expect(result.contentHash, _md5(content)); | 2211 expect(result.contentHash, _md5(content)); |
| 2212 expect(result.unit, isNull); | 2212 expect(result.unit, isNull); |
| 2213 expect(result.errors, hasLength(0)); | 2213 expect(result.errors, hasLength(0)); |
| 2214 } | 2214 } |
| 2215 | 2215 |
| 2216 test_results_skipNotAffected() async { |
| 2217 var a = _p('/test/lib/a.dart'); |
| 2218 var b = _p('/test/lib/b.dart'); |
| 2219 provider.newFile(a, 'class A {}'); |
| 2220 provider.newFile(b, 'class B {}'); |
| 2221 |
| 2222 driver.addFile(a); |
| 2223 driver.addFile(b); |
| 2224 await scheduler.waitForIdle(); |
| 2225 |
| 2226 expect(allResults, hasLength(2)); |
| 2227 allResults.clear(); |
| 2228 |
| 2229 // Update a.dart and notify. |
| 2230 provider.updateFile(a, 'class A2 {}'); |
| 2231 driver.changeFile(a); |
| 2232 |
| 2233 // Only result for a.dart should be produced, b.dart is not affected. |
| 2234 await scheduler.waitForIdle(); |
| 2235 expect(allResults, hasLength(1)); |
| 2236 } |
| 2237 |
| 2216 test_results_status() async { | 2238 test_results_status() async { |
| 2217 addTestFile('int f() => 42;'); | 2239 addTestFile('int f() => 42;'); |
| 2218 await scheduler.waitForIdle(); | 2240 await scheduler.waitForIdle(); |
| 2219 | 2241 |
| 2220 expect(allStatuses, hasLength(2)); | 2242 expect(allStatuses, hasLength(2)); |
| 2221 expect(allStatuses[0].isAnalyzing, isTrue); | 2243 expect(allStatuses[0].isAnalyzing, isTrue); |
| 2222 expect(allStatuses[0].isIdle, isFalse); | 2244 expect(allStatuses[0].isIdle, isFalse); |
| 2223 expect(allStatuses[1].isAnalyzing, isFalse); | 2245 expect(allStatuses[1].isAnalyzing, isFalse); |
| 2224 expect(allStatuses[1].isIdle, isTrue); | 2246 expect(allStatuses[1].isIdle, isTrue); |
| 2225 } | 2247 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 * Return the [provider] specific path for the given Posix [path]. | 2378 * Return the [provider] specific path for the given Posix [path]. |
| 2357 */ | 2379 */ |
| 2358 String _p(String path) => provider.convertPath(path); | 2380 String _p(String path) => provider.convertPath(path); |
| 2359 | 2381 |
| 2360 static String _md5(String content) { | 2382 static String _md5(String content) { |
| 2361 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2383 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 2362 } | 2384 } |
| 2363 } | 2385 } |
| 2364 | 2386 |
| 2365 class _SourceMock extends TypedMock implements Source {} | 2387 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |