Sha256: 0699bf71d24bc0be52de57daed932126c521739b63521b7bedefb2ddcea9a4b0

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

describe "Extension with class hierachies" do

  specify "should make super classes methods available" do
    Extension.new "subclass" do |e|
      e.sources full_dir("headers/subclass.h")

      node = e.namespace "subclass"
      node.classes("SuperSuper").ignore

      # Rice doesn't support multiple-inheritance (neither does Ruby), so for now
      # until we can fake it, force people to specify
      node.classes("Multiple").use_superclass( node.classes("Base2") )

      node.classes.implicit_casting(false)
    end

    require 'subclass'

    # Ignored superclasses should not cause problems with wrapped subclasses
    Base.new.one.should == Sub.new.one
    Base.new.zero.should == Sub.new.zero

    # Template superclasses shouldn't cause problems
    TemplateSub.new.zero.should == TemplateSub.new.custom

    lambda do
      TemplatePtr.new.custom
    end.should_not raise_error(NameError)

    lambda do
      Multiple.new
    end.should_not raise_error(NameError)

    Multiple.superclass.should == Base2
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rbplusplus-1.3.0 test/subclass_test.rb
rbplusplus-1.2.1 test/subclass_test.rb
rbplusplus-1.2.0 test/subclass_test.rb
rbplusplus-1.1.0 test/subclass_test.rb
rbplusplus-1.0.3 test/subclass_test.rb
rbplusplus-1.0.1 test/subclass_test.rb