Sha256: b96bac6e60b6c88556591e7f554e2b63873f0fc193adae7d6962b762c9f1ef91

Contents?: true

Size: 771 Bytes

Versions: 1

Compression:

Stored size: 771 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

context "Extension with constructors out the whazoo" do

  specify "should make constructors available" do
    Extension.new "constructors" do |e|
      e.sources full_dir("headers/constructors.h")
      node = e.namespace "constructors"


      node.classes("DoubleStringHolder").use_constructor(
        node.classes("DoubleStringHolder").constructors.find(:arguments => [nil, nil])
      )
    end

    require 'constructors'

    should.not.raise NameError do
      # Test complex constructors
      d = DoubleStringHolder.new("one", "two")
      one = d.get_one
      d.get_one.should == "one"
      d.get_two.should == "two"
    end
    
    should.raise TypeError do
      PrivateConstructor.new
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbplusplus-0.9 test/constructors_test.rb