| 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 | 8 |
| 9 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; | 9 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 }); | 253 }); |
| 254 | 254 |
| 255 test('hashCode', () { | 255 test('hashCode', () { |
| 256 String path = '/foo/bar/file.txt'; | 256 String path = '/foo/bar/file.txt'; |
| 257 File file1 = provider.getResource(path); | 257 File file1 = provider.getResource(path); |
| 258 provider.newFile(path, 'contents'); | 258 provider.newFile(path, 'contents'); |
| 259 File file2 = provider.getResource(path); | 259 File file2 = provider.getResource(path); |
| 260 expect(file1.hashCode, equals(file2.hashCode)); | 260 expect(file1.hashCode, equals(file2.hashCode)); |
| 261 }); | 261 }); |
| 262 | 262 |
| 263 test('isOrContains', () { |
| 264 String path = '/foo/bar/file.txt'; |
| 265 File file = provider.getResource(path); |
| 266 expect(file.isOrContains(path), isTrue); |
| 267 expect(file.isOrContains('/foo/bar'), isFalse); |
| 268 }); |
| 269 |
| 263 test('shortName', () { | 270 test('shortName', () { |
| 264 File file = provider.getResource('/foo/bar/file.txt'); | 271 File file = provider.getResource('/foo/bar/file.txt'); |
| 265 expect(file.shortName, 'file.txt'); | 272 expect(file.shortName, 'file.txt'); |
| 266 }); | 273 }); |
| 267 | 274 |
| 268 test('toString', () { | 275 test('toString', () { |
| 269 File file = provider.getResource('/foo/bar/file.txt'); | 276 File file = provider.getResource('/foo/bar/file.txt'); |
| 270 expect(file.toString(), '/foo/bar/file.txt'); | 277 expect(file.toString(), '/foo/bar/file.txt'); |
| 271 }); | 278 }); |
| 272 | 279 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 303 expect(folder == folder2, isFalse); | 310 expect(folder == folder2, isFalse); |
| 304 }); | 311 }); |
| 305 | 312 |
| 306 test('contains', () { | 313 test('contains', () { |
| 307 expect(folder.contains('/foo/bar/aaa.txt'), isTrue); | 314 expect(folder.contains('/foo/bar/aaa.txt'), isTrue); |
| 308 expect(folder.contains('/foo/bar/aaa/bbb.txt'), isTrue); | 315 expect(folder.contains('/foo/bar/aaa/bbb.txt'), isTrue); |
| 309 expect(folder.contains('/baz.txt'), isFalse); | 316 expect(folder.contains('/baz.txt'), isFalse); |
| 310 expect(folder.contains('/foo/bar'), isFalse); | 317 expect(folder.contains('/foo/bar'), isFalse); |
| 311 }); | 318 }); |
| 312 | 319 |
| 320 test('isOrContains', () { |
| 321 expect(folder.isOrContains('/foo/bar'), isTrue); |
| 322 expect(folder.isOrContains('/foo/bar/aaa.txt'), isTrue); |
| 323 expect(folder.isOrContains('/foo/bar/aaa/bbb.txt'), isTrue); |
| 324 expect(folder.isOrContains('/baz.txt'), isFalse); |
| 325 }); |
| 326 |
| 313 group('getChild', () { | 327 group('getChild', () { |
| 314 test('does not exist', () { | 328 test('does not exist', () { |
| 315 File file = folder.getChild('file.txt'); | 329 File file = folder.getChild('file.txt'); |
| 316 expect(file, isNotNull); | 330 expect(file, isNotNull); |
| 317 expect(file.exists, isFalse); | 331 expect(file.exists, isFalse); |
| 318 }); | 332 }); |
| 319 | 333 |
| 320 test('file', () { | 334 test('file', () { |
| 321 provider.newFile('/foo/bar/file.txt', 'content'); | 335 provider.newFile('/foo/bar/file.txt', 'content'); |
| 322 File child = folder.getChild('file.txt'); | 336 File child = folder.getChild('file.txt'); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 }); | 490 }); |
| 477 | 491 |
| 478 test('resolveRelative', () { | 492 test('resolveRelative', () { |
| 479 Uri relative = source.resolveRelativeUri(new Uri.file('bar/baz.dart'))
; | 493 Uri relative = source.resolveRelativeUri(new Uri.file('bar/baz.dart'))
; |
| 480 expect(relative.path, '/foo/bar/baz.dart'); | 494 expect(relative.path, '/foo/bar/baz.dart'); |
| 481 }); | 495 }); |
| 482 }); | 496 }); |
| 483 }); | 497 }); |
| 484 }); | 498 }); |
| 485 } | 499 } |
| OLD | NEW |