Sha256: d7f62c2e9dfa96a40930791514c4cd9c0e35c63b9175d6b4143b800bcc451db2

Contents?: true

Size: 1.85 KB

Versions: 34

Compression:

Stored size: 1.85 KB

Contents

# Copyright (C) 2015  Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
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

34 entries across 26 versions & 2 rubygems

Version Path
savant-echo-1.0.4 bin/packaging/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-1.0.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
glib2-3.1.1-x64-mingw32 test/test_key_file.rb
glib2-3.1.1-x86-mingw32 test/test_key_file.rb
glib2-3.1.1 test/test_key_file.rb
savant-echo-1.0.1 bin/packaging/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-1.0.1 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.91 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.91 bin/packaging/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.9 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.9 bin/packaging/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.6 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.6 bin/packaging/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.5 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.5 bin/packaging/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.4 bin/packaging/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.3 bin/packaging/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
savant-echo-0.1.3 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/glib2-3.1.0/test/test_key_file.rb
glib2-3.1.0-x64-mingw32 test/test_key_file.rb