summary refs log tree commit diff stats
path: root/tests/destructor
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-06-20 07:40:45 +0200
committerGitHub <noreply@github.com>2019-06-20 07:40:45 +0200
commitc65a5d754b791dfad72420fa27cfe933c6a7782c (patch)
treeb146a231876a8351ba586912ee867c121ac6218c /tests/destructor
parent1a074fffa421b6cab0357e86d1011cc39eafcc61 (diff)
downloadNim-c65a5d754b791dfad72420fa27cfe933c6a7782c.tar.gz
[bugfix] owned closures (#11544)
Diffstat (limited to 'tests/destructor')
-rw-r--r--tests/destructor/tuse_ownedref_after_move.nim2
-rw-r--r--tests/destructor/twidgets.nim2
-rw-r--r--tests/destructor/twidgets_unown.nim6
3 files changed, 6 insertions, 4 deletions
diff --git a/tests/destructor/tuse_ownedref_after_move.nim b/tests/destructor/tuse_ownedref_after_move.nim
index 148696ee2..34b2f92e4 100644
--- a/tests/destructor/tuse_ownedref_after_move.nim
+++ b/tests/destructor/tuse_ownedref_after_move.nim
@@ -1,6 +1,6 @@
 discard """
   cmd: '''nim c --newruntime $file'''
-  errormsg: "'=' is not available for type <owned Widget>; requires a copy because it's not the last read of ':env.b1()'; another read is done here: tuse_ownedref_after_move.nim(53, 4)"
+  errormsg: "'=' is not available for type <owned Widget>; requires a copy because it's not the last read of ':envAlt.b1()'; another read is done here: tuse_ownedref_after_move.nim(53, 4)"
   line: 49
 """
 
diff --git a/tests/destructor/twidgets.nim b/tests/destructor/twidgets.nim
index 64fe8ab96..1d75a803d 100644
--- a/tests/destructor/twidgets.nim
+++ b/tests/destructor/twidgets.nim
@@ -63,7 +63,7 @@ proc main =
   var b = newButton("button", nil)
   let u: Button = b
   b.onclick = proc () =
-    b.caption = "clicked!"
+    u.caption = "clicked!"
   w.add b
 
   w.draw()
diff --git a/tests/destructor/twidgets_unown.nim b/tests/destructor/twidgets_unown.nim
index 5e53a0e5b..39d3c46df 100644
--- a/tests/destructor/twidgets_unown.nim
+++ b/tests/destructor/twidgets_unown.nim
@@ -2,7 +2,7 @@ discard """
   cmd: '''nim c --newruntime $file'''
   output: '''button
 clicked!
-3 3  alloc/dealloc pairs: 0'''
+6 6  alloc/dealloc pairs: 0'''
 """
 
 import core / allocators
@@ -52,8 +52,10 @@ proc main =
 
   var b = newButton("button", nil)
   let u = unown b
+  var clicked = "clicked"
   b.onclick = proc () =
-    b.caption = "clicked!"
+    clicked.add "!"
+    u.caption = clicked
   w.add b
 
   w.draw()