summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-02-17 20:19:14 +0100
committerAraq <rumpf_a@web.de>2012-02-17 20:19:14 +0100
commita13a14327ad1a98776bbd5646c18a4f6cf257029 (patch)
tree5d782b88f91a30e82daceb8232730342c8f91697 /tests
parent547e8aa418ee9a851a876e109b483fc987bd87df (diff)
downloadNim-a13a14327ad1a98776bbd5646c18a4f6cf257029.tar.gz
fixes #99
Diffstat (limited to 'tests')
-rw-r--r--tests/run/texcpt1.nim30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/run/texcpt1.nim b/tests/run/texcpt1.nim
new file mode 100644
index 000000000..ec74c9470
--- /dev/null
+++ b/tests/run/texcpt1.nim
@@ -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()
+
+