tcppraise.nim 620 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. discard """
  2. targets: "cpp"
  3. output: '''foo
  4. bar
  5. Need odd and >= 3 digits##
  6. baz
  7. caught
  8. '''
  9. """
  10. # bug #1888
  11. echo "foo"
  12. try:
  13. echo "bar"
  14. raise newException(ValueError, "Need odd and >= 3 digits")
  15. # echo "baz"
  16. except ValueError:
  17. echo getCurrentExceptionMsg(), "##"
  18. echo "baz"
  19. # bug 7232
  20. try:
  21. discard
  22. except KeyError, ValueError:
  23. echo "except handler" # should not be invoked
  24. #bug 7239
  25. try:
  26. try:
  27. raise newException(ValueError, "asdf")
  28. except KeyError, ValueError:
  29. raise
  30. except:
  31. echo "caught"
  32. # issue 5549
  33. var strs: seq[string] = @[]
  34. try:
  35. discard
  36. finally:
  37. for foobar in strs:
  38. discard