| 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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 test_getResult_nameConflict_local() async { | 1310 test_getResult_nameConflict_local() async { |
| 1311 String content = r''' | 1311 String content = r''' |
| 1312 foo([p = V]) {} | 1312 foo([p = V]) {} |
| 1313 V(); | 1313 V(); |
| 1314 var V; | 1314 var V; |
| 1315 '''; | 1315 '''; |
| 1316 addTestFile(content); | 1316 addTestFile(content); |
| 1317 await driver.getResult(testFile); | 1317 await driver.getResult(testFile); |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 test_getResult_noErrors_ifNotAdded() async { | |
| 1321 var a = _p('/test/lib/a.dart'); | |
| 1322 provider.newFile(a, 'A a = null;'); | |
| 1323 | |
| 1324 AnalysisResult result = await driver.getResult(a); | |
| 1325 expect(result.errors, isEmpty); | |
| 1326 } | |
| 1327 | |
| 1328 test_getResult_notDartFile() async { | 1320 test_getResult_notDartFile() async { |
| 1329 var path = _p('/test/lib/test.txt'); | 1321 var path = _p('/test/lib/test.txt'); |
| 1330 provider.newFile(path, 'class A {}'); | 1322 provider.newFile(path, 'class A {}'); |
| 1331 | 1323 |
| 1332 AnalysisResult result = await driver.getResult(path); | 1324 AnalysisResult result = await driver.getResult(path); |
| 1333 expect(result, isNotNull); | 1325 expect(result, isNotNull); |
| 1334 expect(result.unit.element.types.map((e) => e.name), ['A']); | 1326 expect(result.unit.element.types.map((e) => e.name), ['A']); |
| 1335 } | 1327 } |
| 1336 | 1328 |
| 1337 test_getResult_sameFile_twoUris() async { | 1329 test_getResult_sameFile_twoUris() async { |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 * Return the [provider] specific path for the given Posix [path]. | 2370 * Return the [provider] specific path for the given Posix [path]. |
| 2379 */ | 2371 */ |
| 2380 String _p(String path) => provider.convertPath(path); | 2372 String _p(String path) => provider.convertPath(path); |
| 2381 | 2373 |
| 2382 static String _md5(String content) { | 2374 static String _md5(String content) { |
| 2383 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2375 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 2384 } | 2376 } |
| 2385 } | 2377 } |
| 2386 | 2378 |
| 2387 class _SourceMock extends TypedMock implements Source {} | 2379 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |