summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorRuslan Mustakov <r.mustakov@gmail.com>2016-09-16 17:02:34 +0700
committerRuslan Mustakov <r.mustakov@gmail.com>2016-09-16 17:02:34 +0700
commite26f9cb66548dec09a9ead0297bcbac89ba5d2c0 (patch)
tree77d947a1e862a7146708e7f6cb0da6a140ea3dd6 /tests/stdlib
parent0531658c00c9d1a0d7ee5bb514888923f4891fbf (diff)
downloadNim-e26f9cb66548dec09a9ead0297bcbac89ba5d2c0.tar.gz
Use array encoding for non-UTF-8 strings in marshal. Fixes #4779.
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/tmarshal.nim12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/stdlib/tmarshal.nim b/tests/stdlib/tmarshal.nim
index 4c0c10360..b05cb5a10 100644
--- a/tests/stdlib/tmarshal.nim
+++ b/tests/stdlib/tmarshal.nim
@@ -1,5 +1,7 @@
 discard """
-  output: '''{"age": 12, "name": "Cletus"}'''
+  output: '''{"age": 12, "bio": "\u042F Cletus", "blob": [65, 66, 67, 128], "name": "Cletus"}
+true
+true'''
 """
 
 import marshal
@@ -72,6 +74,12 @@ type
 
   Person = object of Entity
     age: int
+    bio: string
+    blob: string
 
-var instance1 = Person(name: "Cletus", age: 12)
+var instance1 = Person(name: "Cletus", age: 12,
+                       bio: "Я Cletus",
+                       blob: "ABC\x80")
 echo($$instance1)
+echo(to[Person]($$instance1).bio == instance1.bio)
+echo(to[Person]($$instance1).blob == instance1.blob)