| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 AnalysisResult ar = allResults.firstWhere((r) => r.path == a); | 443 AnalysisResult ar = allResults.firstWhere((r) => r.path == a); |
| 444 expect(_getTopLevelVarType(ar.unit, 'A'), 'int'); | 444 expect(_getTopLevelVarType(ar.unit, 'A'), 'int'); |
| 445 } | 445 } |
| 446 allResults.clear(); | 446 allResults.clear(); |
| 447 | 447 |
| 448 // Change "b" and notify. | 448 // Change "b" and notify. |
| 449 provider.updateFile(b, 'var B = 1.2;'); | 449 provider.updateFile(b, 'var B = 1.2;'); |
| 450 driver.changeFile(b); | 450 driver.changeFile(b); |
| 451 | 451 |
| 452 // "b" is not an added file, so it is not scheduled for analysis. | 452 // "b" is not an added file, so it is not scheduled for analysis. |
| 453 expect(driver.test.filesToAnalyze, isEmpty); | 453 expect(driver.test.fileTracker.hasPendingFiles, isFalse); |
| 454 | 454 |
| 455 // While "b" is not analyzed explicitly, it is analyzed implicitly. | 455 // While "b" is not analyzed explicitly, it is analyzed implicitly. |
| 456 // The change causes "a" to be reanalyzed. | 456 // The change causes "a" to be reanalyzed. |
| 457 await scheduler.waitForIdle(); | 457 await scheduler.waitForIdle(); |
| 458 expect(allResults, hasLength(1)); | 458 expect(allResults, hasLength(1)); |
| 459 { | 459 { |
| 460 AnalysisResult ar = allResults.firstWhere((r) => r.path == a); | 460 AnalysisResult ar = allResults.firstWhere((r) => r.path == a); |
| 461 expect(_getTopLevelVarType(ar.unit, 'A'), 'double'); | 461 expect(_getTopLevelVarType(ar.unit, 'A'), 'double'); |
| 462 } | 462 } |
| 463 } | 463 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 provider.updateFile(testFile, 'var V = 1.2'); | 561 provider.updateFile(testFile, 'var V = 1.2'); |
| 562 | 562 |
| 563 // No new results. | 563 // No new results. |
| 564 await pumpEventQueue(); | 564 await pumpEventQueue(); |
| 565 expect(allResults, isEmpty); | 565 expect(allResults, isEmpty); |
| 566 | 566 |
| 567 // Notify the driver about the change. | 567 // Notify the driver about the change. |
| 568 driver.changeFile(testFile); | 568 driver.changeFile(testFile); |
| 569 | 569 |
| 570 // The file was added, so it is scheduled for analysis. | 570 // The file was added, so it is scheduled for analysis. |
| 571 expect(driver.test.filesToAnalyze, contains(testFile)); | 571 expect(driver.test.fileTracker.isFilePending(testFile), isTrue); |
| 572 | 572 |
| 573 // We get a new result. | 573 // We get a new result. |
| 574 { | 574 { |
| 575 await scheduler.waitForIdle(); | 575 await scheduler.waitForIdle(); |
| 576 expect(allResults, hasLength(1)); | 576 expect(allResults, hasLength(1)); |
| 577 AnalysisResult result = allResults[0]; | 577 AnalysisResult result = allResults[0]; |
| 578 expect(result.path, testFile); | 578 expect(result.path, testFile); |
| 579 expect(_getTopLevelVarType(result.unit, 'V'), 'double'); | 579 expect(_getTopLevelVarType(result.unit, 'V'), 'double'); |
| 580 } | 580 } |
| 581 } | 581 } |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2051 * Return the [provider] specific path for the given Posix [path]. | 2051 * Return the [provider] specific path for the given Posix [path]. |
| 2052 */ | 2052 */ |
| 2053 String _p(String path) => provider.convertPath(path); | 2053 String _p(String path) => provider.convertPath(path); |
| 2054 | 2054 |
| 2055 static String _md5(String content) { | 2055 static String _md5(String content) { |
| 2056 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2056 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 2057 } | 2057 } |
| 2058 } | 2058 } |
| 2059 | 2059 |
| 2060 class _SourceMock extends TypedMock implements Source {} | 2060 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |