Sha256: 9be05cc198536be0777595aac6dcbbce255658eca434ecd15c213f6a48ae46a5

Contents?: true

Size: 972 Bytes

Versions: 1

Compression:

Stored size: 972 Bytes

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

    # Shouldn't throw exceptions
    TemplatePtr.new.custom
    Multiple.new
    Multiple.superclass.should == Base2
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbplusplus-1.4.0 test/subclass_test.rb