use doAssert in tests (#16486)
This commit is contained in:
parent
f9a15dbae9
commit
6d442a40a6
78 changed files with 1056 additions and 1056 deletions
|
|
@ -7,7 +7,7 @@ type Foo = ref object
|
|||
i: int
|
||||
|
||||
proc next(foo: Foo): Option[Foo] =
|
||||
try: assert(foo.i == 0)
|
||||
try: doAssert(foo.i == 0)
|
||||
except: return # 2º: none
|
||||
return some(foo) # 1º: some
|
||||
|
||||
|
|
@ -17,6 +17,6 @@ proc test =
|
|||
while isSome(opt) and foo.i < 10:
|
||||
inc(foo.i)
|
||||
opt = next(foo) # 2º None
|
||||
assert foo.i == 1, $foo.i
|
||||
doAssert foo.i == 1, $foo.i
|
||||
|
||||
test()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ iterator myitems*[T](a: var seq[T]): var T {.inline.} =
|
|||
while i < L:
|
||||
yield a[i]
|
||||
inc(i)
|
||||
assert(len(a) == L, "the length of the seq changed while iterating over it")
|
||||
doAssert(len(a) == L, "the length of the seq changed while iterating over it")
|
||||
|
||||
# Works fine
|
||||
var xs = @[1,2,3]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue