assert() -> doAssert()
and an explicit "test" task for the sake of nimble.sh
This commit is contained in:
parent
a9d565f8e0
commit
002c6bbb38
|
@ -11,3 +11,11 @@ requires "nim >= 0.17.0",
|
|||
"serialization",
|
||||
"std_shims"
|
||||
|
||||
import ospaths, strutils
|
||||
|
||||
task test, "Run tests":
|
||||
for filename in listFiles("tests"):
|
||||
if filename.startsWith("tests" / "test_") and filename.endsWith(".nim"):
|
||||
exec "nim c -r " & filename
|
||||
rmFile filename[0..^5]
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ proc requireToken(r: JsonReader, tk: TokKind) =
|
|||
of tkBracketLe: etBracketLe
|
||||
of tkCurlyRi: etCurrlyRi
|
||||
of tkCurlyLe: etCurrlyLe
|
||||
else: (assert false; etBool)
|
||||
else: (doAssert false; etBool)
|
||||
|
||||
proc skipToken(r: var JsonReader, tk: TokKind) =
|
||||
r.requireToken tk
|
||||
|
|
|
@ -41,7 +41,7 @@ template indent =
|
|||
proc writeFieldName*(w: var JsonWriter, name: string) =
|
||||
# this is implemented as a separate proc in order to
|
||||
# keep the code bloat from `writeField` to a minimum
|
||||
assert w.state != RecordExpected
|
||||
doAssert w.state != RecordExpected
|
||||
|
||||
if w.state == AfterField:
|
||||
append ','
|
||||
|
@ -68,7 +68,7 @@ proc writeField*(w: var JsonWriter, name: string, value: auto) =
|
|||
w.state = AfterField
|
||||
|
||||
proc beginRecord*(w: var JsonWriter) =
|
||||
assert w.state == RecordExpected
|
||||
doAssert w.state == RecordExpected
|
||||
|
||||
append '{'
|
||||
if w.hasPrettyOutput:
|
||||
|
@ -81,7 +81,7 @@ proc beginRecord*(w: var JsonWriter, T: type) =
|
|||
if w.hasTypeAnnotations: w.writeField("$type", typetraits.name(T))
|
||||
|
||||
proc endRecord*(w: var JsonWriter) =
|
||||
assert w.state != RecordExpected
|
||||
doAssert w.state != RecordExpected
|
||||
|
||||
if w.hasPrettyOutput:
|
||||
append '\n'
|
||||
|
|
|
@ -26,7 +26,7 @@ type
|
|||
distance: Mile
|
||||
|
||||
template reject(code) =
|
||||
static: assert(not compiles(code))
|
||||
static: doAssert(not compiles(code))
|
||||
|
||||
borrowSerialization(Meter, int)
|
||||
|
||||
|
|
Loading…
Reference in New Issue