Sha256: 95db580018fa7aba1d6d1f764798b0c582ad6903bca8939d320d8bd016a60e1a

Contents?: true

Size: 1.11 KB

Versions: 31

Compression:

Stored size: 1.11 KB

Contents

# -*- coding: utf-8 -*-

require 'tempfile'

class TestGLibKeyFile < Test::Unit::TestCase
  include GLibTestUtils

  def test_load_from_dirs
    only_glib_version(2, 14, 0)

    key_file = GLib::KeyFile.new
    assert_raise(GLib::KeyFileError::NotFound) do
      key_file.load_from_dirs("non-existent")
    end

    temp = Tempfile.new("key-file")
    base_name = File.basename(temp.path)
    search_dirs = [File.dirname(temp.path)]
    assert_raise(GLib::KeyFileError::NotFound) do
      key_file.load_from_dirs("non-existent", search_dirs)
    end
    if GLib.check_version?(2, 31, 2)
      assert_equal(temp.path, key_file.load_from_dirs(base_name, search_dirs))
    else
      assert_raise(GLib::KeyFileError::NotFound) do
        key_file.load_from_dirs(base_name, search_dirs)
      end
    end
    temp.puts(<<-EOK)
[General]
key = value
EOK
    temp.close
    assert_equal(temp.path, key_file.load_from_dirs(base_name, search_dirs))
  end

  def test_desktop_constants
    only_glib_version(2, 14, 0)
    assert_equal("Desktop Entry", GLib::KeyFile::DESKTOP_GROUP)
    assert_equal("URL", GLib::KeyFile::DESKTOP_KEY_URL)
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
glib2-3.0.5-x64-mingw32 test/test_key_file.rb
glib2-3.0.5-x86-mingw32 test/test_key_file.rb
glib2-3.0.5 test/test_key_file.rb
glib2-3.0.4-x86-mingw32 test/test_key_file.rb
glib2-3.0.4-x64-mingw32 test/test_key_file.rb
glib2-3.0.4 test/test_key_file.rb
glib2-3.0.3-x64-mingw32 test/test_key_file.rb
glib2-3.0.3-x86-mingw32 test/test_key_file.rb
glib2-3.0.3 test/test_key_file.rb
glib2-3.0.2-x86-mingw32 test/test_key_file.rb
glib2-3.0.2-x64-mingw32 test/test_key_file.rb
glib2-3.0.2 test/test_key_file.rb
glib2-3.0.1-x86-mingw32 test/test_key_file.rb
glib2-3.0.1-x64-mingw32 test/test_key_file.rb
glib2-3.0.1 test/test_key_file.rb
glib2-3.0.0-x86-mingw32 test/test_key_file.rb
glib2-3.0.0-x64-mingw32 test/test_key_file.rb
glib2-2.2.5-x64-mingw32 test/test_key_file.rb
glib2-2.2.5-x86-mingw32 test/test_key_file.rb
glib2-2.2.5 test/test_key_file.rb