diff options
Diffstat (limited to 'tests/newconfig')
-rw-r--r-- | tests/newconfig/bar/config.nims | 0 | ||||
-rw-r--r-- | tests/newconfig/bar/mfoo.nim | 0 | ||||
-rw-r--r-- | tests/newconfig/bar/mfoo.nim.cfg | 0 | ||||
-rw-r--r-- | tests/newconfig/bar/mfoo.nims | 0 | ||||
-rw-r--r-- | tests/newconfig/bar/nim.cfg | 0 | ||||
-rw-r--r-- | tests/newconfig/foo2/mfoo2.customext | 2 | ||||
-rw-r--r-- | tests/newconfig/mconfigcheck.nims | 9 | ||||
-rw-r--r-- | tests/newconfig/tfoo.nim | 8 | ||||
-rw-r--r-- | tests/newconfig/tfoo.nims | 88 |
9 files changed, 73 insertions, 34 deletions
diff --git a/tests/newconfig/bar/config.nims b/tests/newconfig/bar/config.nims new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/newconfig/bar/config.nims diff --git a/tests/newconfig/bar/mfoo.nim b/tests/newconfig/bar/mfoo.nim new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/newconfig/bar/mfoo.nim diff --git a/tests/newconfig/bar/mfoo.nim.cfg b/tests/newconfig/bar/mfoo.nim.cfg new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/newconfig/bar/mfoo.nim.cfg diff --git a/tests/newconfig/bar/mfoo.nims b/tests/newconfig/bar/mfoo.nims new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/newconfig/bar/mfoo.nims diff --git a/tests/newconfig/bar/nim.cfg b/tests/newconfig/bar/nim.cfg new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/newconfig/bar/nim.cfg diff --git a/tests/newconfig/foo2/mfoo2.customext b/tests/newconfig/foo2/mfoo2.customext new file mode 100644 index 000000000..66c8b1d15 --- /dev/null +++ b/tests/newconfig/foo2/mfoo2.customext @@ -0,0 +1,2 @@ +doAssert defined(nimscript) +echo "123" diff --git a/tests/newconfig/mconfigcheck.nims b/tests/newconfig/mconfigcheck.nims new file mode 100644 index 000000000..8df6715f6 --- /dev/null +++ b/tests/newconfig/mconfigcheck.nims @@ -0,0 +1,9 @@ +mode = ScriptMode.Verbose +proc build() = + echo "building nim... " + exec "sleep 10" + exec "nonexistant command" + echo getCurrentDir() + +echo "hello" +build() diff --git a/tests/newconfig/tfoo.nim b/tests/newconfig/tfoo.nim index 52ea841ee..0c6ded470 100644 --- a/tests/newconfig/tfoo.nim +++ b/tests/newconfig/tfoo.nim @@ -1,7 +1,7 @@ discard """ - cmd: "nim default $file" - output: '''hello world! 0.5''' - msg: '''[NimScript] exec: gcc -v''' + cmd: "nim default --hint:cc:off --hint:cc $file" + output: '''hello world! 0.5 true''' + nimout: '''[NimScript] exec: gcc -v''' """ when not defined(definedefine): @@ -10,4 +10,4 @@ when not defined(definedefine): import math, mfriends discard gen[int]() -echo "hello world! ", ln 2.0 +echo "hello world! ", ln 2.0, " ", compileOption("opt", "speed") diff --git a/tests/newconfig/tfoo.nims b/tests/newconfig/tfoo.nims index 3be42c38a..f22caaacd 100644 --- a/tests/newconfig/tfoo.nims +++ b/tests/newconfig/tfoo.nims @@ -3,14 +3,32 @@ mode = ScriptMode.Whatif exec "gcc -v" -# test that ospaths actually compiles: -import ospaths +--define:release --forceBuild ---path: "../friends" +--path: "../generics" warning("uninit", off) -hint("processing", off) + +block: # supported syntaxes for hint,warning,switch + --hint:processing + hint("processing", on) + hint("processing", off) + switch("hint", "processing") + switch("hint", "processing:on") + switch("hint", "processing:off") + switch("hint", "[processing]") + switch("hint", "[processing]:on") + switch("hint", "[processing]:off") # leave it off + + --warning:UnusedImport + switch("warning", "UnusedImport:off") + switch("warning", "UnusedImport:on") + switch("warning", "[UnusedImport]:off") + switch("warning", "[UnusedImport]:on") + switch("warning", "[UnusedImport]") + switch("warning", "UnusedImport") # leave it on + #--verbosity:2 patchFile("stdlib", "math", "mymath") @@ -27,54 +45,64 @@ doAssert(existsEnv("dummy") == false) # issue #7283 putEnv("dummy", "myval") -doAssert(existsEnv("dummy") == true) +doAssert(existsEnv("dummy")) doAssert(getEnv("dummy") == "myval") +delEnv("dummy") +doAssert(existsEnv("dummy") == false) # issue #7393 let wd = getCurrentDir() cd("..") -assert wd != getCurrentDir() +doAssert wd != getCurrentDir() cd(wd) -assert wd == getCurrentDir() +doAssert wd == getCurrentDir() -assert findExe("nim") != "" +when false: + # this doesn't work in a 'koch testintall' environment + doAssert findExe("nim") != "" # general tests mode = ScriptMode.Verbose -assert getCommand() == "c" +doAssert getCommand() == "c" setCommand("cpp") -assert getCommand() == "cpp" +doAssert getCommand() == "cpp" setCommand("c") -assert cmpic("HeLLO", "hello") == 0 +doAssert cmpic("HeLLO", "hello") == 0 -assert fileExists("tests/newconfig/tfoo.nims") == true -assert dirExists("tests") == true +doAssert fileExists("tests/newconfig/tfoo.nims") == true +doAssert dirExists("tests") == true -assert existsFile("tests/newconfig/tfoo.nims") == true -assert existsDir("tests") == true +doAssert fileExists("tests/newconfig/tfoo.nims") == true +doAssert dirExists("tests") == true discard selfExe() when defined(windows): - assert toExe("nim") == "nim.exe" - assert toDll("nim") == "nim.dll" + doAssert toExe("nim") == "nim.exe" + doAssert toDll("nim") == "nim.dll" else: - assert toExe("nim") == "nim" - assert toDll("nim") == "libnim.so" + doAssert toExe("nim") == "nim" + doAssert toDll("nim") == "libnim.so" rmDir("tempXYZ") -assert dirExists("tempXYZ") == false +doAssertRaises(OSError): + rmDir("tempXYZ", checkDir = true) +doAssert 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 +doAssert dirExists("tempXYZ") == true +doAssert fileExists("tempXYZ/koch.nim") == false + +when false: + # this doesn't work in a 'koch testintall' environment + cpFile("koch.nim", "tempXYZ/koch.nim") + doAssert fileExists("tempXYZ/koch.nim") == true + cpDir("nimsuggest", "tempXYZ/.") + doAssert dirExists("tempXYZ/tests") == true + doAssert fileExists("tempXYZ/nimsuggest.nim") == true + rmFile("tempXYZ/koch.nim") + doAssert fileExists("tempXYZ/koch.nim") == false + rmDir("tempXYZ") -assert dirExists("tempXYZ") == false +doAssert dirExists("tempXYZ") == false |