cleanup nimsuggest tests a bit

This commit is contained in:
Andreas Rumpf
2018-08-10 09:37:41 +02:00
parent 7e2418bd22
commit 28c709fa84
3 changed files with 11 additions and 11 deletions

View File

@@ -70,22 +70,22 @@ proc parseCmd(c: string): seq[string] =
result = @[]
var i = 0
var a = ""
while true:
while i < c.len:
setLen(a, 0)
# eat all delimiting whitespace
while c[i] in {' ', '\t', '\l', '\r'}: inc(i)
while i < c.len and c[i] in {' ', '\t', '\l', '\r'}: inc(i)
if i >= c.len: break
case c[i]
of '"': raise newException(ValueError, "double quotes not yet supported: " & c)
of '\'':
var delim = c[i]
inc(i) # skip ' or "
while c[i] != '\0' and c[i] != delim:
while i < c.len and c[i] != delim:
add a, c[i]
inc(i)
if c[i] != '\0': inc(i)
of '\0': break
if i < c.len: inc(i)
else:
while c[i] > ' ':
while i < c.len and c[i] > ' ':
add(a, c[i])
inc(i)
add(result, a)

View File

@@ -2,7 +2,7 @@ discard """
$nimsuggest --tester --maxresults:2 $file
>sug $1
sug;;skProc;;tdot4.main;;proc (inp: string): string;;$file;;10;;5;;"";;100;;None
sug;;skProc;;strutils.replace;;proc (s: string, sub: string, by: string): string{.noSideEffect, gcsafe, locks: 0.};;$lib/pure/strutils.nim;;1575;;5;;"Replaces `sub` in `s` by the string `by`.";;100;;None
sug;;skProc;;strutils.replace;;proc (s: string, sub: string, by: string): string{.noSideEffect, gcsafe, locks: 0.};;$lib/pure/strutils.nim;;1506;;5;;"Replaces `sub` in `s` by the string `by`.";;100;;None
"""
import strutils

View File

@@ -1,7 +1,7 @@
discard """
$nimsuggest --tester compiler/nim.nim
>def compiler/semexprs.nim:13:50
def;;skType;;ast.PSym;;PSym;;*ast.nim;;691;;2;;"";;100
>def compiler/semexprs.nim:13:50
def;;skType;;ast.PSym;;PSym;;*ast.nim;;691;;2;;"";;100
>def compiler/semexprs.nim:25:50
def;;skType;;ast.PSym;;PSym;;*ast.nim;;707;;2;;"";;100
>def compiler/semexprs.nim:25:50
def;;skType;;ast.PSym;;PSym;;*ast.nim;;707;;2;;"";;100
"""