new tester; all tests categorized

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

View File

@@ -0,0 +1,12 @@
discard """
file: "topena1.nim"
line: 9
errormsg: "invalid type"
"""
# Tests a special bug
var
x: ref openarray[string] #ERROR_MSG invalid type

View File

@@ -0,0 +1,17 @@
discard """
file: "topenarrayrepr.nim"
output: "5 - [1]"
"""
type
TProc = proc (n: int, m: openarray[int64]) {.nimcall.}
proc Foo(x: int, P: TProc) =
P(x, [ 1'i64 ])
proc Bar(n: int, m: openarray[int64]) =
echo($n & " - " & repr(m))
Foo(5, Bar) #OUT 5 - [1]

View File

@@ -0,0 +1,18 @@
discard """
file: "topenlen.nim"
output: "7"
"""
# Tests a special bug
proc choose(b: openArray[string]): string = return b[0]
proc p(a, b: openarray[string]): int =
result = a.len + b.len - 1
for j in 0 .. a.len: inc(result)
discard choose(a)
discard choose(b)
discard choose(["sh", "-c", $p([""], ["a"])])
echo($p(["", "ha", "abc"], ["xyz"])) #OUT 7