Sha256: fd37913bb1979c4b835d0c4277ddaa969e12b0f0bd805f633fe8db0ce79899e9

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 Bytes

Contents

require 'test_helper'

describe "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'

    # Test complex constructors
    d = DoubleStringHolder.new("one", "two")
    one = d.get_one
    d.get_one.should == "one"
    d.get_two.should == "two"

    lambda do
      PrivateConstructor.new
    end.should raise_error(TypeError)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbplusplus-1.4.0 test/constructors_test.rb