nim-serialization/tests/test_object_serialization.nim

23 lines
620 B
Nim
Raw 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):
fieldsList.add(name(FieldType) & " " & fieldName & fieldCaseDisciminator)
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"]