Sha256: 32f75205a98e288ef86c920227b9fd445d46ad6559bc957e12b33e69ff3d023d

Contents?: true

Size: 684 Bytes

Versions: 6

Compression:

Stored size: 684 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
require 'virtualbox/ext/subclass_listing'

class SubclassListingTest < Test::Unit::TestCase
  class A
    include VirtualBox::SubclassListing
  end
  class B < A; end
  class C < B; end
  class D < A; end
  class E
    include VirtualBox::SubclassListing
  end
  class F < E; end
  
  should "list subclasses, including sub-subclasses, etc" do
    assert_equal [F], E.subclasses
    assert_equal [C], B.subclasses
    assert_equal [B, C, D], A.subclasses.sort_by { |c| c.name }
  end
  
  should "list direct subclasses if flag is set" do
    assert_equal [B, D], A.subclasses(true).sort_by { |c| c.name }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
virtualbox-0.4.1 test/virtualbox/ext/subclass_listing_test.rb
virtualbox-0.4.0 test/virtualbox/ext/subclass_listing_test.rb
virtualbox-0.3.0 test/virtualbox/ext/subclass_listing_test.rb
virtualbox-0.2.0 test/virtualbox/ext/subclass_listing_test.rb
virtualbox-0.1.1 test/virtualbox/ext/subclass_listing_test.rb
virtualbox-0.1.0 test/virtualbox/ext/subclass_listing_test.rb