nim-serialization/tests/test_object_serialization.nim

23 lines
621 B
Nim
Raw Permalink Normal View History

2019-08-14 09:25:02 +00:00
import
2019-08-14 15:33:14 +00:00
typetraits, unittest,
stew/shims/macros,
2019-08-14 09:25:02 +00:00
../serialization/object_serialization,
../serialization/testing/generic_suite
2019-08-14 15:33:14 +00:00
suite "object serialization":
setup:
var fieldsList = newSeq[string]()
test "custom fields order":
enumAllSerializedFields(Simple):
2019-08-24 03:14:20 +00:00
fieldsList.add(name(FieldType) & " " & fieldName & fieldCaseDiscriminator)
2019-08-14 15:33:14 +00:00
check fieldsList == @["Meter distance", "int x", "string y"]
test "tuples handling":
enumAllSerializedFields(HoldsTuples):
fieldsList.add(fieldName & ": " & $isTuple(FieldType))
check fieldsList == @["t1: true", "t2: true", "t3: true"]