Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2495)

Unified Diff: sdk/lib/_internal/pub_generated/test/io_test.dart

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub_generated/test/io_test.dart
diff --git a/sdk/lib/_internal/pub/test/io_test.dart b/sdk/lib/_internal/pub_generated/test/io_test.dart
similarity index 81%
copy from sdk/lib/_internal/pub/test/io_test.dart
copy to sdk/lib/_internal/pub_generated/test/io_test.dart
index cc5d2c4d6124e3e38e1e6be34f34b99c96df9b32..e7eb51be0e7df324a7b267b8e4afc189d481736c 100644
--- a/sdk/lib/_internal/pub/test/io_test.dart
+++ b/sdk/lib/_internal/pub_generated/test/io_test.dart
@@ -1,21 +1,12 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
library io_test;
-
import 'dart:async';
import 'dart:io';
-
import 'package:path/path.dart' as path;
import 'package:unittest/unittest.dart';
-
import '../lib/src/io.dart';
import 'test_pub.dart';
-
main() {
initConfig();
-
group('listDir', () {
test('ignores hidden files by default', () {
expect(withTempDir((temp) {
@@ -24,14 +15,11 @@ main() {
writeTextFile(path.join(temp, '.file3.txt'), '');
createDir(path.join(temp, '.subdir'));
writeTextFile(path.join(temp, '.subdir', 'file3.txt'), '');
-
- expect(listDir(temp, recursive: true), unorderedEquals([
- path.join(temp, 'file1.txt'),
- path.join(temp, 'file2.txt')
- ]));
+ expect(
+ listDir(temp, recursive: true),
+ unorderedEquals([path.join(temp, 'file1.txt'), path.join(temp, 'file2.txt')]));
}), completes);
});
-
test('includes hidden files when told to', () {
expect(withTempDir((temp) {
writeTextFile(path.join(temp, 'file1.txt'), '');
@@ -39,18 +27,17 @@ main() {
writeTextFile(path.join(temp, '.file3.txt'), '');
createDir(path.join(temp, '.subdir'));
writeTextFile(path.join(temp, '.subdir', 'file3.txt'), '');
-
- expect(listDir(temp, recursive: true, includeHidden: true),
- unorderedEquals([
- path.join(temp, 'file1.txt'),
- path.join(temp, 'file2.txt'),
- path.join(temp, '.file3.txt'),
- path.join(temp, '.subdir'),
- path.join(temp, '.subdir', 'file3.txt')
- ]));
+ expect(
+ listDir(temp, recursive: true, includeHidden: true),
+ unorderedEquals(
+ [
+ path.join(temp, 'file1.txt'),
+ path.join(temp, 'file2.txt'),
+ path.join(temp, '.file3.txt'),
+ path.join(temp, '.subdir'),
+ path.join(temp, '.subdir', 'file3.txt')]));
}), completes);
});
-
test("doesn't ignore hidden files above the directory being listed", () {
expect(withTempDir((temp) {
var dir = path.join(temp, '.foo', 'bar');
@@ -58,16 +45,16 @@ main() {
writeTextFile(path.join(dir, 'file1.txt'), '');
writeTextFile(path.join(dir, 'file2.txt'), '');
writeTextFile(path.join(dir, 'file3.txt'), '');
-
- expect(listDir(dir, recursive: true), unorderedEquals([
- path.join(dir, 'file1.txt'),
- path.join(dir, 'file2.txt'),
- path.join(dir, 'file3.txt')
- ]));
+ expect(
+ listDir(dir, recursive: true),
+ unorderedEquals(
+ [
+ path.join(dir, 'file1.txt'),
+ path.join(dir, 'file2.txt'),
+ path.join(dir, 'file3.txt')]));
}), completes);
});
});
-
group('canonicalize', () {
test('resolves a non-link', () {
expect(withCanonicalTempDir((temp) {
@@ -76,26 +63,22 @@ main() {
expect(canonicalize(filePath), equals(filePath));
}), completes);
});
-
test('resolves a non-existent file', () {
expect(withCanonicalTempDir((temp) {
- expect(canonicalize(path.join(temp, 'nothing')),
+ expect(
+ canonicalize(path.join(temp, 'nothing')),
equals(path.join(temp, 'nothing')));
}), completes);
});
-
test('resolves a symlink', () {
expect(withCanonicalTempDir((temp) {
createDir(path.join(temp, 'linked-dir'));
- createSymlink(
- path.join(temp, 'linked-dir'),
- path.join(temp, 'dir'));
+ createSymlink(path.join(temp, 'linked-dir'), path.join(temp, 'dir'));
expect(
canonicalize(path.join(temp, 'dir')),
equals(path.join(temp, 'linked-dir')));
}), completes);
});
-
test('resolves a relative symlink', () {
expect(withCanonicalTempDir((temp) {
createDir(path.join(temp, 'linked-dir'));
@@ -108,7 +91,6 @@ main() {
equals(path.join(temp, 'linked-dir')));
}), completes);
});
-
test('resolves a single-level horizontally recursive symlink', () {
expect(withCanonicalTempDir((temp) {
var linkPath = path.join(temp, 'foo');
@@ -116,7 +98,6 @@ main() {
expect(canonicalize(linkPath), equals(linkPath));
}), completes);
});
-
test('resolves a multi-level horizontally recursive symlink', () {
expect(withCanonicalTempDir((temp) {
var fooPath = path.join(temp, 'foo');
@@ -128,12 +109,10 @@ main() {
expect(canonicalize(fooPath), equals(fooPath));
expect(canonicalize(barPath), equals(barPath));
expect(canonicalize(bazPath), equals(bazPath));
-
createSymlink(fooPath, path.join(temp, 'outer'));
expect(canonicalize(path.join(temp, 'outer')), equals(fooPath));
}), completes);
});
-
test('resolves a broken symlink', () {
expect(withCanonicalTempDir((temp) {
createSymlink(path.join(temp, 'nonexistent'), path.join(temp, 'foo'));
@@ -142,7 +121,6 @@ main() {
equals(path.join(temp, 'nonexistent')));
}), completes);
});
-
test('resolves multiple nested symlinks', () {
expect(withCanonicalTempDir((temp) {
var dir1 = path.join(temp, 'dir1');
@@ -158,7 +136,6 @@ main() {
equals(path.join(subdir2, 'file')));
}), completes);
});
-
test('resolves a nested vertical symlink', () {
expect(withCanonicalTempDir((temp) {
var dir1 = path.join(temp, 'dir1');
@@ -172,7 +149,6 @@ main() {
equals(path.join(dir2, 'file')));
}), completes);
});
-
test('resolves a vertically recursive symlink', () {
expect(withCanonicalTempDir((temp) {
var dir = path.join(temp, 'dir');
@@ -180,13 +156,13 @@ main() {
createDir(dir);
createSymlink(dir, subdir);
expect(
- canonicalize(path.join(temp, 'dir', 'subdir', 'subdir', 'subdir',
- 'subdir', 'file')),
+ canonicalize(
+ path.join(temp, 'dir', 'subdir', 'subdir', 'subdir', 'subdir', 'file')),
equals(path.join(dir, 'file')));
}), completes);
});
-
- test('resolves a symlink that links to a path that needs more resolving',
+ test(
+ 'resolves a symlink that links to a path that needs more resolving',
() {
expect(withCanonicalTempDir((temp) {
var dir = path.join(temp, 'dir');
@@ -195,12 +171,9 @@ main() {
createDir(dir);
createSymlink(dir, linkdir);
createSymlink(path.join(linkdir, 'file'), linkfile);
- expect(
- canonicalize(linkfile),
- equals(path.join(dir, 'file')));
+ expect(canonicalize(linkfile), equals(path.join(dir, 'file')));
}), completes);
});
-
test('resolves a pair of pathologically-recursive symlinks', () {
expect(withCanonicalTempDir((temp) {
var foo = path.join(temp, 'foo');
@@ -215,8 +188,9 @@ main() {
}), completes);
});
});
-
- testExistencePredicate("entryExists", entryExists,
+ testExistencePredicate(
+ "entryExists",
+ entryExists,
forFile: true,
forFileSymlink: true,
forMultiLevelFileSymlink: true,
@@ -225,8 +199,9 @@ main() {
forMultiLevelDirectorySymlink: true,
forBrokenSymlink: true,
forMultiLevelBrokenSymlink: true);
-
- testExistencePredicate("linkExists", linkExists,
+ testExistencePredicate(
+ "linkExists",
+ linkExists,
forFile: false,
forFileSymlink: true,
forMultiLevelFileSymlink: true,
@@ -235,8 +210,9 @@ main() {
forMultiLevelDirectorySymlink: true,
forBrokenSymlink: true,
forMultiLevelBrokenSymlink: true);
-
- testExistencePredicate("fileExists", fileExists,
+ testExistencePredicate(
+ "fileExists",
+ fileExists,
forFile: true,
forFileSymlink: true,
forMultiLevelFileSymlink: true,
@@ -245,8 +221,9 @@ main() {
forMultiLevelDirectorySymlink: false,
forBrokenSymlink: false,
forMultiLevelBrokenSymlink: false);
-
- testExistencePredicate("dirExists", dirExists,
+ testExistencePredicate(
+ "dirExists",
+ dirExists,
forFile: false,
forFileSymlink: false,
forMultiLevelFileSymlink: false,
@@ -256,16 +233,10 @@ main() {
forBrokenSymlink: false,
forMultiLevelBrokenSymlink: false);
}
-
void testExistencePredicate(String name, bool predicate(String path),
- {bool forFile,
- bool forFileSymlink,
- bool forMultiLevelFileSymlink,
- bool forDirectory,
- bool forDirectorySymlink,
- bool forMultiLevelDirectorySymlink,
- bool forBrokenSymlink,
- bool forMultiLevelBrokenSymlink}) {
+ {bool forFile, bool forFileSymlink, bool forMultiLevelFileSymlink,
+ bool forDirectory, bool forDirectorySymlink, bool forMultiLevelDirectorySymlink,
+ bool forBrokenSymlink, bool forMultiLevelBrokenSymlink}) {
group(name, () {
test('returns $forFile for a file', () {
expect(withTempDir((temp) {
@@ -274,7 +245,6 @@ void testExistencePredicate(String name, bool predicate(String path),
expect(predicate(file), equals(forFile));
}), completes);
});
-
test('returns $forDirectory for a directory', () {
expect(withTempDir((temp) {
var file = path.join(temp, "dir");
@@ -282,7 +252,6 @@ void testExistencePredicate(String name, bool predicate(String path),
expect(predicate(file), equals(forDirectory));
}), completes);
});
-
test('returns $forDirectorySymlink for a symlink to a directory', () {
expect(withTempDir((temp) {
var targetPath = path.join(temp, "dir");
@@ -292,9 +261,10 @@ void testExistencePredicate(String name, bool predicate(String path),
expect(predicate(symlinkPath), equals(forDirectorySymlink));
}), completes);
});
-
- test('returns $forMultiLevelDirectorySymlink for a multi-level symlink to '
- 'a directory', () {
+ test(
+ 'returns $forMultiLevelDirectorySymlink for a multi-level symlink to '
+ 'a directory',
+ () {
expect(withTempDir((temp) {
var targetPath = path.join(temp, "dir");
var symlink1Path = path.join(temp, "link1dir");
@@ -302,11 +272,9 @@ void testExistencePredicate(String name, bool predicate(String path),
createDir(targetPath);
createSymlink(targetPath, symlink1Path);
createSymlink(symlink1Path, symlink2Path);
- expect(predicate(symlink2Path),
- equals(forMultiLevelDirectorySymlink));
+ expect(predicate(symlink2Path), equals(forMultiLevelDirectorySymlink));
}), completes);
});
-
test('returns $forBrokenSymlink for a broken symlink', () {
expect(withTempDir((temp) {
var targetPath = path.join(temp, "dir");
@@ -317,8 +285,8 @@ void testExistencePredicate(String name, bool predicate(String path),
expect(predicate(symlinkPath), equals(forBrokenSymlink));
}), completes);
});
-
- test('returns $forMultiLevelBrokenSymlink for a multi-level broken symlink',
+ test(
+ 'returns $forMultiLevelBrokenSymlink for a multi-level broken symlink',
() {
expect(withTempDir((temp) {
var targetPath = path.join(temp, "dir");
@@ -331,8 +299,6 @@ void testExistencePredicate(String name, bool predicate(String path),
expect(predicate(symlink2Path), equals(forMultiLevelBrokenSymlink));
}), completes);
});
-
- // Windows doesn't support symlinking to files.
if (Platform.operatingSystem != 'windows') {
test('returns $forFileSymlink for a symlink to a file', () {
expect(withTempDir((temp) {
@@ -343,9 +309,9 @@ void testExistencePredicate(String name, bool predicate(String path),
expect(predicate(symlinkPath), equals(forFileSymlink));
}), completes);
});
-
- test('returns $forMultiLevelFileSymlink for a multi-level symlink to a '
- 'file', () {
+ test(
+ 'returns $forMultiLevelFileSymlink for a multi-level symlink to a ' 'file',
+ () {
expect(withTempDir((temp) {
var targetPath = path.join(temp, "test.txt");
var symlink1Path = path.join(temp, "link1.txt");
@@ -359,7 +325,5 @@ void testExistencePredicate(String name, bool predicate(String path),
}
});
}
-
-/// Like [withTempDir], but canonicalizes the path before passing it to [fn].
Future withCanonicalTempDir(Future fn(String path)) =>
- withTempDir((temp) => fn(canonicalize(temp)));
+ withTempDir((temp) => fn(canonicalize(temp)));

Powered by Google App Engine
This is Rietveld 408576698