fix `assertStringEqual` to make sure not to access null terminator

This commit is contained in:
Vindaar 2018-10-03 19:53:09 +02:00 committed by flyx
parent f290876df7
commit 9a445c18bb
1 changed files with 1 additions and 1 deletions

View File

@ -97,7 +97,7 @@ proc constructObject*(s: var YamlStream, c: ConstructionContext,
result = BetterInt(parseBiggestInt(item.scalarContent) + 1)
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]:
echo "string mismatch at character #", i, "(expected:\'",
expected[i], "\', was \'", actual[i], "\'):"