Sha256: a77fec7edecd7d24e87a46a6eb71fe906214ee5c47eb88c40dc2f3f9429065b7

Contents?: true

Size: 1.23 KB

Versions: 24

Compression:

Stored size: 1.23 KB

Contents

require 'test/unit'

require 'temp-dir'

require 'rd/output-format-visitor'
require 'rd/tree'
require 'rd/element'
require 'rd/block-element'
require 'rd/inline-element'
require 'rd/rd-struct'

include RD

class TestOFVisitor < Test::Unit::TestCase
  def setup
  end

  def test_initialize
    vis = OutputFormatVisitor.new
    assert_equal([], vis.include_suffix)
    vis = SampleVisitor.new
    assert_equal(["html"], vis.include_suffix)    
  end

  def test_apply_to_include
    tree = Tree.new_with_document_struct(DocumentStructure::RD,
                                         ["test/data/sub", "test/data/"])
    de = DocumentElement.new
    # test/data/includee1.html
    inc1 = Include.new("includee1")
    # test/data/includee2.html, test/data/sub/includee2.html
    inc2 = Include.new("includee2")
    # test/data/includee3.nothtml
    inc3 = Include.new("includee3")
    tree.root = de
    de.add_child(inc1)
    de.add_child(inc2)
    de.add_child(inc3)
    vis = SampleVisitor.new
    assert_equal("includee1.html", vis.apply_to_Include(inc1))
    assert_equal("sub/includee2.html", vis.apply_to_Include(inc2))
    assert_equal(nil, vis.apply_to_Include(inc3))
  end
end

class SampleVisitor < OutputFormatVisitor
  INCLUDE_SUFFIX = ["html"]
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-output-format-visitor.rb
tdiary-5.0.8 vendor/bundle/gems/rdtool-0.6.38/test/test-output-format-visitor.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rdtool-0.6.38/test/test-output-format-visitor.rb
tdiary-5.0.5 vendor/bundle/gems/rdtool-0.6.38/test/test-output-format-visitor.rb
tdiary-5.0.4 vendor/bundle/gems/rdtool-0.6.38/test/test-output-format-visitor.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/rdtool-0.6.38/test/test-output-format-visitor.rb
tdiary-3.2.2.20130518 vendor/rdtool-0.6.38/test/test-output-format-visitor.rb
tdiary-3.2.2.20130508 vendor/rdtool-0.6.38/test/test-output-format-visitor.rb
tdiary-3.2.2.20130507 vendor/rdtool-0.6.38/test/test-output-format-visitor.rb
rdtool-0.6.38 test/test-output-format-visitor.rb
rdtool-0.6.37 test/test-output-format-visitor.rb
rdtool-0.6.36 test/test-output-format-visitor.rb
rdtool-0.6.35 test/test-output-format-visitor.rb
rdtool-0.6.34 test/test-output-format-visitor.rb
rdtool-0.6.33 test/test-output-format-visitor.rb
rdtool-0.6.32 test/test-output-format-visitor.rb
rdtool-0.6.31 test/test-output-format-visitor.rb
rdtool-0.6.30 test/test-output-format-visitor.rb
rdtool-0.6.29 test/test-output-format-visitor.rb
rdtool-0.6.28 test/test-output-format-visitor.rb