2022-05-10 04:58:13 +00:00
|
|
|
import
|
2023-02-08 01:19:55 +00:00
|
|
|
std/[strutils],
|
|
|
|
unittest2,
|
2022-05-10 04:58:13 +00:00
|
|
|
../confutils,
|
2024-02-12 05:39:19 +00:00
|
|
|
./private/specialint
|
2022-05-10 04:58:13 +00:00
|
|
|
|
|
|
|
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 08:26:53 +00:00
|
|
|
parseInt(p).T
|
2022-05-10 04:58:13 +00:00
|
|
|
|
2022-06-03 18:24:59 +00:00
|
|
|
func completeCmdArg(T: type specialint.SInt, val: string): seq[string] =
|
|
|
|
@[]
|
2022-05-10 04:58:13 +00: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
|