make some tests green
This commit is contained in:
parent
f0953db3ba
commit
49b0440c47
13 changed files with 45 additions and 30 deletions
|
|
@ -54,5 +54,5 @@ echo getRows(m)
|
|||
type TTest[T: static[int], U: static[int]] = array[0..T*U, int]
|
||||
type TTestSub[N: static[int]] = TTest[1, N]
|
||||
|
||||
var x: TTestSub[2]
|
||||
echo x.high
|
||||
var z: TTestSub[2]
|
||||
echo z.high
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ foo 10
|
|||
foo "test"
|
||||
foo(@[TObj(x: 10), TObj(x: 20)])
|
||||
|
||||
proc intval(x: int) = discard
|
||||
proc intval(x: int): int = 10
|
||||
|
||||
# check real and virtual fields
|
||||
type
|
||||
|
|
@ -34,8 +34,8 @@ type
|
|||
T.x
|
||||
y(T)
|
||||
intval T.y
|
||||
let y = intval(T.y)
|
||||
|
||||
let z = intval(T.y)
|
||||
|
||||
proc y(x: TObj): int = 10
|
||||
|
||||
proc testFoo(x: TFoo) = discard
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ type
|
|||
rule: TNode ## the rule that the symbol refers to
|
||||
TNode {.final, shallow.} = object
|
||||
case kind: TPegKind
|
||||
of pkEmpty..pkWhitespace: discard
|
||||
of pkEmpty..pkWhitespace: nil
|
||||
of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle: term: string
|
||||
of pkChar, pkGreedyRepChar: ch: char
|
||||
of pkCharChoice, pkGreedyRepSet: charChoice: ref set[char]
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ proc addResult(r: var TResults, test: TTest,
|
|||
expected = expected,
|
||||
given = given)
|
||||
r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success)
|
||||
echo " [", $success, "]"
|
||||
|
||||
proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) =
|
||||
if strip(expected.msg) notin strip(given.msg):
|
||||
|
|
@ -146,7 +147,7 @@ proc testSpec(r: var TResults, test: TTest) =
|
|||
# major entry point for a single test
|
||||
let tname = test.name.addFileExt(".nim")
|
||||
inc(r.total)
|
||||
echo extractFilename(tname)
|
||||
stdout.write extractFilename(tname)
|
||||
var expected = parseSpec(tname)
|
||||
if expected.err == reIgnored:
|
||||
r.addResult(test, "", "", reIgnored)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
discard """
|
||||
output: "Error: cannot evaluate at compile time: x"
|
||||
line: 10
|
||||
errormsg: "cannot evaluate at compile time: x"
|
||||
line: 9
|
||||
"""
|
||||
|
||||
var x: array[100, char]
|
||||
var x: array[100, char]
|
||||
template Foo : expr = x[42]
|
||||
|
||||
|
||||
const myConst = foo
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
discard """
|
||||
output: "Error: cannot evaluate at compile time: x"
|
||||
errormsg: "cannot evaluate at compile time: x"
|
||||
line: 7
|
||||
"""
|
||||
|
||||
proc bla(x:int) =
|
||||
proc bla(x:int) =
|
||||
when x == 0:
|
||||
echo "oops"
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue