diff options
author | genotrance <dev@genotrance.com> | 2018-04-10 11:50:23 -0500 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-10 18:50:23 +0200 |
commit | f6c8f97fe8bd22e7a2c1b9463f52747e98693682 (patch) | |
tree | aaf353540fa35d16dffaca60c8c7b26e4a543613 /tests | |
parent | 16c1a90857992df0960f53f5ffa578f14059cee4 (diff) | |
download | Nim-f6c8f97fe8bd22e7a2c1b9463f52747e98693682.tar.gz |
Add a few useful os calls to nimscript (#7442)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/newconfig/tfoo.nims | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/newconfig/tfoo.nims b/tests/newconfig/tfoo.nims index b3448f0df..3be42c38a 100644 --- a/tests/newconfig/tfoo.nims +++ b/tests/newconfig/tfoo.nims @@ -30,4 +30,51 @@ putEnv("dummy", "myval") doAssert(existsEnv("dummy") == true) doAssert(getEnv("dummy") == "myval") +# issue #7393 +let wd = getCurrentDir() +cd("..") +assert wd != getCurrentDir() +cd(wd) +assert wd == getCurrentDir() +assert findExe("nim") != "" + +# general tests +mode = ScriptMode.Verbose + +assert getCommand() == "c" +setCommand("cpp") +assert getCommand() == "cpp" +setCommand("c") + +assert cmpic("HeLLO", "hello") == 0 + +assert fileExists("tests/newconfig/tfoo.nims") == true +assert dirExists("tests") == true + +assert existsFile("tests/newconfig/tfoo.nims") == true +assert existsDir("tests") == true + +discard selfExe() + +when defined(windows): + assert toExe("nim") == "nim.exe" + assert toDll("nim") == "nim.dll" +else: + assert toExe("nim") == "nim" + assert toDll("nim") == "libnim.so" + +rmDir("tempXYZ") +assert dirExists("tempXYZ") == false +mkDir("tempXYZ") +assert dirExists("tempXYZ") == true +assert fileExists("tempXYZ/koch.nim") == false +cpFile("koch.nim", "tempXYZ/koch.nim") +assert fileExists("tempXYZ/koch.nim") == true +cpDir("nimsuggest", "tempXYZ/.") +assert dirExists("tempXYZ/tests") == true +assert fileExists("tempXYZ/nimsuggest.nim") == true +rmFile("tempXYZ/koch.nim") +assert fileExists("tempXYZ/koch.nim") == false +rmDir("tempXYZ") +assert dirExists("tempXYZ") == false |