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

Unified Diff: packages/path/test/windows_test.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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 | « packages/path/test/utils.dart ('k') | packages/plugin/._AUTHORS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/path/test/windows_test.dart
diff --git a/packages/path/test/windows_test.dart b/packages/path/test/windows_test.dart
index 69428378dc2a6496924f6f83f736e295661b5b27..717043d1fe75b5ba551ac8b38456cf30b9a335ed 100644
--- a/packages/path/test/windows_test.dart
+++ b/packages/path/test/windows_test.dart
@@ -4,7 +4,7 @@
library path.test.windows_test;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
import 'package:path/path.dart' as path;
import 'utils.dart';
@@ -13,7 +13,7 @@ main() {
var context =
new path.Context(style: path.Style.windows, current: r'C:\root\path');
- group('separator', () {
+ test('separator', () {
expect(context.separator, '\\');
});
@@ -537,6 +537,30 @@ main() {
expect(context.isWithin(r'baz', r'C:\root\path\bang\baz'), isFalse);
});
+ test('complex cases', () {
+ expect(context.isWithin(r'foo\.\bar', r'foo\bar\baz'), isTrue);
+ expect(context.isWithin(r'foo\\bar', r'foo\bar\baz'), isTrue);
+ expect(context.isWithin(r'foo\qux\..\bar', r'foo\bar\baz'), isTrue);
+ expect(context.isWithin(r'foo\bar', r'foo\bar\baz\..\..'), isFalse);
+ expect(context.isWithin(r'foo\bar', r'foo\bar\\\'), isFalse);
+ expect(context.isWithin(r'foo\.bar', r'foo\.bar\baz'), isTrue);
+ expect(context.isWithin(r'foo\.\bar', r'foo\.bar\baz'), isFalse);
+ expect(context.isWithin(r'foo\..bar', r'foo\..bar\baz'), isTrue);
+ expect(context.isWithin(r'foo\bar', r'foo\bar\baz\..'), isFalse);
+ expect(context.isWithin(r'foo\bar', r'foo\bar\baz\..\qux'), isTrue);
+ expect(context.isWithin(r'C:\', 'C:/foo'), isTrue);
+ expect(context.isWithin(r'C:\', r'D:\foo'), isFalse);
+ expect(context.isWithin(r'C:\', r'\\foo\bar'), isFalse);
+ });
+
+ test('with root-relative paths', () {
+ expect(context.isWithin(r'\foo', r'C:\foo\bar'), isTrue);
+ expect(context.isWithin(r'C:\foo', r'\foo\bar'), isTrue);
+ expect(context.isWithin(r'\root', r'foo\bar'), isTrue);
+ expect(context.isWithin(r'foo', r'\root\path\foo\bar'), isTrue);
+ expect(context.isWithin(r'\foo', r'\foo\bar'), isTrue);
+ });
+
test('from a relative root', () {
var r = new path.Context(style: path.Style.windows, current: r'foo\bar');
expect(r.isWithin('.', r'a\b\c'), isTrue);
« no previous file with comments | « packages/path/test/utils.dart ('k') | packages/plugin/._AUTHORS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698