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 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 expect(driver.knownFiles, contains(a)); | 929 expect(driver.knownFiles, contains(a)); |
930 expect(driver.knownFiles, contains(b)); | 930 expect(driver.knownFiles, contains(b)); |
931 | 931 |
932 driver.removeFile(a); | 932 driver.removeFile(a); |
933 | 933 |
934 // a.dart was removed, but we don't clean up the file state state yet. | 934 // a.dart was removed, but we don't clean up the file state state yet. |
935 expect(driver.knownFiles, contains(a)); | 935 expect(driver.knownFiles, contains(a)); |
936 expect(driver.knownFiles, contains(b)); | 936 expect(driver.knownFiles, contains(b)); |
937 } | 937 } |
938 | 938 |
| 939 test_knownFiles_beforeAnalysis() async { |
| 940 var a = _p('/test/lib/a.dart'); |
| 941 var b = _p('/test/lib/b.dart'); |
| 942 |
| 943 provider.newFile(a, ''); |
| 944 |
| 945 driver.addFile(a); |
| 946 expect(driver.knownFiles, contains(a)); |
| 947 expect(driver.knownFiles, isNot(contains(b))); |
| 948 |
| 949 // Remove 'a.dart'. |
| 950 // It has been no analysis yet, so 'a.dart' is not in the file state, only |
| 951 // in 'added' files. So, it disappears when removed. |
| 952 driver.removeFile(a); |
| 953 expect(driver.knownFiles, isNot(contains(a))); |
| 954 expect(driver.knownFiles, isNot(contains(b))); |
| 955 } |
| 956 |
939 test_parseFile_shouldRefresh() async { | 957 test_parseFile_shouldRefresh() async { |
940 var p = _p('/test/bin/a.dart'); | 958 var p = _p('/test/bin/a.dart'); |
941 | 959 |
942 provider.newFile(p, 'class A {}'); | 960 provider.newFile(p, 'class A {}'); |
943 driver.addFile(p); | 961 driver.addFile(p); |
944 | 962 |
945 // Get the result, so force the file reading. | 963 // Get the result, so force the file reading. |
946 await driver.getResult(p); | 964 await driver.getResult(p); |
947 | 965 |
948 // Update the file. | 966 // Update the file. |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 String _p(String path) => provider.convertPath(path); | 1449 String _p(String path) => provider.convertPath(path); |
1432 | 1450 |
1433 Future<Null> _waitForIdle() async { | 1451 Future<Null> _waitForIdle() async { |
1434 await idleStatusMonitor.signal; | 1452 await idleStatusMonitor.signal; |
1435 } | 1453 } |
1436 | 1454 |
1437 static String _md5(String content) { | 1455 static String _md5(String content) { |
1438 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 1456 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
1439 } | 1457 } |
1440 } | 1458 } |
OLD | NEW |