diff options
author | Araq <rumpf_a@web.de> | 2018-08-22 15:37:57 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-08-22 15:37:57 +0200 |
commit | 27f488e5d9ad0e40b23fba7ab1a8b713c823e92c (patch) | |
tree | 72648ee40db80f7fc26301b6bec9dd6eb2620c1f /lib | |
parent | dbd21d670c754501e1c14c758e09c9fce3ad01d5 (diff) | |
download | Nim-27f488e5d9ad0e40b23fba7ab1a8b713c823e92c.tar.gz |
make more tests green; system.repr does not produce 'nil' for strings and seqs anymore
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/repr.nim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/system/repr.nim b/lib/system/repr.nim index 3dc220b87..85701c28f 100644 --- a/lib/system/repr.nim +++ b/lib/system/repr.nim @@ -29,7 +29,9 @@ proc reprStrAux(result: var string, s: cstring; len: int) = if cast[pointer](s) == nil: add result, "nil" return - add result, reprPointer(cast[pointer](s)) & "\"" + if len > 0: + add result, reprPointer(cast[pointer](s)) + add result, "\"" for i in 0 .. pred(len): let c = s[i] case c @@ -162,9 +164,10 @@ when not defined(useNimRtl): proc reprSequence(result: var string, p: pointer, typ: PNimType, cl: var ReprClosure) = if p == nil: - add result, "nil" + add result, "[]" return - result.add(reprPointer(p) & "[") + result.add(reprPointer(p)) + result.add '[' var bs = typ.base.size for i in 0..cast[PGenericSeq](p).len-1: if i > 0: add result, ", " |