Sha256: 749cd25d8df8d95864ef50da2168a880776a3a06c8787f01c0c3b88147405013

Contents?: true

Size: 774 Bytes

Versions: 7

Compression:

Stored size: 774 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'

    lambda 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_not raise_error(NameError)
    
    lambda do
      PrivateConstructor.new
    end.should raise_error(TypeError)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

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