| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 Future<AnalysisResult> future2 = driver.getResult(testFile); | 343 Future<AnalysisResult> future2 = driver.getResult(testFile); |
| 344 | 344 |
| 345 // Both futures complete, with the same result. | 345 // Both futures complete, with the same result. |
| 346 AnalysisResult result1 = await future1; | 346 AnalysisResult result1 = await future1; |
| 347 AnalysisResult result2 = await future2; | 347 AnalysisResult result2 = await future2; |
| 348 expect(result2, same(result1)); | 348 expect(result2, same(result1)); |
| 349 expect(result1.path, testFile); | 349 expect(result1.path, testFile); |
| 350 expect(result1.unit, isNotNull); | 350 expect(result1.unit, isNotNull); |
| 351 } | 351 } |
| 352 | 352 |
| 353 test_isAddedFile() async { |
| 354 var a = _p('/test/lib/a.dart'); |
| 355 var b = _p('/test/lib/b.dart'); |
| 356 |
| 357 driver.addFile(a); |
| 358 expect(driver.isAddedFile(a), isTrue); |
| 359 expect(driver.isAddedFile(b), isFalse); |
| 360 |
| 361 driver.removeFile(a); |
| 362 expect(driver.isAddedFile(a), isFalse); |
| 363 expect(driver.isAddedFile(b), isFalse); |
| 364 } |
| 365 |
| 353 test_removeFile_changeFile_implicitlyAnalyzed() async { | 366 test_removeFile_changeFile_implicitlyAnalyzed() async { |
| 354 var a = _p('/test/lib/a.dart'); | 367 var a = _p('/test/lib/a.dart'); |
| 355 var b = _p('/test/lib/b.dart'); | 368 var b = _p('/test/lib/b.dart'); |
| 356 provider.newFile( | 369 provider.newFile( |
| 357 a, | 370 a, |
| 358 r''' | 371 r''' |
| 359 import 'b.dart'; | 372 import 'b.dart'; |
| 360 var A = B; | 373 var A = B; |
| 361 '''); | 374 '''); |
| 362 provider.newFile(b, 'var B = 1;'); | 375 provider.newFile(b, 'var B = 1;'); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 @override | 554 @override |
| 542 List<int> get(String key) { | 555 List<int> get(String key) { |
| 543 return map[key]; | 556 return map[key]; |
| 544 } | 557 } |
| 545 | 558 |
| 546 @override | 559 @override |
| 547 void put(String key, List<int> bytes) { | 560 void put(String key, List<int> bytes) { |
| 548 map[key] = bytes; | 561 map[key] = bytes; |
| 549 } | 562 } |
| 550 } | 563 } |
| OLD | NEW |