cleanup nimsuggest tests a bit

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

View file

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

View file

@ -2,7 +2,7 @@ discard """
$nimsuggest --tester --maxresults:2 $file $nimsuggest --tester --maxresults:2 $file
>sug $1 >sug $1
sug;;skProc;;tdot4.main;;proc (inp: string): string;;$file;;10;;5;;"";;100;;None 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 import strutils

View file

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