about summary refs log tree commit homepage
path: root/test/test_msgthr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_msgthr.rb')
-rw-r--r--test/test_msgthr.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/test_msgthr.rb b/test/test_msgthr.rb
index 19441c8..19cec75 100644
--- a/test/test_msgthr.rb
+++ b/test/test_msgthr.rb
@@ -10,11 +10,27 @@ class TestMsgthr < Test::Unit::TestCase
     thr.add('b', %w(c), 'B')
     thr.add('c', nil, 'c')
     thr.add('D', nil, 'D')
-    thr.add('d', nil, 'd')
+    thr.add('d', %w(missing), 'd')
     thr.thread!
     rootset = thr.order! { |c| c.sort_by!(&:mid) }
-    assert_equal %w(D c d), rootset.map(&:mid)
+    assert_equal %w(D c missing), rootset.map(&:mid)
     assert_equal 'D', rootset[0].msg
     assert_equal %w(b), rootset[1].children.map(&:mid)
+    out = ''.b
+    thr.walk_thread do |level, container, index|
+      msg = container.msg
+      summary = msg ? msg : "[missing: <#{container.mid}>]"
+      indent = '  ' * level
+      out << sprintf("#{indent} % 3d. %s\n", index, summary)
+    end
+    exp = <<EOF.b
+   0. D
+   1. c
+     0. B
+       0. abc
+   2. [missing: <missing>]
+     0. d
+EOF
+    assert_equal exp, out
   end
 end