From d589c5646d48619f56edd7858475f2dd5c56dd33 Mon Sep 17 00:00:00 2001 From: Tsur Date: Sat, 28 Jan 2017 19:39:48 +0200 Subject: [PATCH 1/2] fix a bug in unbind! operator --- src/operators.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operators.jl b/src/operators.jl index 6d52a53..e344b82 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -297,7 +297,7 @@ function unbind!(a::Signal, b::Signal, twoway=true) end action = _bindings[a=>b] - a.actions = filter(x->x!=action, a.actions) + b.actions = filter(x->x!=action, b.actions) delete!(_bindings, a=>b) if twoway From 8e1107f5d21c06152de9c2ef1fb5325eee326151 Mon Sep 17 00:00:00 2001 From: tsurh Date: Sun, 29 Jan 2017 00:17:32 +0200 Subject: [PATCH 2/2] Added test for signal binding and unbinding --- test/basics.jl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/basics.jl b/test/basics.jl index d6952ca..ac90457 100644 --- a/test/basics.jl +++ b/test/basics.jl @@ -229,4 +229,22 @@ facts("Basic checks") do step() @fact value(y) --> 1 end + + + context("bindind") do + x = Signal(0) + y = Signal(0) + bind!(y,x,false) + + push!(x,1000) + step() + + @fact value(y) --> 1000 + + unbind!(y,x,false) + push!(x,0) + step() + + @fact value(y) --> 1000 + end end