Improved test code

This commit is contained in:
Felix Krause 2017-01-10 11:35:19 +01:00
parent 356dc5c8bd
commit 737d326e7a

View File

@ -4,7 +4,7 @@
# See the file "copying.txt", included in this # See the file "copying.txt", included in this
# distribution, for details about the copyright. # distribution, for details about the copyright.
import "../yaml" import "../yaml", strutils
proc escapeNewlines(s: string): string = proc escapeNewlines(s: string): string =
result = "" result = ""
@ -22,7 +22,7 @@ proc printDifference*(expected, actual: YamlStreamEvent) =
case expected.kind case expected.kind
of yamlScalar: of yamlScalar:
if expected.scalarTag != actual.scalarTag: if expected.scalarTag != actual.scalarTag:
echo "[\"", actual.scalarContent, "\".tag] expected tag ", echo "[", escape(actual.scalarContent), ".tag] expected tag ",
expected.scalarTag, ", got ", actual.scalarTag expected.scalarTag, ", got ", actual.scalarTag
elif expected.scalarAnchor != actual.scalarAnchor: elif expected.scalarAnchor != actual.scalarAnchor:
echo "[scalarEvent] expected anchor ", expected.scalarAnchor, echo "[scalarEvent] expected anchor ", expected.scalarAnchor,