Sha256: d0b616a63e607b32996a96d11fb7eaa2aae04f4a9c7749cec8708eb149794b12

Contents?: true

Size: 1.28 KB

Versions: 20

Compression:

Stored size: 1.28 KB

Contents

require 'bitclust'
require 'test/unit'

class TestClassEntry < Test::Unit::TestCase
  def setup
    s = <<HERE
= class Hoge
alias HogeHoge
alias HogeHogeHoge
== Class Methods
--- hoge
= class Bar < Hoge
== Class Methods
--- bar
= class Err < Exception
alias ErrErr
HERE
    @lib, = BitClust::RRDParser.parse(s, 'hoge')
  end

  def test_entries
    assert_equal(['bar', 'hoge'],
                 @lib.fetch_class("Bar").entries(1).map{|e| e.name}.sort)
  end

  def test_aliases
    assert_equal(['HogeHoge', 'HogeHogeHoge'],
                 @lib.fetch_class("Hoge").aliases.map{|e| e.name}.sort)
  end

  def test_aliasof
    assert_equal(nil, @lib.fetch_class("Hoge").aliasof)
    assert_equal("Hoge", @lib.fetch_class("HogeHoge").aliasof.name)
  end

  def test_realname
    assert_equal('Hoge', @lib.fetch_class("Hoge").realname)
    assert_equal('Hoge', @lib.fetch_class("HogeHoge").realname)
  end

  def test_error_class?
    assert(!@lib.fetch_class("Hoge").error_class?)
    assert(@lib.fetch_class("Err").error_class?)
    assert(!@lib.fetch_class("HogeHoge").error_class?)
    assert(@lib.fetch_class("ErrErr").error_class?)
  end

  def test_superclass
    assert('Exception', @lib.fetch_class("Err").superclass.name)
    assert('Exception', @lib.fetch_class("ErrErr").superclass.name)
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
bitclust-core-1.2.5 test/test_entry.rb
bitclust-core-1.2.4 test/test_entry.rb
bitclust-core-1.2.3 test/test_entry.rb
bitclust-core-1.2.2 test/test_entry.rb
bitclust-core-1.2.1 test/test_entry.rb
bitclust-core-1.2.0 test/test_entry.rb
bitclust-core-1.1.1 test/test_entry.rb
bitclust-core-1.1.0 test/test_entry.rb
bitclust-core-1.0.0 test/test_entry.rb
bitclust-core-0.9.6 test/test_entry.rb
bitclust-core-0.9.5 test/test_entry.rb
bitclust-core-0.9.4 test/test_entry.rb
bitclust-core-0.9.3 test/test_entry.rb
bitclust-core-0.9.2 test/test_entry.rb
bitclust-core-0.9.1 test/test_entry.rb
bitclust-core-0.9.0 test/test_entry.rb
bitclust-core-0.8.0 test/test_entry.rb
bitclust-core-0.7.0 test/test_entry.rb
bitclust-core-0.6.0 test/test_entry.rb
bitclust-core-0.5.5 test/test_entry.rb