summary refs log tree commit diff stats
path: root/nimsuggest/tester.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-08-10 09:37:41 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-08-10 09:37:41 +0200
commit28c709fa8422af6faa1f48c37d0ddd62e20deb7d (patch)
treeff88b590f0642ec2f14def80313a576777f45646 /nimsuggest/tester.nim
parent7e2418bd224add065bb1245a0602b8d75dd2ca03 (diff)
downloadNim-28c709fa8422af6faa1f48c37d0ddd62e20deb7d.tar.gz
cleanup nimsuggest tests a bit
Diffstat (limited to 'nimsuggest/tester.nim')
-rw-r--r--nimsuggest/tester.nim12
1 files changed, 6 insertions, 6 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)
t/run/tactiontable.nim?h=devel&id=ffefb736d9a408602f0dca9a762bd090c1c8cd1d'>ffefb736d ^
7819b8447 ^
7f18d7cbc ^
63f938532 ^


ffefb736d ^

7f18d7cbc ^








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37