new tester; all tests categorized

This commit is contained in:
Araq 2014-01-13 02:10:03 +01:00
commit 20b5f31c03
481 changed files with 794 additions and 2506 deletions

31
tests/vm/tconsteval.nim Normal file
View file

@ -0,0 +1,31 @@
discard """
"""
import strutils
const
HelpText = """
+-----------------------------------------------------------------+
| Maintenance program for Nimrod |
| Version $1|
| (c) 2012 Andreas Rumpf |
+-----------------------------------------------------------------+
Compiled at: $2, $3
Usage:
koch [options] command [options for command]
Options:
--force, -f, -B, -b forces rebuild
--help, -h shows this help and quits
Possible Commands:
boot [options] bootstraps with given command line options
clean cleans Nimrod project; removes generated files
web generates the website
csource [options] builds the C sources for installation
zip builds the installation ZIP package
inno builds the Inno Setup installer
""" % [NimrodVersion & repeatChar(44-len(NimrodVersion)),
CompileDate, CompileTime]
echo helpText

19
tests/vm/teval1.nim Normal file
View file

@ -0,0 +1,19 @@
import macros
proc testProc: string {.compileTime.} =
result = ""
result = result & ""
when true:
macro test(n: stmt): stmt {.immediate.} =
result = newNimNode(nnkStmtList)
echo "#", testProc(), "#"
test:
"hi"
const
x = testProc()
echo "##", x, "##"

6
tests/vm/tslurp.nim Normal file
View file

@ -0,0 +1,6 @@
const
myRes = slurp"../../readme.txt"
echo myRes

10
tests/vm/twrongconst.nim Normal file
View file

@ -0,0 +1,10 @@
discard """
output: "Error: cannot evaluate at compile time: x"
line: 10
"""
var x: array[100, char]
template Foo : expr = x[42]
const myConst = foo