| 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 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 | 1324 |
| 1325 test_getResult_notDartFile() async { | 1325 test_getResult_notDartFile() async { |
| 1326 var path = _p('/test/lib/test.txt'); | 1326 var path = _p('/test/lib/test.txt'); |
| 1327 provider.newFile(path, 'class A {}'); | 1327 provider.newFile(path, 'class A {}'); |
| 1328 | 1328 |
| 1329 AnalysisResult result = await driver.getResult(path); | 1329 AnalysisResult result = await driver.getResult(path); |
| 1330 expect(result, isNotNull); | 1330 expect(result, isNotNull); |
| 1331 expect(result.unit.element.types.map((e) => e.name), ['A']); | 1331 expect(result.unit.element.types.map((e) => e.name), ['A']); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 test_getResult_recursiveFlatten() async { |
| 1335 String content = r''' |
| 1336 import 'dart:async'; |
| 1337 class C<T> implements Future<C<T>> {} |
| 1338 '''; |
| 1339 addTestFile(content); |
| 1340 // Should not throw exceptions. |
| 1341 await driver.getResult(testFile); |
| 1342 } |
| 1343 |
| 1334 test_getResult_sameFile_twoUris() async { | 1344 test_getResult_sameFile_twoUris() async { |
| 1335 var a = _p('/test/lib/a.dart'); | 1345 var a = _p('/test/lib/a.dart'); |
| 1336 var b = _p('/test/lib/b.dart'); | 1346 var b = _p('/test/lib/b.dart'); |
| 1337 var c = _p('/test/test/c.dart'); | 1347 var c = _p('/test/test/c.dart'); |
| 1338 provider.newFile(a, 'class A<T> {}'); | 1348 provider.newFile(a, 'class A<T> {}'); |
| 1339 provider.newFile( | 1349 provider.newFile( |
| 1340 b, | 1350 b, |
| 1341 r''' | 1351 r''' |
| 1342 import 'a.dart'; | 1352 import 'a.dart'; |
| 1343 var VB = new A<int>(); | 1353 var VB = new A<int>(); |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 * Return the [provider] specific path for the given Posix [path]. | 2385 * Return the [provider] specific path for the given Posix [path]. |
| 2376 */ | 2386 */ |
| 2377 String _p(String path) => provider.convertPath(path); | 2387 String _p(String path) => provider.convertPath(path); |
| 2378 | 2388 |
| 2379 static String _md5(String content) { | 2389 static String _md5(String content) { |
| 2380 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2390 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 2381 } | 2391 } |
| 2382 } | 2392 } |
| 2383 | 2393 |
| 2384 class _SourceMock extends TypedMock implements Source {} | 2394 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |