summary refs log tree commit diff stats
path: root/tests/arc/topt_cursor.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-07-17 15:24:36 +0200
committerGitHub <noreply@github.com>2020-07-17 15:24:36 +0200
commitd4984e069adc1984c2f67d073ebb7c42873c4d08 (patch)
treefec769ace2500b0caa458816c8098ed287eb52d6 /tests/arc/topt_cursor.nim
parentc2f80de1c74c673ab9d3459d1f86fb9fe4366f61 (diff)
downloadNim-d4984e069adc1984c2f67d073ebb7c42873c4d08.tar.gz
arc: cursors for simple for loop variables (#15008)
* arc: cursors for simple for loop variables

* merged devel
Diffstat (limited to 'tests/arc/topt_cursor.nim')
-rw-r--r--tests/arc/topt_cursor.nim27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/arc/topt_cursor.nim b/tests/arc/topt_cursor.nim
index 63f261877..a8020e72b 100644
--- a/tests/arc/topt_cursor.nim
+++ b/tests/arc/topt_cursor.nim
@@ -1,6 +1,6 @@
 discard """
   output: '''("string here", 80)'''
-  cmd: '''nim c --gc:arc --expandArc:main --hint:Performance:off $file'''
+  cmd: '''nim c --gc:arc --expandArc:main --expandArc:sio --hint:Performance:off $file'''
   nimout: '''--expandArc: main
 
 var
@@ -19,6 +19,24 @@ try:
     :tmpD_2]
 finally:
   `=destroy`(:tmpD_2)
+-- end of expandArc ------------------------
+--expandArc: sio
+
+block :tmp:
+  var x_cursor
+  var f = open("debug.txt", fmRead, 8000)
+  try:
+    var res
+    try:
+      res = TaintedString(newStringOfCap(80))
+      block :tmp_1:
+        while readLine(f, res):
+          x_cursor = res
+          echo [x_cursor]
+    finally:
+      `=destroy`(res)
+  finally:
+    close(f)
 -- end of expandArc ------------------------'''
 """
 
@@ -33,3 +51,10 @@ proc main(cond: bool) =
   echo x
 
 main(false)
+
+proc sio =
+  for x in lines("debug.txt"):
+    echo x
+
+if false:
+  sio()