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

Side by Side Diff: tests/standalone/io/path_test.dart

Issue 10981026: Convert raw strings to new syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 months 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
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 // Test the Path class in dart:io. 5 // Test the Path class in dart:io.
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 8
9 void main() { 9 void main() {
10 testBaseFunctions(); 10 testBaseFunctions();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 testGetters(new Path("a/b.c/."), 49 testGetters(new Path("a/b.c/."),
50 ['a/b.c', '.', '.', ''], 50 ['a/b.c', '.', '.', ''],
51 ''); 51 '');
52 // '..' at the end of a path is not considered an extension. 52 // '..' at the end of a path is not considered an extension.
53 testGetters(new Path("a/bc/../.."), 53 testGetters(new Path("a/bc/../.."),
54 ['a/bc/..', '..', '..', ''], 54 ['a/bc/..', '..', '..', ''],
55 ''); 55 '');
56 56
57 // Test the special path cleaning operations on the Windows platform. 57 // Test the special path cleaning operations on the Windows platform.
58 if (Platform.operatingSystem == 'windows') { 58 if (Platform.operatingSystem == 'windows') {
59 testGetters(new Path.fromNative(@"c:\foo\bar\fisk.hest"), 59 testGetters(new Path.fromNative(r"c:\foo\bar\fisk.hest"),
60 ['/c:/foo/bar', 'fisk.hest', 'fisk', 'hest'], 60 ['/c:/foo/bar', 'fisk.hest', 'fisk', 'hest'],
61 'absolute canonical'); 61 'absolute canonical');
62 testGetters(new Path.fromNative("\\foo\\bar\\"), 62 testGetters(new Path.fromNative("\\foo\\bar\\"),
63 ['/foo/bar', '', '', ''], 63 ['/foo/bar', '', '', ''],
64 'absolute canonical trailing'); 64 'absolute canonical trailing');
65 testGetters(new Path.fromNative("\\foo\\bar\\hest"), 65 testGetters(new Path.fromNative("\\foo\\bar\\hest"),
66 ['/foo/bar', 'hest', 'hest', ''], 66 ['/foo/bar', 'hest', 'hest', ''],
67 'absolute canonical'); 67 'absolute canonical');
68 testGetters(new Path.fromNative(@"foo/bar\hest/.fisk"), 68 testGetters(new Path.fromNative(r"foo/bar\hest/.fisk"),
69 ['foo/bar/hest', '.fisk', '', 'fisk'], 69 ['foo/bar/hest', '.fisk', '', 'fisk'],
70 'canonical'); 70 'canonical');
71 testGetters(new Path.fromNative(@"foo//bar\\hest/\/.fisk."), 71 testGetters(new Path.fromNative(r"foo//bar\\hest/\/.fisk."),
72 ['foo//bar//hest', '.fisk.', '.fisk', ''], 72 ['foo//bar//hest', '.fisk.', '.fisk', ''],
73 ''); 73 '');
74 } else { 74 } else {
75 // Make sure that backslashes are uninterpreted on other platforms. 75 // Make sure that backslashes are uninterpreted on other platforms.
76 testGetters(new Path.fromNative(@"/foo\bar/bif/fisk.hest"), 76 testGetters(new Path.fromNative(r"/foo\bar/bif/fisk.hest"),
77 [@'/foo\bar/bif', 'fisk.hest', 'fisk', 'hest'], 77 [@'/foo\bar/bif', 'fisk.hest', 'fisk', 'hest'],
78 'absolute canonical'); 78 'absolute canonical');
79 testGetters(new Path.fromNative(@"//foo\bar///bif////fisk.hest"), 79 testGetters(new Path.fromNative(r"//foo\bar///bif////fisk.hest"),
80 [@'//foo\bar///bif', 'fisk.hest', 'fisk', 'hest'], 80 [@'//foo\bar///bif', 'fisk.hest', 'fisk', 'hest'],
81 'absolute'); 81 'absolute');
82 testGetters(new Path.fromNative(@"/foo\ bar/bif/gule\ fisk.hest"), 82 testGetters(new Path.fromNative(r"/foo\ bar/bif/gule\ fisk.hest"),
83 [@'/foo\ bar/bif', @'gule\ fisk.hest', @'gule\ fisk', 'hest'], 83 [@'/foo\ bar/bif', @'gule\ fisk.hest', @'gule\ fisk', 'hest'],
84 'absolute canonical'); 84 'absolute canonical');
85 } 85 }
86 } 86 }
87 87
88 88
89 void testGetters(Path path, List components, String properties) { 89 void testGetters(Path path, List components, String properties) {
90 final int DIRNAME = 0; 90 final int DIRNAME = 0;
91 final int FILENAME = 1; 91 final int FILENAME = 1;
92 final int FILENAME_NO_EXTENSION = 2; 92 final int FILENAME_NO_EXTENSION = 2;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 Expect.equals('.', 172 Expect.equals('.',
173 new Path('/a').relativeTo(new Path('/a')).toString()); 173 new Path('/a').relativeTo(new Path('/a')).toString());
174 174
175 // Not implemented yet. Should return new Path('../b/c/d/'). 175 // Not implemented yet. Should return new Path('../b/c/d/').
176 Expect.throws(() => 176 Expect.throws(() =>
177 new Path('b/c/d/').relativeTo(new Path('a/'))); 177 new Path('b/c/d/').relativeTo(new Path('a/')));
178 // Should always throw - no relative path can be constructed. 178 // Should always throw - no relative path can be constructed.
179 Expect.throws(() => 179 Expect.throws(() =>
180 new Path('a/b').relativeTo(new Path('../../d'))); 180 new Path('a/b').relativeTo(new Path('../../d')));
181 } 181 }
OLDNEW
« no previous file with comments | « tests/language/string_interpolate_test.dart ('k') | tests/standalone/status_expression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698