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

Side by Side Diff: utils/tests/pub/path/path_windows_test.dart

Issue 11472045: Fix path tests on windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library path_test; 5 library path_test;
6 6
7 import 'dart:io' as io; 7 import 'dart:io' as io;
8 8
9 import '../../../../pkg/unittest/lib/unittest.dart'; 9 import '../../../../pkg/unittest/lib/unittest.dart';
10 import '../../../pub/path.dart' as path; 10 import '../../../pub/path.dart' as path;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 }); 219 });
220 220
221 group('from relative root', () { 221 group('from relative root', () {
222 var r = new path.Builder(style: path.Style.windows, root: r'foo\bar'); 222 var r = new path.Builder(style: path.Style.windows, root: r'foo\bar');
223 223
224 // These tests rely on the current working directory, so don't do the 224 // These tests rely on the current working directory, so don't do the
225 // right thing if you run them on the wrong platform. 225 // right thing if you run them on the wrong platform.
226 if (io.Platform.operatingSystem == 'windows') { 226 if (io.Platform.operatingSystem == 'windows') {
227 test('given absolute path', () { 227 test('given absolute path', () {
228 var b = new path.Builder(style: path.Style.windows); 228 var b = new path.Builder(style: path.Style.windows);
229 expect(r.relative(r'C:\'), b.join(b.relative(r'C:\'), r'..\..')); 229 // TODO(rnystrom): Use a path method here to get the root prefix
230 expect(r.relative(r'C:\a\b'), 230 // when one exists.
231 b.join(b.relative(r'C:\'), r'..\..\a\b')); 231 var drive = path.current.substring(0, 3);
232 expect(r.relative(drive), b.join(b.relative(drive), r'..\..'));
233 expect(r.relative(b.join(drive, r'a\b')),
234 b.join(b.relative(drive), r'..\..\a\b'));
235
236 // TODO(rnystrom): Test behavior when drive letters differ.
232 }); 237 });
233 } 238 }
234 239
235 test('given relative path', () { 240 test('given relative path', () {
236 // The path is considered relative to the root, so it basically just 241 // The path is considered relative to the root, so it basically just
237 // normalizes. 242 // normalizes.
238 expect(r.relative(''), '.'); 243 expect(r.relative(''), '.');
239 expect(r.relative('.'), '.'); 244 expect(r.relative('.'), '.');
240 expect(r.relative('..'), '..'); 245 expect(r.relative('..'), '..');
241 expect(r.relative('a'), 'a'); 246 expect(r.relative('a'), 'a');
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 expect(builder.withoutExtension(r'a\b.c.d'), r'a\b.c'); 291 expect(builder.withoutExtension(r'a\b.c.d'), r'a\b.c');
287 expect(builder.withoutExtension(r'a\'), r'a\'); 292 expect(builder.withoutExtension(r'a\'), r'a\');
288 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); 293 expect(builder.withoutExtension(r'a\b\'), r'a\b\');
289 expect(builder.withoutExtension(r'a\.'), r'a\.'); 294 expect(builder.withoutExtension(r'a\.'), r'a\.');
290 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); 295 expect(builder.withoutExtension(r'a\.b'), r'a\.b');
291 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); 296 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c');
292 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); 297 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c');
293 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); 298 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c');
294 }); 299 });
295 } 300 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698