summary refs log tree commit diff stats
path: root/tests/system
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-10-08 20:49:45 +0200
committerGitHub <noreply@github.com>2019-10-08 20:49:45 +0200
commitf30da2f26628d58274363b527e7099bdd44f707d (patch)
treefaf55a7bfe1e9b59af18cc54a83649fee1359d86 /tests/system
parent00c31e87660d9db813871f5aa23661bf6b9bbdcb (diff)
downloadNim-f30da2f26628d58274363b527e7099bdd44f707d.tar.gz
fixes #12315 [backport]; refs #12314 (#12385)
Diffstat (limited to 'tests/system')
-rw-r--r--tests/system/techo_unicode.nim20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/system/techo_unicode.nim b/tests/system/techo_unicode.nim
index d0395224b..cb7c49c68 100644
--- a/tests/system/techo_unicode.nim
+++ b/tests/system/techo_unicode.nim
@@ -4,7 +4,7 @@ abasdfdsmÄhmaИ
 Иnastystring
 A你好
 ИnastystringA你好
-ÖÜhmabasdfdsmÄhmaИ'''
+ÖÜhmabasdfdsmÄhmaИOK'''
   disabled: "posix"
   joinable: "false"
 """
@@ -13,10 +13,10 @@ import winlean
 
 echo "ÄhmÖÜ"
 echo "abasdfdsmÄhmaИ"
-echo "И\0nasty\0\0\0\0string\0"
+echo "Иnastystring"
 echo "A你好"
 
-write stdout, "И\0nasty\0\0\0\0string\0"
+write stdout, "Иnastystring"
 writeLine stdout, "A你好"
 stdout.flushFile()
 
@@ -25,3 +25,17 @@ var a = "ÖÜhmabasdfdsmÄhmaИ"
 var ac = 0'i32
 discard writeFile(handle, addr a[0], int32(len(a)), addr ac, nil)
 stdout.flushFile()
+
+import os
+
+let str = "some nulls: \0\0\0 (three of them)"
+
+let fpath = getTempDir() / "file_with_nulls.bin"
+
+writeFile(fpath, str)
+
+doAssert(getFileSize(fpath) == 31)
+doAssert(readFile(fpath) == str)
+removeFile(fpath)
+
+echo "OK"