Sha256: f475ee5506d534d046adca6222159fefb58683de366e1887a0f15920b1e1e22f

Contents?: true

Size: 984 Bytes

Versions: 24

Compression:

Stored size: 984 Bytes

Contents

require 'test/unit'

require 'rd/element'
require 'rd/rd-struct'

include RD

class TestDocumentElement < Test::Unit::TestCase
  def setup
    @p = DocumentElement.new
    @c1 = Headline.new(1)
    @c2 = TextBlock.new
    @c3 = ItemList.new
    @c31 = ItemListItem.new
    @c311 = TextBlock.new
    @c31.add_child_under_document_struct(@c311, DocumentStructure::RD)
    @c3.add_child_under_document_struct(@c31, DocumentStructure::RD)
    @p.add_children_under_document_struct([@c1, @c2, @c3],
                                            DocumentStructure::RD)
  end
  
  def test_s_new
    assert(DocumentElement.new)
  end

  def test_blocks
    assert_equal([@c1, @c2, @c3], @p.blocks)
  end

  def test_each_block
    i = 1
    @p.each_block do |b|
      assert_equal(eval("@c#{i}"), b)
      i += 1
    end
  end

  def test_each_element
    exp = [@p, @c1, @c2, @c3, @c31, @c311]
    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-document-element.rb
tdiary-5.0.8 vendor/bundle/gems/rdtool-0.6.38/test/test-document-element.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rdtool-0.6.38/test/test-document-element.rb
tdiary-5.0.5 vendor/bundle/gems/rdtool-0.6.38/test/test-document-element.rb
tdiary-5.0.4 vendor/bundle/gems/rdtool-0.6.38/test/test-document-element.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/rdtool-0.6.38/test/test-document-element.rb
tdiary-3.2.2.20130518 vendor/rdtool-0.6.38/test/test-document-element.rb
tdiary-3.2.2.20130508 vendor/rdtool-0.6.38/test/test-document-element.rb
tdiary-3.2.2.20130507 vendor/rdtool-0.6.38/test/test-document-element.rb
rdtool-0.6.38 test/test-document-element.rb
rdtool-0.6.37 test/test-document-element.rb
rdtool-0.6.36 test/test-document-element.rb
rdtool-0.6.35 test/test-document-element.rb
rdtool-0.6.34 test/test-document-element.rb
rdtool-0.6.33 test/test-document-element.rb
rdtool-0.6.32 test/test-document-element.rb
rdtool-0.6.31 test/test-document-element.rb
rdtool-0.6.30 test/test-document-element.rb
rdtool-0.6.29 test/test-document-element.rb
rdtool-0.6.28 test/test-document-element.rb