summary refs log tree commit diff stats
path: root/tests/exception/texceptionbreak.nim
blob: 6548192c60b3767ee3a7974d8f89f158a099b60d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
discard """
  output: "1\n2\n3\n4"
"""

# First variety
try:
  raise newException(OSError, "Problem")
except OSError:
  for y in [1, 2, 3]:
    discard
  try:
    discard
  except OSError:
    discard
echo "1"

# Second Variety
try:
  raise newException(OSError, "Problem")
except OSError:
  for y in [1, 2, 3]:
    discard
  for y in [1, 2, 3]:
    discard

echo "2"

# Third Variety
try:
  raise newException(OSError, "Problem")
except OSError:
  block:
    break

echo "3"

# Fourth Variety
block:
  try:
    raise newException(OSError, "Problem")
  except OSError:
    break

echo "4"