diff tests/test_storage.nim @ 1468:cbca94a95736

add: custom serialization
author sam <sam@basx.dev>
date Tue, 01 Apr 2025 00:26:14 +0700
parents 7b2ec9f3d0f6
children 63364723d460
line wrap: on
line diff
--- a/tests/test_storage.nim	Wed Mar 26 23:40:05 2025 +0700
+++ b/tests/test_storage.nim	Tue Apr 01 00:26:14 2025 +0700
@@ -19,7 +19,11 @@
     value: int
 
   type Obj2 = object
-    value: string
+    a: string
+    b: Obj1
+    c: seq[int]
+    d: array[3, Obj1]
+    e: bool
 
   assert listWorlds().len == 0
 
@@ -28,7 +32,13 @@
   assert listWorlds() == @["testWorld"]
   assert loadWorld[Obj1]("testWorld") == obj1
 
-  const obj2 = Obj2(value: "Hello world")
+  const obj2 = Obj2(
+    a: "Hello world",
+    b: Obj1(value: 20),
+    c: @[1, 2, 3, 4],
+    d: [Obj1(value: 1), Obj1(value: 2), Obj1(value: 3)],
+    e: true,
+  )
   "testWorld".storeWorld(obj2)
   assert listWorlds() == @["testWorld"]
   assert loadWorld[Obj2]("testWorld") == obj2