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 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 test_getResult_nameConflict_local() async { | 1421 test_getResult_nameConflict_local() async { |
1422 String content = r''' | 1422 String content = r''' |
1423 foo([p = V]) {} | 1423 foo([p = V]) {} |
1424 V(); | 1424 V(); |
1425 var V; | 1425 var V; |
1426 '''; | 1426 '''; |
1427 addTestFile(content); | 1427 addTestFile(content); |
1428 await driver.getResult(testFile); | 1428 await driver.getResult(testFile); |
1429 } | 1429 } |
1430 | 1430 |
| 1431 test_getResult_nameConflict_local_typeInference() async { |
| 1432 String content = r''' |
| 1433 typedef F(); |
| 1434 var F; |
| 1435 F _ff() => null; |
| 1436 var f = _ff(); // the inference must fail |
| 1437 main() { |
| 1438 f(); |
| 1439 } |
| 1440 '''; |
| 1441 addTestFile(content); |
| 1442 await driver.getResult(testFile); |
| 1443 } |
| 1444 |
1431 test_getResult_notDartFile() async { | 1445 test_getResult_notDartFile() async { |
1432 var path = _p('/test/lib/test.txt'); | 1446 var path = _p('/test/lib/test.txt'); |
1433 provider.newFile(path, 'class A {}'); | 1447 provider.newFile(path, 'class A {}'); |
1434 | 1448 |
1435 AnalysisResult result = await driver.getResult(path); | 1449 AnalysisResult result = await driver.getResult(path); |
1436 expect(result, isNotNull); | 1450 expect(result, isNotNull); |
1437 expect(result.unit.element.types.map((e) => e.name), ['A']); | 1451 expect(result.unit.element.types.map((e) => e.name), ['A']); |
1438 } | 1452 } |
1439 | 1453 |
1440 test_getResult_recursiveFlatten() async { | 1454 test_getResult_recursiveFlatten() async { |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 var path = _p('/test.dart'); | 2705 var path = _p('/test.dart'); |
2692 expect(() { | 2706 expect(() { |
2693 driver.removeFile(path); | 2707 driver.removeFile(path); |
2694 }, throwsStateError); | 2708 }, throwsStateError); |
2695 } | 2709 } |
2696 | 2710 |
2697 String _p(String path) => provider.convertPath(path); | 2711 String _p(String path) => provider.convertPath(path); |
2698 } | 2712 } |
2699 | 2713 |
2700 class _SourceMock extends TypedMock implements Source {} | 2714 class _SourceMock extends TypedMock implements Source {} |
OLD | NEW |