Fix a compilation issue in the roundtripTest when used with case objects
This commit is contained in:
parent
99daa96284
commit
e26985dec3
|
@ -32,6 +32,8 @@ type
|
||||||
proc default(T: typedesc): T = discard
|
proc default(T: typedesc): T = discard
|
||||||
|
|
||||||
template roundtripTest*(Format: type, value: auto, expectedResult: auto) =
|
template roundtripTest*(Format: type, value: auto, expectedResult: auto) =
|
||||||
|
mixin `==`
|
||||||
|
|
||||||
test Format.name & " " & value.type.name & " roundtrip":
|
test Format.name & " " & value.type.name & " roundtrip":
|
||||||
let v = value
|
let v = value
|
||||||
let serialized = Format.encode(v)
|
let serialized = Format.encode(v)
|
||||||
|
@ -43,7 +45,8 @@ template roundtripTest*(Format: type, value: auto, expectedResult: auto) =
|
||||||
try:
|
try:
|
||||||
let decoded = Format.decode(serialized, v.type)
|
let decoded = Format.decode(serialized, v.type)
|
||||||
checkpoint "(decoded value): " & repr(decoded)
|
checkpoint "(decoded value): " & repr(decoded)
|
||||||
check decoded == v
|
let decodedValueMatchesOriginal = decoded == v
|
||||||
|
check decodedValueMatchesOriginal
|
||||||
except SerializationError as err:
|
except SerializationError as err:
|
||||||
checkpoint "(serialization error): " & err.formatMsg("(encoded value)")
|
checkpoint "(serialization error): " & err.formatMsg("(encoded value)")
|
||||||
fail()
|
fail()
|
||||||
|
|
Loading…
Reference in New Issue