more tests green

This commit is contained in:
Araq 2014-08-31 17:23:35 +02:00
commit d7d059a686
16 changed files with 79 additions and 79 deletions

View file

@ -2,8 +2,8 @@ discard """
outputsub: "-6"
"""
type
ESomething = object of E_Base
ESomeOtherErr = object of E_Base
ESomething = object of Exception
ESomeOtherErr = object of Exception
proc genErrors(s: string) =
if s == "error!":

View file

@ -10,8 +10,8 @@ proc test1() =
finally: echo "A"
try:
raise newException(EOS, "Problem")
except EOS:
raise newException(OSError, "Problem")
except OSError:
return
test1()
@ -23,7 +23,7 @@ proc test2() =
try:
return
except EOS:
except OSError:
discard
test2()
@ -31,8 +31,8 @@ test2()
proc test3() =
try:
try:
raise newException(EOS, "Problem")
except EOS:
raise newException(OSError, "Problem")
except OSError:
return
finally:
echo "C"

View file

@ -1,14 +1,14 @@
discard """
file: "tnestedreturn.nim"
outputsub: "Error: unhandled exception: Problem [EOS]"
file: "tnestedreturn2.nim"
outputsub: "Error: unhandled exception: Problem [OSError]"
exitcode: "1"
"""
proc test4() =
try:
try:
raise newException(EOS, "Problem")
except EOS:
raise newException(OSError, "Problem")
except OSError:
return
finally:
discard
@ -17,4 +17,4 @@ proc test4() =
# but could cause segmentation fault if
# exceptions are not handled properly.
test4()
raise newException(EOS, "Problem")
raise newException(OSError, "Problem")

View file

@ -4,8 +4,8 @@ discard """
exitcode: "1"
"""
type
ESomething = object of E_Base
ESomeOtherErr = object of E_Base
ESomething = object of Exception
ESomeOtherErr = object of Exception
proc genErrors(s: string) =
if s == "error!":
@ -13,7 +13,7 @@ proc genErrors(s: string) =
else:
raise newException(EsomeotherErr, "bla")
when True:
when true:
try:
genErrors("errssor!")
except ESomething:

View file

@ -1,11 +1,11 @@
discard """
file: "twrongexc.nim"
outputsub: "Error: unhandled exception: [EInvalidValue]"
outputsub: "Error: unhandled exception: [ValueError]"
exitcode: "1"
"""
try:
raise newException(EInvalidValue, "")
except EOverflow:
raise newException(ValueError, "")
except OverflowError:
echo("Error caught")