| 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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 // successfully imports file:///my_pkg/test/d.dart, causing y to have an | 998 // successfully imports file:///my_pkg/test/d.dart, causing y to have an |
| 999 // inferred type of String. | 999 // inferred type of String. |
| 1000 { | 1000 { |
| 1001 AnalysisResult result = await driver.getResult(b); | 1001 AnalysisResult result = await driver.getResult(b); |
| 1002 List<AnalysisError> errors = result.errors; | 1002 List<AnalysisError> errors = result.errors; |
| 1003 expect(errors, hasLength(1)); | 1003 expect(errors, hasLength(1)); |
| 1004 expect(errors[0].errorCode, StaticTypeWarningCode.INVALID_ASSIGNMENT); | 1004 expect(errors[0].errorCode, StaticTypeWarningCode.INVALID_ASSIGNMENT); |
| 1005 } | 1005 } |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 test_getResult_nameConflict_local() async { |
| 1009 String content = r''' |
| 1010 foo([p = V]) {} |
| 1011 V(); |
| 1012 var V; |
| 1013 '''; |
| 1014 addTestFile(content); |
| 1015 await driver.getResult(testFile); |
| 1016 } |
| 1017 |
| 1008 test_getResult_noErrors_ifNotAdded() async { | 1018 test_getResult_noErrors_ifNotAdded() async { |
| 1009 var a = _p('/test/lib/a.dart'); | 1019 var a = _p('/test/lib/a.dart'); |
| 1010 provider.newFile(a, 'A a = null;'); | 1020 provider.newFile(a, 'A a = null;'); |
| 1011 | 1021 |
| 1012 AnalysisResult result = await driver.getResult(a); | 1022 AnalysisResult result = await driver.getResult(a); |
| 1013 expect(result.errors, isEmpty); | 1023 expect(result.errors, isEmpty); |
| 1014 } | 1024 } |
| 1015 | 1025 |
| 1016 test_getResult_notDartFile() async { | 1026 test_getResult_notDartFile() async { |
| 1017 var path = _p('/test/lib/test.txt'); | 1027 var path = _p('/test/lib/test.txt'); |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2015 * Return the [provider] specific path for the given Posix [path]. | 2025 * Return the [provider] specific path for the given Posix [path]. |
| 2016 */ | 2026 */ |
| 2017 String _p(String path) => provider.convertPath(path); | 2027 String _p(String path) => provider.convertPath(path); |
| 2018 | 2028 |
| 2019 static String _md5(String content) { | 2029 static String _md5(String content) { |
| 2020 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2030 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 2021 } | 2031 } |
| 2022 } | 2032 } |
| 2023 | 2033 |
| 2024 class _SourceMock extends TypedMock implements Source {} | 2034 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |