OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.memory_file_system; | 5 library test.memory_file_system; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
9 | 9 |
10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 void test_hashCode() { | 333 void test_hashCode() { |
334 source.hashCode; | 334 source.hashCode; |
335 } | 335 } |
336 | 336 |
337 void test_resolveRelative() { | 337 void test_resolveRelative() { |
338 Uri relative = source.resolveRelativeUri(new Uri.file('bar/baz.dart')); | 338 Uri relative = source.resolveRelativeUri(new Uri.file('bar/baz.dart')); |
339 expect(relative.path, '/foo/bar/baz.dart'); | 339 expect(relative.path, '/foo/bar/baz.dart'); |
340 } | 340 } |
341 | 341 |
| 342 void test_resolveRelative_dart() { |
| 343 File file = provider.newFile('/sdk/lib/core/core.dart', ''); |
| 344 Source source = file.createSource(Uri.parse('dart:core')); |
| 345 Uri resolved = source.resolveRelativeUri(Uri.parse('int.dart')); |
| 346 expect(resolved.toString(), 'dart:core/int.dart'); |
| 347 } |
| 348 |
342 void test_shortName() { | 349 void test_shortName() { |
343 expect(source.shortName, 'test.dart'); | 350 expect(source.shortName, 'test.dart'); |
344 } | 351 } |
345 } | 352 } |
346 | 353 |
347 @reflectiveTest | 354 @reflectiveTest |
348 class MemoryFileSourceNotExistingTest { | 355 class MemoryFileSourceNotExistingTest { |
349 MemoryResourceProvider provider = new MemoryResourceProvider(); | 356 MemoryResourceProvider provider = new MemoryResourceProvider(); |
350 Source source; | 357 Source source; |
351 | 358 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 return new Future.delayed(Duration.ZERO, computation); | 561 return new Future.delayed(Duration.ZERO, computation); |
555 } | 562 } |
556 | 563 |
557 _watchingFolder(String path, test(List<WatchEvent> changesReceived)) { | 564 _watchingFolder(String path, test(List<WatchEvent> changesReceived)) { |
558 Folder folder = provider.getResource(path); | 565 Folder folder = provider.getResource(path); |
559 var changesReceived = <WatchEvent>[]; | 566 var changesReceived = <WatchEvent>[]; |
560 folder.changes.listen(changesReceived.add); | 567 folder.changes.listen(changesReceived.add); |
561 return test(changesReceived); | 568 return test(changesReceived); |
562 } | 569 } |
563 } | 570 } |
OLD | NEW |