diff options
Diffstat (limited to 'compiler/prefixmatches.nim')
-rw-r--r-- | compiler/prefixmatches.nim | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/compiler/prefixmatches.nim b/compiler/prefixmatches.nim index b03d1d76e..bfbe3d888 100644 --- a/compiler/prefixmatches.nim +++ b/compiler/prefixmatches.nim @@ -7,7 +7,7 @@ # distribution, for details about the copyright. # -from strutils import toLowerAscii +from std/strutils import toLowerAscii type PrefixMatch* {.pure.} = enum @@ -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") |