mirror of
https://github.com/status-im/NimYAML.git
synced 2025-02-05 16:04:48 +00:00
fix assertStringEqual
to make sure not to access null terminator
This commit is contained in:
parent
f290876df7
commit
9a445c18bb
@ -97,7 +97,7 @@ proc constructObject*(s: var YamlStream, c: ConstructionContext,
|
|||||||
result = BetterInt(parseBiggestInt(item.scalarContent) + 1)
|
result = BetterInt(parseBiggestInt(item.scalarContent) + 1)
|
||||||
|
|
||||||
template assertStringEqual(expected, actual: string) =
|
template assertStringEqual(expected, actual: string) =
|
||||||
for i in countup(0, min(expected.len, actual.len)):
|
for i in countup(0, min(expected.len, actual.len) - 1):
|
||||||
if expected[i] != actual[i]:
|
if expected[i] != actual[i]:
|
||||||
echo "string mismatch at character #", i, "(expected:\'",
|
echo "string mismatch at character #", i, "(expected:\'",
|
||||||
expected[i], "\', was \'", actual[i], "\'):"
|
expected[i], "\', was \'", actual[i], "\'):"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user