| 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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 '''; | 1115 '''; |
| 1116 addTestFile(content); | 1116 addTestFile(content); |
| 1117 | 1117 |
| 1118 CompilationUnitElement unitElement = await driver.getUnitElement(testFile); | 1118 CompilationUnitElement unitElement = await driver.getUnitElement(testFile); |
| 1119 expect(unitElement, isNotNull); | 1119 expect(unitElement, isNotNull); |
| 1120 expect(unitElement.source.fullName, testFile); | 1120 expect(unitElement.source.fullName, testFile); |
| 1121 expect(unitElement.functions.map((c) => c.name), | 1121 expect(unitElement.functions.map((c) => c.name), |
| 1122 unorderedEquals(['foo', 'main'])); | 1122 unorderedEquals(['foo', 'main'])); |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 test_getUnitElement_notDart() async { |
| 1126 CompilationUnitElement unit = await driver.getUnitElement('foo.txt'); |
| 1127 expect(unit, isNull); |
| 1128 } |
| 1129 |
| 1125 test_hasFilesToAnalyze() async { | 1130 test_hasFilesToAnalyze() async { |
| 1126 // No files yet, nothing to analyze. | 1131 // No files yet, nothing to analyze. |
| 1127 expect(driver.hasFilesToAnalyze, isFalse); | 1132 expect(driver.hasFilesToAnalyze, isFalse); |
| 1128 | 1133 |
| 1129 // Add a new file, it should be analyzed. | 1134 // Add a new file, it should be analyzed. |
| 1130 addTestFile('main() {}', priority: false); | 1135 addTestFile('main() {}', priority: false); |
| 1131 expect(driver.hasFilesToAnalyze, isTrue); | 1136 expect(driver.hasFilesToAnalyze, isTrue); |
| 1132 | 1137 |
| 1133 // Wait for idle, nothing to do. | 1138 // Wait for idle, nothing to do. |
| 1134 await _waitForIdle(); | 1139 await _waitForIdle(); |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 String _p(String path) => provider.convertPath(path); | 1799 String _p(String path) => provider.convertPath(path); |
| 1795 | 1800 |
| 1796 Future<Null> _waitForIdle() async { | 1801 Future<Null> _waitForIdle() async { |
| 1797 await idleStatusMonitor.signal; | 1802 await idleStatusMonitor.signal; |
| 1798 } | 1803 } |
| 1799 | 1804 |
| 1800 static String _md5(String content) { | 1805 static String _md5(String content) { |
| 1801 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 1806 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 1802 } | 1807 } |
| 1803 } | 1808 } |
| OLD | NEW |