summary refs log tree commit diff stats
path: root/tests/casestmt/tcasestm.nim
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2018-04-06 09:53:21 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-04-06 10:53:21 +0200
commitc34cb101b8621d52680892ae4041dff6541f1c0a (patch)
treeeb4ee5a00c3aee41fa39ddcca45dd586817827ed /tests/casestmt/tcasestm.nim
parent9bacdd64c1a30ab77d2701f877262f8f7c164c36 (diff)
downloadNim-c34cb101b8621d52680892ae4041dff6541f1c0a.tar.gz
Fixes #7407 (#7427)
Diffstat (limited to 'tests/casestmt/tcasestm.nim')
-rw-r--r--tests/casestmt/tcasestm.nim19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/casestmt/tcasestm.nim b/tests/casestmt/tcasestm.nim
index b005d8120..4d32d023f 100644
--- a/tests/casestmt/tcasestm.nim
+++ b/tests/casestmt/tcasestm.nim
@@ -45,15 +45,24 @@ let a = case str1:
     echo "no good"
     quit("quiting")
 
-let b = case str2:
-  of nil, "": raise newException(ValueError, "Invalid boolean")
-  elif str2[0] == 'Y': true
-  elif str2[0] == 'N': false
-  else: "error".quit(2)
+proc toBool(s: string): bool = 
+  case s:
+    of nil, "": raise newException(ValueError, "Invalid boolean")
+    elif s[0] == 'Y': true
+    elif s[0] == 'N': false
+    else: "error".quit(2)
+
+
+let b = "NN".toBool()
 
 doAssert(a == true)
 doAssert(b == false)
 
+static:
+  #bug #7407
+  let bstatic = "N".toBool()
+  doAssert(bstatic == false)
+
 var bb: bool
 doassert(not compiles(
   bb = case str2: