test/subclass_test.rb in rbplusplus-0.8 vs test/subclass_test.rb in rbplusplus-0.9
- old
+ new
@@ -3,29 +3,39 @@
context "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
- e.module("Sub") do |m|
- node.classes.each do |c|
- m.includes c
- end
- end
+
+ # 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") )
end
require 'subclass'
+
+ # Ignored superclasses should not cause problems with wrapped subclasses
should.not.raise NameError do
- Sub::Base.new.one.should == Sub::Sub.new.one
- Sub::Base.new.zero.should == Sub::Sub.new.zero
+ Base.new.one.should == Sub.new.one
+ Base.new.zero.should == Sub.new.zero
end
+
+ # Template superclasses shouldn't cause problems
should.not.raise NameError do
- Sub::TemplateSub.new.zero.should == Sub::TemplateSub.new.custom
+ TemplateSub.new.zero.should == TemplateSub.new.custom
end
+
should.not.raise NameError do
- Sub::TemplatePtr.new.custom
+ TemplatePtr.new.custom
end
+
+ should.not.raise NameError do
+ Multiple.new
+ end
+
+ Multiple.superclass.should.equal Base2
end
end