diff options
author | Dimid Duchovny <dimidd@gmail.com> | 2018-01-23 22:34:22 +0200 |
---|---|---|
committer | Dimid Duchovny <dimidd@gmail.com> | 2018-01-23 22:34:22 +0200 |
commit | 1c701717d10879d492d8b55fb8ca2f1c53d7e13f (patch) | |
tree | 3d79d935e11c880174473583c14438bd4cd09785 /test/test_msgthr.rb | |
parent | c7e0972eb81e53ddbe1def3d6d8439dcb6b907e4 (diff) | |
download | msgthr-1c701717d10879d492d8b55fb8ca2f1c53d7e13f.tar.gz |
The motivation is to allow the client to have a custom code executed, whenever a child is added. Signed-off-by: Dimid Duchovny <dimidd@gmail.com>
Diffstat (limited to 'test/test_msgthr.rb')
-rw-r--r-- | test/test_msgthr.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/test_msgthr.rb b/test/test_msgthr.rb index b14e135..0f31762 100644 --- a/test/test_msgthr.rb +++ b/test/test_msgthr.rb @@ -6,8 +6,15 @@ require 'msgthr' class TestMsgthr < Test::Unit::TestCase def test_msgthr thr = Msgthr.new + parent_child = '' + # Note that C is added after B, + # hence it's message will be empty after adding B + expected_parent_child = '->B' thr.add('a', %w(c b), 'abc') - thr.add('b', %w(c), 'B') + thr.add('b', %w(c), 'B') do |parent, child| + parent_child = "#{parent.msg}->#{child.msg}" + end + assert_equal parent_child, expected_parent_child thr.add('c', nil, 'c') thr.add('D', nil, 'D') thr.add('d', %w(missing), 'd') |