OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
9 import 'package:analyzer/dart/constant/value.dart'; | 9 import 'package:analyzer/dart/constant/value.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 3429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3440 class C {} | 3440 class C {} |
3441 class D extends p.C {} // Prevent "unused import" warning | 3441 class D extends p.C {} // Prevent "unused import" warning |
3442 '''); | 3442 '''); |
3443 expect(resynthesized.imports, hasLength(2)); | 3443 expect(resynthesized.imports, hasLength(2)); |
3444 expect(resynthesized.imports[0].importedLibrary.location, | 3444 expect(resynthesized.imports[0].importedLibrary.location, |
3445 resynthesized.location); | 3445 resynthesized.location); |
3446 expect(resynthesized.imports[1].importedLibrary.isDartCore, true); | 3446 expect(resynthesized.imports[1].importedLibrary.isDartCore, true); |
3447 } | 3447 } |
3448 | 3448 |
3449 test_import_short_absolute() { | 3449 test_import_short_absolute() { |
3450 if (resourceProvider.pathContext.separator == '\\') { | |
3451 // This test fails on Windows due to | |
3452 // https://github.com/dart-lang/path/issues/18 | |
3453 // TODO(paulberry): reenable once that bug is addressed. | |
3454 return; | |
3455 } | |
3456 testFile = '/my/project/bin/test.dart'; | 3450 testFile = '/my/project/bin/test.dart'; |
3457 addLibrarySource('/a.dart', 'class C {}'); | 3451 // Note: "/a.dart" resolves differently on Windows vs. Posix. |
| 3452 var destinationPath = |
| 3453 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart')); |
| 3454 addLibrarySource(destinationPath, 'class C {}'); |
3458 checkLibrary('import "/a.dart"; C c;'); | 3455 checkLibrary('import "/a.dart"; C c;'); |
3459 } | 3456 } |
3460 | 3457 |
3461 test_import_show() { | 3458 test_import_show() { |
3462 addLibrary('dart:async'); | 3459 addLibrary('dart:async'); |
3463 checkLibrary(''' | 3460 checkLibrary(''' |
3464 import "dart:async" show Future, Stream; | 3461 import "dart:async" show Future, Stream; |
3465 Future f; | 3462 Future f; |
3466 Stream s; | 3463 Stream s; |
3467 '''); | 3464 '''); |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4839 fail('Unexpectedly tried to get unlinked summary for $uri'); | 4836 fail('Unexpectedly tried to get unlinked summary for $uri'); |
4840 } | 4837 } |
4841 return serializedUnit; | 4838 return serializedUnit; |
4842 } | 4839 } |
4843 | 4840 |
4844 @override | 4841 @override |
4845 bool hasLibrarySummary(String uri) { | 4842 bool hasLibrarySummary(String uri) { |
4846 return true; | 4843 return true; |
4847 } | 4844 } |
4848 } | 4845 } |
OLD | NEW |