new tester; all tests categorized
This commit is contained in:
parent
51ee524109
commit
20b5f31c03
481 changed files with 794 additions and 2506 deletions
30
tests/exception/texcpt1.nim
Normal file
30
tests/exception/texcpt1.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
discard """
|
||||
outputsub: "-6"
|
||||
"""
|
||||
type
|
||||
ESomething = object of E_Base
|
||||
ESomeOtherErr = object of E_Base
|
||||
|
||||
proc genErrors(s: string) =
|
||||
if s == "error!":
|
||||
raise newException(ESomething, "Test")
|
||||
else:
|
||||
raise newException(EsomeotherErr, "bla")
|
||||
|
||||
proc raiseBla(): int =
|
||||
try:
|
||||
genErrors("errssor!")
|
||||
except ESomething:
|
||||
echo("Error happened")
|
||||
except:
|
||||
raise
|
||||
|
||||
proc blah(): int =
|
||||
try:
|
||||
result = raiseBla()
|
||||
except ESomeOtherErr:
|
||||
result = -6
|
||||
|
||||
echo blah()
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue