Sha256: 5e430526c22bd78f545f15569d60a9fa4f6b57e69666e72eead2f4776648a096

Contents?: true

Size: 913 Bytes

Versions: 8

Compression:

Stored size: 913 Bytes

Contents

require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))

require 'ffi-glib'

describe "With the GLib overrides" do
  describe "a HashTable provided by the system" do
    before do
      GirFFI.setup :Regress
      @hash = Regress.test_ghash_container_return
    end

    it "has a working #each method" do
      a = {}
      @hash.each {|k, v| a[k] = v}
      a.must_be :==, {"foo" => "bar", "baz" => "bat",
        "qux" => "quux"}
    end

    it "includes Enumerable" do
      GLib::HashTable.must_include Enumerable 
    end

    it "has a working #to_hash method" do
      @hash.to_hash.must_be :==, {"foo" => "bar", "baz" => "bat",
        "qux" => "quux"}
    end
  end

  describe "HashTable" do
    it "allows key-value pairs to be inserted" do
      h = GLib::HashTable.new :utf8, :utf8
      h.insert "foo", "bar"
      h.to_hash.must_be :==, {"foo" => "bar"}
    end
  end
end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gir_ffi-0.4.0 test/ffi-glib/glib_overrides_test.rb
gir_ffi-0.3.2 test/ffi-glib/glib_overrides_test.rb
gir_ffi-0.3.1 test/ffi-glib/glib_overrides_test.rb
gir_ffi-0.3.0 test/ffi-glib/glib_overrides_test.rb
gir_ffi-0.2.3 test/ffi-glib/glib_overrides_test.rb
gir_ffi-0.2.2 test/ffi-glib/glib_overrides_test.rb
gir_ffi-0.2.1 test/ffi-glib/glib_overrides_test.rb
gir_ffi-0.2.0 test/ffi-glib/glib_overrides_test.rb