| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 io_test; | 5 library io_test; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:pathos/path.dart' as path; | 9 import 'package:pathos/path.dart' as path; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 bool forFileSymlink, | 183 bool forFileSymlink, |
| 184 bool forMultiLevelFileSymlink, | 184 bool forMultiLevelFileSymlink, |
| 185 bool forDirectory, | 185 bool forDirectory, |
| 186 bool forDirectorySymlink, | 186 bool forDirectorySymlink, |
| 187 bool forMultiLevelDirectorySymlink, | 187 bool forMultiLevelDirectorySymlink, |
| 188 bool forBrokenSymlink, | 188 bool forBrokenSymlink, |
| 189 bool forMultiLevelBrokenSymlink}) { | 189 bool forMultiLevelBrokenSymlink}) { |
| 190 group(name, () { | 190 group(name, () { |
| 191 test('returns $forFile for a file', () { | 191 test('returns $forFile for a file', () { |
| 192 expect(withTempDir((temp) { | 192 expect(withTempDir((temp) { |
| 193 var path = path.join(temp, "test.txt"); | 193 var file = path.join(temp, "test.txt"); |
| 194 writeTextFile(path, "contents"); | 194 writeTextFile(file, "contents"); |
| 195 expect(predicate(path), equals(forFile)); | 195 expect(predicate(file), equals(forFile)); |
| 196 }), completes); | 196 }), completes); |
| 197 }); | 197 }); |
| 198 | 198 |
| 199 test('returns $forDirectory for a directory', () { | 199 test('returns $forDirectory for a directory', () { |
| 200 expect(withTempDir((temp) { | 200 expect(withTempDir((temp) { |
| 201 var path = path.join(temp, "dir"); | 201 var file = path.join(temp, "dir"); |
| 202 createDir(path); | 202 createDir(file); |
| 203 expect(predicate(path), equals(forDirectory)); | 203 expect(predicate(file), equals(forDirectory)); |
| 204 }), completes); | 204 }), completes); |
| 205 }); | 205 }); |
| 206 | 206 |
| 207 test('returns $forDirectorySymlink for a symlink to a directory', () { | 207 test('returns $forDirectorySymlink for a symlink to a directory', () { |
| 208 expect(withTempDir((temp) { | 208 expect(withTempDir((temp) { |
| 209 var targetPath = path.join(temp, "dir"); | 209 var targetPath = path.join(temp, "dir"); |
| 210 var symlinkPath = path.join(temp, "linkdir"); | 210 var symlinkPath = path.join(temp, "linkdir"); |
| 211 createDir(targetPath); | 211 createDir(targetPath); |
| 212 return createSymlink(targetPath, symlinkPath).then((_) { | 212 return createSymlink(targetPath, symlinkPath).then((_) { |
| 213 expect(predicate(symlinkPath), equals(forDirectorySymlink)); | 213 expect(predicate(symlinkPath), equals(forDirectorySymlink)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 return createSymlink(targetPath, symlink1Path) | 282 return createSymlink(targetPath, symlink1Path) |
| 283 .then((_) => createSymlink(symlink1Path, symlink2Path)) | 283 .then((_) => createSymlink(symlink1Path, symlink2Path)) |
| 284 .then((_) { | 284 .then((_) { |
| 285 expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink)); | 285 expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink)); |
| 286 }); | 286 }); |
| 287 }), completes); | 287 }), completes); |
| 288 }); | 288 }); |
| 289 } | 289 } |
| 290 }); | 290 }); |
| 291 } | 291 } |
| OLD | NEW |