Sha256: bf3a7ce0728e3574b3b322290724e9ef68ead6d67e944c6d006e202ef485f214

Contents?: true

Size: 1.23 KB

Versions: 24

Compression:

Stored size: 1.23 KB

Contents

require 'test/unit'

require 'rd/rbl-suite'
require 'rd/rbl-file'

include RD

class TestRBLSuite < Test::Unit::TestCase
  
  def setup
    @suite = RBLSuite.new(["test/data"])
  end

  def test_get_rbl_file
    assert_equal([], @suite.rbl_files)
    rbl = @suite.get_rbl_file("label.rd")
    assert_equal(rbl, @suite.get_rbl_file("label.rd"))
    assert_equal(1, @suite.rbl_files.size)
  end

  def test_add_rbl_file
    assert_equal([], @suite.rbl_files)
    rbl = @suite.add_rbl_file("label.rd")
    assert_kind_of(RBLFile, rbl)
    assert_equal(1, @suite.rbl_files.size)
    assert_equal("label", @suite.rbl_files[0].filename)
    assert_equal(rbl, @suite.rbl_files[0])

    assert_nothing_raised do
      @suite.add_rbl_file("not-exist-label.rd")
    end
  end

  def test_refer
    assert_equal(["label", "label:0"], @suite.refer("label1", "label.rd"))
    assert_equal(["label2", "Label-0"], @suite.refer("label1", "label2.rd"))
    assert_equal(["label", "label:0"], @suite.refer("label1", "label"))
    assert_equal(["label", "label:1"], @suite.refer("label2", "label.rd"))
    assert_equal(["label", nil], @suite.refer("label3", "label.rd"))
    fns = @suite.rbl_files.collect{|i| i.filename }
    assert_equal(["label", "label2"], fns)
  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-rbl-suite.rb
tdiary-5.0.8 vendor/bundle/gems/rdtool-0.6.38/test/test-rbl-suite.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rdtool-0.6.38/test/test-rbl-suite.rb
tdiary-5.0.5 vendor/bundle/gems/rdtool-0.6.38/test/test-rbl-suite.rb
tdiary-5.0.4 vendor/bundle/gems/rdtool-0.6.38/test/test-rbl-suite.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/rdtool-0.6.38/test/test-rbl-suite.rb
tdiary-3.2.2.20130518 vendor/rdtool-0.6.38/test/test-rbl-suite.rb
tdiary-3.2.2.20130508 vendor/rdtool-0.6.38/test/test-rbl-suite.rb
tdiary-3.2.2.20130507 vendor/rdtool-0.6.38/test/test-rbl-suite.rb
rdtool-0.6.38 test/test-rbl-suite.rb
rdtool-0.6.37 test/test-rbl-suite.rb
rdtool-0.6.36 test/test-rbl-suite.rb
rdtool-0.6.35 test/test-rbl-suite.rb
rdtool-0.6.34 test/test-rbl-suite.rb
rdtool-0.6.33 test/test-rbl-suite.rb
rdtool-0.6.32 test/test-rbl-suite.rb
rdtool-0.6.31 test/test-rbl-suite.rb
rdtool-0.6.30 test/test-rbl-suite.rb
rdtool-0.6.29 test/test-rbl-suite.rb
rdtool-0.6.28 test/test-rbl-suite.rb