diff options
author | Arne Döring <arne.doering@gmx.net> | 2018-04-17 01:23:38 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-17 01:23:38 +0200 |
commit | 9d4fd1f1bbc0d8a2327699dd07283260d85a5245 (patch) | |
tree | 98059bd476176b36182213999d4c30b13d4476df /tests/macros | |
parent | b1b517128e9ab4d1c1e8e16543008cbdecef0468 (diff) | |
download | Nim-9d4fd1f1bbc0d8a2327699dd07283260d85a5245.tar.gz |
eqIdent new returns false on non identifier types (#7629)
Diffstat (limited to 'tests/macros')
-rw-r--r-- | tests/macros/tmacro1.nim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/macros/tmacro1.nim b/tests/macros/tmacro1.nim index 0b83345a1..ac2bf9094 100644 --- a/tests/macros/tmacro1.nim +++ b/tests/macros/tmacro1.nim @@ -27,11 +27,19 @@ import strutils template assertNot(arg: untyped): untyped = assert(not(arg)) + +proc foo(arg: int): void = + discard + +proc foo(arg: float): void = + discard + static: ## test eqIdent let a = "abc_def" let b = "abcDef" let c = "AbcDef" + let d = nnkBracketExpr.newTree() # not an identifier at all assert eqIdent( a , b ) assert eqIdent(newIdentNode(a), b ) @@ -62,3 +70,12 @@ static: assertNot eqIdent(genSym(nskLet, c), newIdentNode( b)) assertNot eqIdent(newIdentNode( c), genSym(nskLet, b)) assertNot eqIdent(genSym(nskLet, c), genSym(nskLet, b)) + + # eqIdent on non identifier at all + assertNot eqIdent(a,d) + + # eqIdent on sym choice + let fooSym = bindSym"foo" + assert fooSym.kind in {nnkOpenSymChoice, nnkClosedSymChoice} + assert fooSym.eqIdent("fOO") + assertNot fooSym.eqIdent("bar") |