Sha256: 5b964689dc35388fd712515ce9a7cf8ad97f18037f98765a9756a5b005052c2c

Contents?: true

Size: 1015 Bytes

Versions: 24

Compression:

Stored size: 1015 Bytes

Contents

require 'test/unit'

require 'rd/rdblockparser.tab'
require 'rd/rd-struct'

include RD

class TestParserUtil < Test::Unit::TestCase
  def setup
    @p = RDParser.new
    @tree = tree = Tree.new_with_document_struct(DocumentStructure::RD)
    @p.instance_eval do
      @tree = tree
    end
  end

  def test_tree
    obj = Object.new
    obj.extend(ParserUtility)

    assert_raises(NotImplementedError) do
      obj.tree
    end
  end

  def test_add_children_to_element
    headline = Headline.new(1)
    string_element = StringElement.new "string"
    emphasis = Emphasis.new
    @p.add_children_to_element(headline, string_element, emphasis)
    assert_equal([string_element, emphasis], headline.children)

    textblock = TextBlock.new
    @p.add_children_to_element(textblock, emphasis, string_element)
    assert_equal([emphasis, string_element], textblock.children)

    textblock_empty = TextBlock.new
    @p.add_children_to_element(textblock_empty)
    assert_equal([], textblock_empty.children)
  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-parser-util.rb
tdiary-5.0.8 vendor/bundle/gems/rdtool-0.6.38/test/test-parser-util.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rdtool-0.6.38/test/test-parser-util.rb
tdiary-5.0.5 vendor/bundle/gems/rdtool-0.6.38/test/test-parser-util.rb
tdiary-5.0.4 vendor/bundle/gems/rdtool-0.6.38/test/test-parser-util.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/rdtool-0.6.38/test/test-parser-util.rb
tdiary-3.2.2.20130518 vendor/rdtool-0.6.38/test/test-parser-util.rb
tdiary-3.2.2.20130508 vendor/rdtool-0.6.38/test/test-parser-util.rb
tdiary-3.2.2.20130507 vendor/rdtool-0.6.38/test/test-parser-util.rb
rdtool-0.6.38 test/test-parser-util.rb
rdtool-0.6.37 test/test-parser-util.rb
rdtool-0.6.36 test/test-parser-util.rb
rdtool-0.6.35 test/test-parser-util.rb
rdtool-0.6.34 test/test-parser-util.rb
rdtool-0.6.33 test/test-parser-util.rb
rdtool-0.6.32 test/test-parser-util.rb
rdtool-0.6.31 test/test-parser-util.rb
rdtool-0.6.30 test/test-parser-util.rb
rdtool-0.6.29 test/test-parser-util.rb
rdtool-0.6.28 test/test-parser-util.rb