2022-05-10 11:58:13 +07:00
|
|
|
import
|
2023-02-08 08:19:55 +07:00
|
|
|
std/[strutils],
|
|
|
|
unittest2,
|
2022-05-10 11:58:13 +07:00
|
|
|
../confutils,
|
|
|
|
./specialint
|
|
|
|
|
|
|
|
type
|
|
|
|
TestConf* = object
|
|
|
|
La1* {.
|
|
|
|
desc: "La1"
|
|
|
|
name: "la1" }: SInt
|
|
|
|
|
|
|
|
La2* {.
|
|
|
|
desc: "La2"
|
|
|
|
name: "la2" }: specialint.SInt
|
|
|
|
|
2022-06-03 18:24:59 +00:00
|
|
|
func parseCmdArg(T: type specialint.SInt, p: string): T =
|
2023-02-15 15:26:53 +07:00
|
|
|
parseInt(p).T
|
2022-05-10 11:58:13 +07:00
|
|
|
|
2022-06-03 18:24:59 +00:00
|
|
|
func completeCmdArg(T: type specialint.SInt, val: string): seq[string] =
|
|
|
|
@[]
|
2022-05-10 11:58:13 +07:00
|
|
|
|
|
|
|
suite "Qualified Ident":
|
|
|
|
test "Qualified Ident":
|
|
|
|
let conf = TestConf.load(@["--la1:123", "--la2:456"])
|
|
|
|
check conf.La1.int == 123
|
|
|
|
check conf.La2.int == 456
|