| 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.physical_file_system; | 5 library test.physical_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| 11 import 'package:analyzer/file_system/physical_file_system.dart'; | 11 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 12 import 'package:analyzer/src/generated/source_io.dart'; | 12 import 'package:analyzer/src/generated/source_io.dart'; |
| 13 import 'package:path/path.dart'; | 13 import 'package:path/path.dart'; |
| 14 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
| 15 import 'package:watcher/watcher.dart'; | 15 import 'package:watcher/watcher.dart'; |
| 16 | 16 |
| 17 | 17 |
| 18 var _isFile = new isInstanceOf<File>(); | 18 var _isFile = new isInstanceOf<File>(); |
| 19 var _isFolder = new isInstanceOf<Folder>(); | 19 var _isFolder = new isInstanceOf<Folder>(); |
| 20 var _isFileSystemException = new isInstanceOf<FileSystemException>(); |
| 20 | 21 |
| 21 | 22 |
| 22 main() { | 23 main() { |
| 23 groupSep = ' | '; | 24 groupSep = ' | '; |
| 24 | 25 |
| 25 group('PhysicalResourceProvider', () { | 26 group('PhysicalResourceProvider', () { |
| 26 io.Directory tempDirectory; | 27 io.Directory tempDirectory; |
| 27 String tempPath; | 28 String tempPath; |
| 28 | 29 |
| 29 setUp(() { | 30 setUp(() { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 File file2 = PhysicalResourceProvider.INSTANCE.getResource(path2); | 193 File file2 = PhysicalResourceProvider.INSTANCE.getResource(path2); |
| 193 expect(file == file2, isFalse); | 194 expect(file == file2, isFalse); |
| 194 }); | 195 }); |
| 195 | 196 |
| 196 test('isOrContains', () { | 197 test('isOrContains', () { |
| 197 File file = PhysicalResourceProvider.INSTANCE.getResource(path); | 198 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
| 198 expect(file.isOrContains(path), isTrue); | 199 expect(file.isOrContains(path), isTrue); |
| 199 expect(file.isOrContains('foo'), isFalse); | 200 expect(file.isOrContains('foo'), isFalse); |
| 200 }); | 201 }); |
| 201 | 202 |
| 203 group('modificationStamp', () { |
| 204 test('exists', () { |
| 205 new io.File(path).writeAsStringSync('contents'); |
| 206 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
| 207 expect(file.modificationStamp, isNonNegative); |
| 208 }); |
| 209 |
| 210 test('does not exist', () { |
| 211 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
| 212 expect(() { |
| 213 file.modificationStamp; |
| 214 }, throwsA(_isFileSystemException)); |
| 215 }); |
| 216 }); |
| 217 |
| 202 test('shortName', () { | 218 test('shortName', () { |
| 203 expect(file.shortName, 'file.txt'); | 219 expect(file.shortName, 'file.txt'); |
| 204 }); | 220 }); |
| 205 | 221 |
| 206 test('toString', () { | 222 test('toString', () { |
| 207 expect(file.toString(), path); | 223 expect(file.toString(), path); |
| 208 }); | 224 }); |
| 209 | 225 |
| 210 test('parent', () { | 226 test('parent', () { |
| 211 Resource parent = file.parent; | 227 Resource parent = file.parent; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 expect( | 348 expect( |
| 333 folder.canonicalizePath(join('.', 'baz')), | 349 folder.canonicalizePath(join('.', 'baz')), |
| 334 equals(join(path, 'baz'))); | 350 equals(join(path, 'baz'))); |
| 335 expect( | 351 expect( |
| 336 folder.canonicalizePath(join(path2, '.', 'baz')), | 352 folder.canonicalizePath(join(path2, '.', 'baz')), |
| 337 equals(join(path2, 'baz'))); | 353 equals(join(path2, 'baz'))); |
| 338 }); | 354 }); |
| 339 }); | 355 }); |
| 340 }); | 356 }); |
| 341 } | 357 } |
| OLD | NEW |