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

Unified Diff: pkg/path/test/relative_test.dart

Issue 62753005: Refactor pkg/path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 7 years, 1 month 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
« no previous file with comments | « pkg/path/test/posix_test.dart ('k') | pkg/path/test/url_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/path/test/relative_test.dart
diff --git a/pkg/path/test/relative_test.dart b/pkg/path/test/relative_test.dart
index e9762f47c542d37b41f71b448e527926f23a8040..58163d25bd40f3b9d4751069c1859bf882bbe22a 100644
--- a/pkg/path/test/relative_test.dart
+++ b/pkg/path/test/relative_test.dart
@@ -2,7 +2,7 @@
// 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.
//
-// Test "relative" on all styles of path.Builder, on all platforms.
+// Test "relative" on all styles of path.Context, on all platforms.
import "package:unittest/unittest.dart";
import "package:path/path.dart" as path;
@@ -11,27 +11,27 @@ import "utils.dart";
void main() {
test("test relative", () {
- relativeTest(new path.Builder(style: path.Style.posix, root: '.'), '/');
- relativeTest(new path.Builder(style: path.Style.posix, root: '/'), '/');
- relativeTest(new path.Builder(style: path.Style.windows, root: r'd:\'),
+ relativeTest(new path.Context(style: path.Style.posix, current: '.'), '/');
+ relativeTest(new path.Context(style: path.Style.posix, current: '/'), '/');
+ relativeTest(new path.Context(style: path.Style.windows, current: r'd:\'),
r'c:\');
- relativeTest(new path.Builder(style: path.Style.windows, root: '.'),
+ relativeTest(new path.Context(style: path.Style.windows, current: '.'),
r'c:\');
- relativeTest(new path.Builder(style: path.Style.url, root: 'file:///'),
+ relativeTest(new path.Context(style: path.Style.url, current: 'file:///'),
'http://myserver/');
- relativeTest(new path.Builder(style: path.Style.url, root: '.'),
+ relativeTest(new path.Context(style: path.Style.url, current: '.'),
'http://myserver/');
- relativeTest(new path.Builder(style: path.Style.url, root: 'file:///'),
+ relativeTest(new path.Context(style: path.Style.url, current: 'file:///'),
'/');
- relativeTest(new path.Builder(style: path.Style.url, root: '.'), '/');
+ relativeTest(new path.Context(style: path.Style.url, current: '.'), '/');
});
}
-void relativeTest(path.Builder builder, String prefix) {
- var isRelative = (builder.root == '.');
+void relativeTest(path.Context context, String prefix) {
+ var isRelative = (context.current == '.');
// Cases where the arguments are absolute paths.
expectRelative(result, pathArg, fromArg) {
- expect(builder.normalize(result), builder.relative(pathArg, from: fromArg));
+ expect(context.normalize(result), context.relative(pathArg, from: fromArg));
}
expectRelative('c/d', '${prefix}a/b/c/d', '${prefix}a/b');
@@ -77,10 +77,10 @@ void relativeTest(path.Builder builder, String prefix) {
// Should always throw - no relative path can be constructed.
if (isRelative) {
- expect(() => builder.relative('.', from: '..'), throwsPathException);
- expect(() => builder.relative('a/b', from: '../../d'),
+ expect(() => context.relative('.', from: '..'), throwsPathException);
+ expect(() => context.relative('a/b', from: '../../d'),
throwsPathException);
- expect(() => builder.relative('a/b', from: '${prefix}a/b'),
+ expect(() => context.relative('a/b', from: '${prefix}a/b'),
throwsPathException);
// An absolute path relative from a relative path returns the absolute path.
expectRelative('${prefix}a/b', '${prefix}a/b', 'c/d');
« no previous file with comments | « pkg/path/test/posix_test.dart ('k') | pkg/path/test/url_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698