You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Slightly modifying the sample code from documentation:
# simple.nim
import strutils
template testException*(exception, code: typed): untyped =
try:
let pos = currentSourcePath()
discard(code)
echo "Test failure at $1 with '$2'" % [pos, astToStr(code)]
assert false, "A test expecting failure succeeded?"
except exception:
discard
# bug.nim
import simple
proc tester(pos: int): int =
let
a = @[1, 2, 3]
result = a[pos]
when isMainModule:
testException(IndexError, tester(30))
testException(IndexError, tester(1))
# --> Test failure at simple.nim with 'tester(1)'
One would expect to get the name of the module that is "main" not the imported one.
The text was updated successfully, but these errors were encountered:
Slightly modifying the sample code from documentation:
One would expect to get the name of the module that is "main" not the imported one.
The text was updated successfully, but these errors were encountered: