OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'dart:io'; | |
6 | |
7 import "package:async_helper/async_helper.dart"; | |
8 import "package:expect/expect.dart"; | |
9 | |
10 void testFromUri() { | |
11 asyncStart(); | |
12 Directory.systemTemp.createTemp('dart_file').then((temp) { | |
13 File target = new file(temp.path + '/target'); | |
14 target.createSync(); | |
15 | |
16 String linkname = temp.path + '/from_uri'; | |
17 Uri linkUri = new Uri.file(linkname); | |
18 File file = new File.fromUri(fileUri); | |
19 Expect.isTrue(fileUri.isAbsolute); | |
20 Expect.isTrue(fileUri.path.startsWith('/')); | |
21 link.createSync(target.path); | |
22 Expect.isTrue(new Link.fromUri(fileUri).existsSync()); | |
23 Expect.isTrue(new Link.fromUri(Uri.base.resolveUri(linkUri)).existsSync()); | |
24 Directory.current = temp.path; | |
25 Expect.isTrue(new Link.fromUri(Uri.parse('from_uri')).existsSync()); | |
26 Expect.isTrue(new Link.fromUri(Uri.base.resolve('from_uri')).existsSync()); | |
27 link.deleteSync(); | |
28 target.deleteSync(); | |
29 temp.deleteSync(); | |
30 asyncEnd(); | |
31 }); | |
32 } | |
33 | |
34 void testFromUriUnsupported() { | |
35 Expect.throws(() => new Link.fromUri(Uri.parse('http://localhost:8080/index.ht ml')), | |
Anders Johnsen
2013/11/05 08:30:56
Long line.
Søren Gjesse
2013/11/05 09:33:56
Done.
| |
36 (e) => e is UnsupportedOperation); | |
37 Expect.throws(() => new Link.fromUri(Uri.parse('ftp://localhost/tmp/xxx')), | |
38 (e) => e is UnsupportedOperation); | |
39 Expect.throws(() => new Link.fromUri(Uri.parse('name#fragment')), | |
40 (e) => e is UnsupportedOperation); | |
41 } | |
42 | |
43 void main() { | |
44 //testFromUri(); | |
Anders Johnsen
2013/11/05 08:30:56
Outcommented.
Søren Gjesse
2013/11/05 09:33:56
Done. Also fixed test which was broken.
| |
45 testFromUriUnsupported(); | |
46 } | |
OLD | NEW |