move tests under the compiler directory to testament (#16096)
This commit is contained in:
parent
b7809cc992
commit
57bd64582c
10 changed files with 344 additions and 328 deletions
|
|
@ -54,36 +54,3 @@ proc prefixMatch*(p, s: string): PrefixMatch =
|
|||
else:
|
||||
return PrefixMatch.None
|
||||
return PrefixMatch.None
|
||||
|
||||
when isMainModule:
|
||||
import macros
|
||||
|
||||
macro check(val, body: untyped): untyped =
|
||||
result = newStmtList()
|
||||
expectKind body, nnkStmtList
|
||||
for b in body:
|
||||
expectKind b, nnkPar
|
||||
expectLen b, 2
|
||||
let p = b[0]
|
||||
let s = b[1]
|
||||
result.add quote do:
|
||||
echo prefixMatch(`p`, `s`) == `val`
|
||||
|
||||
check PrefixMatch.Prefix:
|
||||
("abc", "abc")
|
||||
("a", "abc")
|
||||
("xyz", "X_yzzzZe")
|
||||
|
||||
check PrefixMatch.Substr:
|
||||
("b", "abc")
|
||||
("abc", "fooabcabc")
|
||||
("abC", "foo_AB_c")
|
||||
|
||||
check PrefixMatch.Abbrev:
|
||||
("abc", "AxxxBxxxCxxx")
|
||||
("xyz", "X_yabcZe")
|
||||
|
||||
check PrefixMatch.None:
|
||||
("foobar", "afkslfjd_as")
|
||||
("xyz", "X_yuuZuuZe")
|
||||
("ru", "remotes")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue