| 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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 expect(driver.hasFilesToAnalyze, isFalse); | 991 expect(driver.hasFilesToAnalyze, isFalse); |
| 992 | 992 |
| 993 // Ask to analyze the file, so there is a file to analyze. | 993 // Ask to analyze the file, so there is a file to analyze. |
| 994 Future<AnalysisResult> future = driver.getResult(testFile); | 994 Future<AnalysisResult> future = driver.getResult(testFile); |
| 995 expect(driver.hasFilesToAnalyze, isTrue); | 995 expect(driver.hasFilesToAnalyze, isTrue); |
| 996 | 996 |
| 997 // Once analysis is done, there is nothing to analyze. | 997 // Once analysis is done, there is nothing to analyze. |
| 998 await future; | 998 await future; |
| 999 expect(driver.hasFilesToAnalyze, isFalse); | 999 expect(driver.hasFilesToAnalyze, isFalse); |
| 1000 | 1000 |
| 1001 // Change a file, even if not added, it still might affect analysis. |
| 1002 driver.changeFile(_p('/not/added.dart')); |
| 1003 expect(driver.hasFilesToAnalyze, isTrue); |
| 1004 await _waitForIdle(); |
| 1005 expect(driver.hasFilesToAnalyze, isFalse); |
| 1006 |
| 1001 // Request of referenced names is not analysis of a file. | 1007 // Request of referenced names is not analysis of a file. |
| 1002 driver.getFilesReferencingName('X'); | 1008 driver.getFilesReferencingName('X'); |
| 1003 expect(driver.hasFilesToAnalyze, isFalse); | 1009 expect(driver.hasFilesToAnalyze, isFalse); |
| 1004 } | 1010 } |
| 1005 | 1011 |
| 1006 test_knownFiles() async { | 1012 test_knownFiles() async { |
| 1007 var a = _p('/test/lib/a.dart'); | 1013 var a = _p('/test/lib/a.dart'); |
| 1008 var b = _p('/test/lib/b.dart'); | 1014 var b = _p('/test/lib/b.dart'); |
| 1009 var c = _p('/test/lib/c.dart'); | 1015 var c = _p('/test/lib/c.dart'); |
| 1010 | 1016 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 String _p(String path) => provider.convertPath(path); | 1605 String _p(String path) => provider.convertPath(path); |
| 1600 | 1606 |
| 1601 Future<Null> _waitForIdle() async { | 1607 Future<Null> _waitForIdle() async { |
| 1602 await idleStatusMonitor.signal; | 1608 await idleStatusMonitor.signal; |
| 1603 } | 1609 } |
| 1604 | 1610 |
| 1605 static String _md5(String content) { | 1611 static String _md5(String content) { |
| 1606 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 1612 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 1607 } | 1613 } |
| 1608 } | 1614 } |
| OLD | NEW |