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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 expect(driver.knownFiles, contains(a)); | 986 expect(driver.knownFiles, contains(a)); |
987 expect(driver.knownFiles, contains(b)); | 987 expect(driver.knownFiles, contains(b)); |
988 } | 988 } |
989 | 989 |
990 test_knownFiles_beforeAnalysis() async { | 990 test_knownFiles_beforeAnalysis() async { |
991 var a = _p('/test/lib/a.dart'); | 991 var a = _p('/test/lib/a.dart'); |
992 var b = _p('/test/lib/b.dart'); | 992 var b = _p('/test/lib/b.dart'); |
993 | 993 |
994 provider.newFile(a, ''); | 994 provider.newFile(a, ''); |
995 | 995 |
| 996 // 'a.dart' is added, but not processed yet. |
| 997 // So, the set of known files is empty yet. |
996 driver.addFile(a); | 998 driver.addFile(a); |
997 expect(driver.knownFiles, contains(a)); | 999 expect(driver.knownFiles, isEmpty); |
998 expect(driver.knownFiles, isNot(contains(b))); | |
999 | 1000 |
1000 // Remove 'a.dart'. | 1001 // Remove 'a.dart'. |
1001 // It has been no analysis yet, so 'a.dart' is not in the file state, only | 1002 // It has been no analysis yet, so 'a.dart' is not in the file state, only |
1002 // in 'added' files. So, it disappears when removed. | 1003 // in 'added' files. So, it disappears when removed. |
1003 driver.removeFile(a); | 1004 driver.removeFile(a); |
1004 expect(driver.knownFiles, isNot(contains(a))); | 1005 expect(driver.knownFiles, isNot(contains(a))); |
1005 expect(driver.knownFiles, isNot(contains(b))); | 1006 expect(driver.knownFiles, isNot(contains(b))); |
1006 } | 1007 } |
1007 | 1008 |
1008 test_parseFile_shouldRefresh() async { | 1009 test_parseFile_shouldRefresh() async { |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 String _p(String path) => provider.convertPath(path); | 1501 String _p(String path) => provider.convertPath(path); |
1501 | 1502 |
1502 Future<Null> _waitForIdle() async { | 1503 Future<Null> _waitForIdle() async { |
1503 await idleStatusMonitor.signal; | 1504 await idleStatusMonitor.signal; |
1504 } | 1505 } |
1505 | 1506 |
1506 static String _md5(String content) { | 1507 static String _md5(String content) { |
1507 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 1508 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
1508 } | 1509 } |
1509 } | 1510 } |
OLD | NEW |