Sha256: c62d9e07d3fc27c6d8cc9f5b182840f42ccf6e5559a8e1ea17cd274226ab0d1b

Contents?: true

Size: 1.09 KB

Versions: 24

Compression:

Stored size: 1.09 KB

Contents

require 'test/unit'

require 'rd/block-element'
require 'rd/inline-element'
require 'rd/rd-struct'

include RD

class TestTextBlock < Test::Unit::TestCase
  def setup
    @p = TextBlock.new
    @c1 = StringElement.new "string"
    @c2 = Emphasis.new
    @c21 = StringElement.new "in emphasis"
    @c2.add_child_under_document_struct(@c21, DocumentStructure::RD)
    @c3 = Code.new
    @c31 = StringElement.new "code"
    @c32 = Var.new
    @c321 = StringElement.new "var"
    @c32.add_child_under_document_struct(@c321, DocumentStructure::RD)
    @c3.add_children_under_document_struct([@c31, @c32], DocumentStructure::RD)
    @c4 = Verb.new "verb"
    @p.add_children_under_document_struct([@c1, @c2, @c3, @c4],
                                          DocumentStructure::RD)
  end

  def test_each_child
    exp = [@c1, @c2, @c3, @c4]
    i = 0
    @p.each_child do |b|
      assert_equal(exp[i], b)
      i += 1
    end
  end

  def test_each_element
    exp = [@p, @c1, @c2, @c21, @c3, @c31, @c32, @c321, @c4]
    i = 0
    @p.each_element do |b|
      assert_equal(exp[i], b)
      i += 1
    end
  end
end

Version data entries

24 entries across 23 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/rdtool-0.6.38/test/test-textblock.rb
tdiary-5.0.8 vendor/bundle/gems/rdtool-0.6.38/test/test-textblock.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rdtool-0.6.38/test/test-textblock.rb
tdiary-5.0.5 vendor/bundle/gems/rdtool-0.6.38/test/test-textblock.rb
tdiary-5.0.4 vendor/bundle/gems/rdtool-0.6.38/test/test-textblock.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/rdtool-0.6.38/test/test-textblock.rb
tdiary-3.2.2.20130518 vendor/rdtool-0.6.38/test/test-textblock.rb
tdiary-3.2.2.20130508 vendor/rdtool-0.6.38/test/test-textblock.rb
tdiary-3.2.2.20130507 vendor/rdtool-0.6.38/test/test-textblock.rb
rdtool-0.6.38 test/test-textblock.rb
rdtool-0.6.37 test/test-textblock.rb
rdtool-0.6.36 test/test-textblock.rb
rdtool-0.6.35 test/test-textblock.rb
rdtool-0.6.34 test/test-textblock.rb
rdtool-0.6.33 test/test-textblock.rb
rdtool-0.6.32 test/test-textblock.rb
rdtool-0.6.31 test/test-textblock.rb
rdtool-0.6.30 test/test-textblock.rb
rdtool-0.6.29 test/test-textblock.rb
rdtool-0.6.28 test/test-textblock.rb