fix #49: field type with qualified ident
This commit is contained in:
parent
8f8f715f76
commit
d06f6187dc
|
@ -148,7 +148,7 @@ proc traverseIdentDefs(identDefs: NimNode, parent: ConfFileSection,
|
|||
result.add traversePostfix(child, typ, isDiscriminator)
|
||||
of nnkPragmaExpr:
|
||||
result.add traversePragmaExpr(child, typ, isDiscriminator)
|
||||
of nnkBracketExpr, nnkSym, nnkEmpty, nnkInfix, nnkCall:
|
||||
of nnkBracketExpr, nnkSym, nnkEmpty, nnkInfix, nnkCall, nnkDotExpr:
|
||||
discard
|
||||
else:
|
||||
raiseAssert "[IdentDefs] Unsupported child node:\n" & child.treeRepr
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
type
|
||||
SInt* = distinct int
|
|
@ -12,7 +12,8 @@ import
|
|||
test_config_file,
|
||||
test_envvar,
|
||||
test_parsecmdarg,
|
||||
test_pragma
|
||||
test_pragma,
|
||||
test_qualified_ident
|
||||
|
||||
when defined(windows):
|
||||
import test_winreg
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import
|
||||
std/[strutils, unittest],
|
||||
../confutils,
|
||||
./specialint
|
||||
|
||||
type
|
||||
TestConf* = object
|
||||
La1* {.
|
||||
desc: "La1"
|
||||
name: "la1" }: SInt
|
||||
|
||||
La2* {.
|
||||
desc: "La2"
|
||||
name: "la2" }: specialint.SInt
|
||||
|
||||
proc parseCmdArg(T: type specialint.SInt, p: TaintedString): T =
|
||||
parseInt(string p).T
|
||||
|
||||
proc completeCmdArg(T: type specialint.SInt, val: TaintedString): seq[string] =
|
||||
return @[]
|
||||
|
||||
suite "Qualified Ident":
|
||||
test "Qualified Ident":
|
||||
let conf = TestConf.load(@["--la1:123", "--la2:456"])
|
||||
check conf.La1.int == 123
|
||||
check conf.La2.int == 456
|
Loading…
Reference in New Issue