~jason2605/dictu/package

« back to all changes in this revision

Viewing changes to tests/system/setCWD.du

  • Committer: jasonhall96686 at gmail
  • Date: 2021-01-04 20:33:43 UTC
  • Revision ID: jasonhall96686@gmail.com-20210104203343-ldo9uscht0ifjc0a
Tags: upstream-0.15.0
ImportĀ upstreamĀ versionĀ 0.15.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * setCWD.du
3
 
 *
4
 
 * Testing the System.setCWD() function
5
 
 *
6
 
 * setCWD() sets the current working directory
7
 
 */
8
 
 
9
 
var cwd = System.getCWD().unwrap();
10
 
assert(cwd != nil);
11
 
assert(type(cwd) == "string");
12
 
assert(cwd.len() > 0);
13
 
assert(System.setCWD("/").success() == true);
14
 
if (System.platform == "windows") {
15
 
    assert(System.getCWD().unwrap() == "C:\\" or System.getCWD().unwrap() == "D:\\");
16
 
} else {
17
 
    assert(System.getCWD().unwrap() == "/");
18
 
}
19
 
assert(System.setCWD(cwd).success() == true);
20
 
assert(System.getCWD().unwrap() == cwd);
21
 
assert(System.setCWD("some/directory/that/doesnt/exist").success() == false);
22
 
assert(System.setCWD("some/directory/that/doesnt/exist").unwrapError() == "No such file or directory");