-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add uri getter on file system entity.
BUG= http://dartbug.com/20362 Also: BUG= http://dartbug.com/19428 BUG= http://dartbug.com/17065 R=sgjesse@google.com Review URL: https://codereview.chromium.org//1083393004 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45226 260f80e4-7a28-3924-810f-c04153c831b5
- Loading branch information
Showing
7 changed files
with
78 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2015, 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. | ||
|
||
import "package:expect/expect.dart"; | ||
import "dart:io"; | ||
|
||
testFile(String input) { | ||
if (Platform.isWindows) { | ||
input = input.replaceAll('/', '\\'); | ||
} | ||
var file = new File(input); | ||
var uri = file.uri; | ||
var file2 = new File.fromUri(uri); | ||
Expect.equals(file.path, file2.path, input); | ||
} | ||
|
||
testDirectory(String input, [String output]) { | ||
if (output == null) output = input; | ||
if (Platform.isWindows) { | ||
input = input.replaceAll('/', '\\'); | ||
output = output.replaceAll('/', '\\'); | ||
} | ||
var dir = new Directory(input); | ||
var uri = dir.uri; | ||
var dir2 = new Directory.fromUri(uri); | ||
Expect.equals(output, dir2.path, input); | ||
} | ||
|
||
void main() { | ||
testFile(""); | ||
testFile("/"); | ||
testFile("foo/bar"); | ||
testFile("/foo/bar"); | ||
testFile("/foo/bar/"); | ||
|
||
testDirectory("", "/"); | ||
testDirectory("/"); | ||
testDirectory("foo/bar", "foo/bar/"); | ||
testDirectory("/foo/bar", "/foo/bar/"); | ||
testDirectory("/foo/bar/"); | ||
} |