diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-08-10 09:37:41 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-08-10 09:37:41 +0200 |
commit | 28c709fa8422af6faa1f48c37d0ddd62e20deb7d (patch) | |
tree | ff88b590f0642ec2f14def80313a576777f45646 /nimsuggest/tester.nim | |
parent | 7e2418bd224add065bb1245a0602b8d75dd2ca03 (diff) | |
download | Nim-28c709fa8422af6faa1f48c37d0ddd62e20deb7d.tar.gz |
cleanup nimsuggest tests a bit
Diffstat (limited to 'nimsuggest/tester.nim')
-rw-r--r-- | nimsuggest/tester.nim | 12 |
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) |