Sha256: 9c025767f7b7fb266fcad7c22a49e638a422e0f89d62cd61b29902e8640af08a

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

require 'shoulda'
require 'ffi'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

# Since the tests will call Gtk+ functions, Gtk+ must be initialized.
module DummyGtk
  module Lib
    extend FFI::Library

    ffi_lib "gtk-x11-2.0"
    attach_function :gtk_init, [:pointer, :pointer], :void
  end

  def self.init
    Lib.gtk_init nil, nil
  end
end

DummyGtk.init

# Need a dummy module for some tests.
module Lib
end

class Test::Unit::TestCase
  def cws code
    code.gsub(/(^\s*|\s*$)/, "")
  end

  def get_function_introspection_data namespace, function
    GirFFI::IRepository.default.require namespace, nil
    GirFFI::Builder.send :function_introspection_data, namespace, function
  end

  def get_method_introspection_data namespace, klass, function
    GirFFI::IRepository.default.require namespace, nil
    GirFFI::Builder.send :method_introspection_data, namespace, klass, function
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gir_ffi-0.0.1 test/test_helper.rb