summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorDanil Yarantsev <tiberiumk12@gmail.com>2022-04-25 12:15:03 +0300
committerGitHub <noreply@github.com>2022-04-25 11:15:03 +0200
commit2f32b450d39030c287df4d56be9d06473772f5cd (patch)
tree4c634f5ab10090c3961f12fa1b301eb74e127f87 /tests
parentefaa6777a464b94d88cb948390397b490ccee5b8 (diff)
downloadNim-2f32b450d39030c287df4d56be9d06473772f5cd.tar.gz
Really fix StringStream with ARC at compile-time, improve streams test (#19739)
* Fix compile-time StringStream with ARC

* make readDataStr work with ARC, improve test
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tstreams.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/stdlib/tstreams.nim b/tests/stdlib/tstreams.nim
index 6fda30f51..d9857926e 100644
--- a/tests/stdlib/tstreams.nim
+++ b/tests/stdlib/tstreams.nim
@@ -1,4 +1,5 @@
 discard """
+  matrix: "--gc:refc; --gc:arc"
   input: "Arne"
   output: '''
 Hello! What is your name?
@@ -74,9 +75,13 @@ block:
   doAssert(ss.peekLine(str))
   doAssert(str == "uick brown fox jumped over the lazy dog.")
   doAssert(ss.getPosition == 5) # haven't moved
-  ss.setPosition(0) # Ensure we dont error with writing over literals on arc/orc #19707
+  # bug #19707 - Ensure we dont error with writing over literals on arc/orc
+  ss.setPosition(0)
   ss.write("hello")
+  ss.setPosition(0)
+  doAssert(ss.peekStr(5) == "hello")
 
+# bug #19716
 static: # Ensure streams it doesnt break with nimscript on arc/orc #19716
   let s = newStringStream("a")
-  discard s.data
+  doAssert s.data == "a"