Sha256: 6d3225fb63214e52e8cd1ce11b2456ab01a2f60e016f291b0403096a6fdc0a42

Contents?: true

Size: 647 Bytes

Versions: 3

Compression:

Stored size: 647 Bytes

Contents

require 'test_helper'

describe "Function pointers into class methods" do

  before(:all) do
    Extension.new "function_pointers_class" do |e|
      e.sources full_dir("headers/function_pointers_class.h")
      node = e.namespace "function_pointers_class"
    end

    require 'function_pointers_class'
  end


  specify "works" do
    t = PointerTest.new
    t.set_callback do |i|
      42
    end

    t.call_callback(12).should == 42
  end

  specify "keeps the block marked in the GC" do
    t = PointerTest.new
    t.set_callback do |i|
      14
    end

    t.call_callback(12)

    GC.start

    t.call_callback(12).should == 14
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rbplusplus-1.4.0 test/function_pointers_classes_test.rb
rbplusplus-1.3.0 test/function_pointers_classes_test.rb
rbplusplus-1.2.1 test/function_pointers_classes_test.rb