summary refs log tree commit diff stats
path: root/nimsuggest
diff options
context:
space:
mode:
Diffstat (limited to 'nimsuggest')
-rw-r--r--nimsuggest/tester.nim12
-rw-r--r--nimsuggest/tests/tdot4.nim2
-rw-r--r--nimsuggest/tests/tinclude.nim8
3 files changed, 11 insertions, 11 deletions
diff --git a/nimsuggest/tester.nim b/nimsuggest/tester.nim
index 4cda272af..b962a9f83 100644
--- a/nimsuggest/tester.nim
+++ b/nimsuggest/tester.nim
@@ -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)
diff --git a/nimsuggest/tests/tdot4.nim b/nimsuggest/tests/tdot4.nim
index 25e77ed04..8510162ac 100644
--- a/nimsuggest/tests/tdot4.nim
+++ b/nimsuggest/tests/tdot4.nim
@@ -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
diff --git a/nimsuggest/tests/tinclude.nim b/nimsuggest/tests/tinclude.nim
index 12d40d1e7..0616b7164 100644
--- a/nimsuggest/tests/tinclude.nim
+++ b/nimsuggest/tests/tinclude.nim
@@ -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
 """