Files
sdk/pkg/path/test/path_test.dart
T
nweiz@google.com bcdb64e20e Refactor pkg/path.
This CL does several things:

* Splits lib/path.dart into multiple libraries.

* Renames "Builder" to "Context".

* Makes the Context API match the top-level functions ("root" was
  renamed to "current" and "resolve" was renamed to "absolute").

* The top-level "absolute" function now takes multiple parts, to match
  [Context.absolute].

R=rnystrom@google.com
BUG=14981

Review URL: https://codereview.chromium.org//62753005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30423 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-19 20:48:45 +00:00

53 lines
1.5 KiB
Dart

// 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.
import 'package:unittest/unittest.dart';
import 'package:path/path.dart' as path;
main() {
group('path.Style', () {
test('name', () {
expect(path.Style.posix.name, 'posix');
expect(path.Style.windows.name, 'windows');
});
test('separator', () {
expect(path.Style.posix.separator, '/');
expect(path.Style.windows.separator, '\\');
});
test('toString()', () {
expect(path.Style.posix.toString(), 'posix');
expect(path.Style.windows.toString(), 'windows');
});
});
group('new Context()', () {
test('uses the given current directory', () {
var context = new path.Context(current: '/a/b/c');
expect(context.current, '/a/b/c');
});
test('uses the given style', () {
var context = new path.Context(style: path.Style.windows);
expect(context.style, path.Style.windows);
});
});
test('posix is a default Context for the POSIX style', () {
expect(path.posix.style, path.Style.posix);
expect(path.posix.current, ".");
});
test('windows is a default Context for the Windows style', () {
expect(path.windows.style, path.Style.windows);
expect(path.windows.current, ".");
});
test('url is a default Context for the URL style', () {
expect(path.url.style, path.Style.url);
expect(path.url.current, ".");
});
}