test/test_xdg.rb in xdg-0.3.0 vs test/test_xdg.rb in xdg-0.4.0
- old
+ new
@@ -11,66 +11,87 @@
class TestXDG < Test::Unit::TestCase
# Test the standard paths.
- def test_xdg_home
- assert_equal(File.join(Dir.pwd,'home'), XDG.xdg_home)
+ def test_home
+ assert_equal(File.join(Dir.pwd,'home'), XDG.home)
end
- def test_xdg_config_home
- assert_equal(File.join(Dir.pwd,'home/.config'), XDG.xdg_config_home)
+ def test_config_home
+ assert_equal(File.join(Dir.pwd,'home/.config'), XDG.config_home)
end
- def test_xdg_config_dirs
- assert_equal([File.join(Dir.pwd,"etc/xdg")], XDG.xdg_config_dirs)
+ def test_config_dirs
+ assert_equal([File.join(Dir.pwd,"etc/xdg")], XDG.config_dirs)
end
- def test_xdg_data_home
- assert_equal(File.join(Dir.pwd,'home/.local/share'), XDG.xdg_data_home)
+ def test_data_home
+ assert_equal(File.join(Dir.pwd,'home/.local/share'), XDG.data_home)
end
- def test_xdg_data_dirs
- assert_equal([File.join(Dir.pwd,'usr/share')], XDG.xdg_data_dirs)
+ def test_data_dirs
+ assert_equal([File.join(Dir.pwd,'usr/share')], XDG.data_dirs)
end
- def test_xdg_cache_home
- assert_equal(File.join(Dir.pwd,'home/.cache'), XDG.xdg_cache_home)
+ def test_cache_home
+ assert_equal(File.join(Dir.pwd,'home/.cache'), XDG.cache_home)
end
- # Test the file lookups.
+ # Test the find methods.
- def test_xdg_data_file
+ def test_data_find
file = 'foo.dat'
- assert_equal(File.join(Dir.pwd,'home/.local/share', file), XDG.xdg_data_file(file))
+ assert_equal(File.join(Dir.pwd,'home/.local/share', file), XDG.data_find(file))
file = 'bar.dat'
- assert_equal(File.join(Dir.pwd,'usr/share', file), XDG.xdg_data_file(file))
+ assert_equal(File.join(Dir.pwd,'usr/share', file), XDG.data_find(file))
end
- def test_xdg_config_file
+ def test_config_find
file = 'foo.config'
- assert_equal(File.join(Dir.pwd,'home/.config', file), XDG.xdg_config_file(file))
+ assert_equal(File.join(Dir.pwd,'home/.config', file), XDG.config_find(file))
file = 'bar.config'
- assert_equal(File.join(Dir.pwd,'etc/xdg', file), XDG.xdg_config_file(file))
+ assert_equal(File.join(Dir.pwd,'etc/xdg', file), XDG.config_find(file))
end
- def test_xdg_cache_file
+ def test_cache_find
file = 'foo.cache'
- assert_equal(File.join(Dir.pwd,'home/.cache', file), XDG.xdg_cache_file(file))
+ assert_equal(File.join(Dir.pwd,'home/.cache', file), XDG.cache_find(file))
end
+ # Test the glob methods.
+
+ def test_data_glob
+ file = 'foo.dat'
+ assert_equal(File.join(Dir.pwd,'home/.local/share', file), XDG.data_find(file))
+ file = 'bar.dat'
+ assert_equal([File.join(Dir.pwd,'usr/share', file)], XDG.data_glob(file))
+ end
+
+ def test_config_glob
+ file = 'foo.config'
+ assert_equal([File.join(Dir.pwd,'home/.config', file)], XDG.config_glob(file))
+ file = 'bar.config'
+ assert_equal([File.join(Dir.pwd,'etc/xdg', file)], XDG.config_glob(file))
+ end
+
+ def test_cache_glob
+ file = 'foo.cache'
+ assert_equal([File.join(Dir.pwd,'home/.cache', file)], XDG.cache_glob(file))
+ end
+
# Test the working directory variations.
- def test_xdg_config_work
- assert_equal(File.join(Dir.pwd,'.config'), XDG.xdg_config_work)
+ def test_config_work
+ assert_equal(File.join(Dir.pwd,'.config'), XDG.config_work)
end
- def test_xdg_data_work
- assert_equal(File.join(Dir.pwd,'.share'), XDG.xdg_data_work)
+ def test_data_work
+ assert_equal(File.join(Dir.pwd,'.share'), XDG.data_work)
end
- def test_xdg_cache_work
- assert_equal(File.join(Dir.pwd,'.cache'), XDG.xdg_cache_work)
+ def test_cache_work
+ assert_equal(File.join(Dir.pwd,'.cache'), XDG.cache_work)
end
end