Add a few useful os calls to nimscript (#7442)
This commit is contained in:
parent
16c1a90857
commit
f6c8f97fe8
4 changed files with 81 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue