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

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

Issue 13896034: Add the ability to change the working directory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed tests Created 7 years, 7 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
« no previous file with comments | « sdk/lib/io/directory_impl.dart ('k') | tests/standalone/io/directory_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // Directory listing test.
6
7
8 import "dart:io";
9 import "dart:isolate";
10
11 import "package:expect/expect.dart";
12
13 testChangeDirectory() {
14 var port = new ReceivePort();
15 new Directory("").createTemp().then((temp) {
16 var initialCurrent = Directory.current;
17 Directory.current = temp;
18 var newCurrent = Directory.current;
19 new File("111").createSync();
20 var dir = new Directory(newCurrent.path + Platform.pathSeparator + "222");
21 dir.createSync();
22 Directory.current = dir;
23 new File("333").createSync();
24 Expect.isTrue(new File("333").existsSync());
25 Expect.isTrue(new File("../111").existsSync());
26 Directory.current = "..";
27 Expect.isTrue(new File("111").existsSync());
28 Expect.isTrue(new File("222/333").existsSync());
29 Directory.current = initialCurrent;
30 temp.deleteSync(recursive: true);
31 port.close();
32 });
33 }
34
35
36 testChangeDirectoryIllegalArguments() {
37 Expect.throws(() => Directory.current = 1, (e) => e is ArgumentError);
38 Expect.throws(() => Directory.current = 111111111111111111111111111111111111,
39 (e) => e is ArgumentError);
40 Expect.throws(() => Directory.current = true, (e) => e is ArgumentError);
41 Expect.throws(() => Directory.current = [], (e) => e is ArgumentError);
42 Expect.throws(() => Directory.current = new File("xxx"),
43 (e) => e is ArgumentError);
44 }
45
46
47 main() {
48 testChangeDirectory();
49 testChangeDirectoryIllegalArguments();
50 }
OLDNEW
« no previous file with comments | « sdk/lib/io/directory_impl.dart ('k') | tests/standalone/io/directory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698