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

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

Issue 59593002: Fix test failures on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/file_uri_test.dart ('k') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 void testFromUri() { 10 void testFromUri() {
11 asyncStart(); 11 asyncStart();
12 Directory originalWorkingDirectory = Directory.current;
12 Directory.systemTemp.createTemp('dart_file').then((temp) { 13 Directory.systemTemp.createTemp('dart_file').then((temp) {
13 File target = new File(temp.path + '/target'); 14 File target = new File(temp.path + '/target');
14 target.createSync(); 15 target.createSync();
15 16
16 String linkname = temp.path + '/from_uri'; 17 String linkname = temp.path + '/from_uri';
17 Uri linkUri = new Uri.file(linkname); 18 Uri linkUri = new Uri.file(linkname);
18 Link link = new Link.fromUri(linkUri); 19 Link link = new Link.fromUri(linkUri);
19 Expect.isTrue(linkUri.isAbsolute); 20 Expect.isTrue(linkUri.isAbsolute);
20 Expect.isTrue(linkUri.path.startsWith('/')); 21 Expect.isTrue(linkUri.path.startsWith('/'));
21 link.createSync(target.path); 22 link.createSync(target.path);
22 Expect.isTrue(new Link.fromUri(linkUri).existsSync()); 23 Expect.isTrue(new Link.fromUri(linkUri).existsSync());
23 Expect.isTrue(new Link.fromUri(Uri.base.resolveUri(linkUri)).existsSync()); 24 Expect.isTrue(new Link.fromUri(Uri.base.resolveUri(linkUri)).existsSync());
24 Directory.current = temp.path; 25 Directory.current = temp.path;
25 Expect.isTrue(new Link.fromUri(Uri.parse('from_uri')).existsSync()); 26 Expect.isTrue(new Link.fromUri(Uri.parse('from_uri')).existsSync());
26 Expect.isTrue(new Link.fromUri(Uri.base.resolve('from_uri')).existsSync()); 27 Expect.isTrue(new Link.fromUri(Uri.base.resolve('from_uri')).existsSync());
28 Directory.current = originalWorkingDirectory;
27 link.deleteSync(); 29 link.deleteSync();
28 target.deleteSync(); 30 target.deleteSync();
29 temp.deleteSync(); 31 temp.deleteSync();
30 asyncEnd(); 32 asyncEnd();
31 }); 33 });
32 } 34 }
33 35
34 void testFromUriUnsupported() { 36 void testFromUriUnsupported() {
35 Expect.throws( 37 Expect.throws(
36 () => new Link.fromUri(Uri.parse('http://localhost:8080/index.html')), 38 () => new Link.fromUri(Uri.parse('http://localhost:8080/index.html')),
37 (e) => e is UnsupportedError); 39 (e) => e is UnsupportedError);
38 Expect.throws(() => new Link.fromUri(Uri.parse('ftp://localhost/tmp/xxx')), 40 Expect.throws(() => new Link.fromUri(Uri.parse('ftp://localhost/tmp/xxx')),
39 (e) => e is UnsupportedError); 41 (e) => e is UnsupportedError);
40 Expect.throws(() => new Link.fromUri(Uri.parse('name#fragment')), 42 Expect.throws(() => new Link.fromUri(Uri.parse('name#fragment')),
41 (e) => e is UnsupportedError); 43 (e) => e is UnsupportedError);
42 } 44 }
43 45
44 void main() { 46 void main() {
45 testFromUri(); 47 testFromUri();
46 testFromUriUnsupported(); 48 testFromUriUnsupported();
47 } 49 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_uri_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698