| 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.resource; | 5 library test.resource; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/resource.dart'; | 9 import 'package:analysis_server/src/resource.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; | 10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 test('parent', () { | 323 test('parent', () { |
| 324 Resource parent1 = folder.parent; | 324 Resource parent1 = folder.parent; |
| 325 expect(parent1, new isInstanceOf<Folder>()); | 325 expect(parent1, new isInstanceOf<Folder>()); |
| 326 expect(parent1.path, equals('/foo')); | 326 expect(parent1.path, equals('/foo')); |
| 327 Resource parent2 = parent1.parent; | 327 Resource parent2 = parent1.parent; |
| 328 expect(parent2, new isInstanceOf<Folder>()); | 328 expect(parent2, new isInstanceOf<Folder>()); |
| 329 expect(parent2.path, equals('/')); | 329 expect(parent2.path, equals('/')); |
| 330 expect(parent2.parent, isNull); | 330 expect(parent2.parent, isNull); |
| 331 }); | 331 }); |
| 332 |
| 333 test('canonicalizePath', () { |
| 334 expect(folder.canonicalizePath('baz'), equals('/foo/bar/baz')); |
| 335 expect(folder.canonicalizePath('/baz'), equals('/baz')); |
| 336 expect(folder.canonicalizePath('../baz'), equals('/foo/baz')); |
| 337 expect(folder.canonicalizePath('/a/b/../c'), equals('/a/c')); |
| 338 expect(folder.canonicalizePath('./baz'), equals('/foo/bar/baz')); |
| 339 expect(folder.canonicalizePath('/a/b/./c'), equals('/a/b/c')); |
| 340 }); |
| 332 }); | 341 }); |
| 333 | 342 |
| 334 group('_MemoryFileSource', () { | 343 group('_MemoryFileSource', () { |
| 335 Source source; | 344 Source source; |
| 336 | 345 |
| 337 group('existent', () { | 346 group('existent', () { |
| 338 setUp(() { | 347 setUp(() { |
| 339 File file = provider.newFile('/foo/test.dart', 'library test;'); | 348 File file = provider.newFile('/foo/test.dart', 'library test;'); |
| 340 source = file.createSource(UriKind.FILE_URI); | 349 source = file.createSource(UriKind.FILE_URI); |
| 341 }); | 350 }); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 expect(source, isNull); | 495 expect(source, isNull); |
| 487 }); | 496 }); |
| 488 | 497 |
| 489 test('not a file URI', () { | 498 test('not a file URI', () { |
| 490 var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart'); | 499 var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart'); |
| 491 Source source = resolver.resolveAbsolute(uri); | 500 Source source = resolver.resolveAbsolute(uri); |
| 492 expect(source, isNull); | 501 expect(source, isNull); |
| 493 }); | 502 }); |
| 494 }); | 503 }); |
| 495 } | 504 } |
| OLD | NEW |