summary refs log tree commit diff stats
path: root/tests/errmsgs/t23060.nim
Commit message (Expand)AuthorAgeFilesLines
* fixes #23060; `editDistance` wrongly compare the length of rune strings (#23062)ringabout2023-12-131-0/+5
thor Saem Ghani <saemghani+github@gmail.com> 2021-02-22 03:27:23 -0800 committer GitHub <noreply@github.com> 2021-02-22 12:27:23 +0100 when statements branches exit early (#17143)' href='/ahoang/Nim/commit/tests/whenstmt/twhen_macro.nim?h=devel&id=2aba116bbc8c1a595e49c8a703f2b8aecd7e8eda'>2aba116bb ^
3dbf2ac94 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

             














                                                      
                                       
import macros

# test that when stmt works from within a macro

macro output(s: string, xs: varargs[untyped]): auto =
  result = quote do:
    when compiles(`s`):
      "when - " & `s`
    elif compiles(`s`):
      "elif - " & `s`
      # should never get here so this should not break
      broken.xs
    else:
      "else - " & `s`
      # should never get here so this should not break
      more.broken.xs

doAssert output("test") == "when - test"