Sha256: 4ddf448e63062859ff284b288412653365e3300396ad786d59d942fee3211d4b

Contents?: true

Size: 756 Bytes

Versions: 3

Compression:

Stored size: 756 Bytes

Contents

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

describe GLib::HashTable do
  it "knows its key and value types" do
    hsh = GLib::HashTable.new :gint32, :utf8
    assert_equal :gint32, hsh.key_type
    assert_equal :utf8, hsh.value_type
  end

  describe "::from_hash" do
    it "creates a GHashTable from a Ruby array" do
      hsh = GLib::HashTable.from_hash :utf8, :gint32,
        {"foo" => 23, "bar" => 32}
      assert_equal({"foo" => 23, "bar" => 32}, hsh.to_hash)
    end

    it "return its argument if given a GHashTable" do
      hsh = GLib::HashTable.from_hash :utf8, :gint32, {"foo" => 23, "bar" => 32}
      hsh2 = GLib::HashTable.from_hash :utf8, :gint32, hsh
      assert_equal hsh, hsh2
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.2.2 test/ffi-glib/hash_table_test.rb
gir_ffi-0.2.1 test/ffi-glib/hash_table_test.rb
gir_ffi-0.2.0 test/ffi-glib/hash_table_test.rb