summary refs log tree commit diff stats
path: root/tests/casestmt/tcaseexpr1.nim
blob: e5e08e25e5a069769cb2e657447e41f7a1647c8a (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
discard """
  file: "tcaseexpr1.nim"

  line: 29
  errormsg: "type mismatch: got (string) but expected 'int'"

  line: 23
  errormsg: "not all cases are covered"
"""

type
  E = enum A, B, C

proc foo(x): auto =
  return case x
    of 1..9: "digit"
    else: "number"

var r = foo(10)

var x = C

var t1 = case x:
  of A: "a"
  of B: "b"

var t2 = case x:
  of A: 10
  of B, C: "23"