Skip to content

Commit

Permalink
Fix [Bug#28094] default_path_rules() breaks global $LOAD_PATH. By Tat…
Browse files Browse the repository at this point in the history
…suki Sugiura.
  • Loading branch information
mutoh committed Jul 4, 2010
1 parent eac3e5a commit 9ed5652
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/gettext/runtime/locale_path.rb
Expand Up @@ -49,8 +49,8 @@ def default_path_rules
}
end
default_path_rules += DEFAULT_RULES
load_path = $LOAD_PATH

load_path = $LOAD_PATH.dup
if defined? ::Gem
load_path += Gem.all_load_paths
end
Expand Down
8 changes: 8 additions & 0 deletions test/test_locale_path.rb
Expand Up @@ -53,6 +53,7 @@ def test_env_GETTEXT_PATH
path1 = File.join(topdir, "locale")
path2 = File.join(topdir, "cgi", "locale")

GetText::LocalePath.memoize_clear
ENV["GETTEXT_PATH"] = path1
default_path_rules = GetText::LocalePath.default_path_rules
assert(Regexp.compile(path1) =~ default_path_rules[0])
Expand All @@ -63,4 +64,11 @@ def test_env_GETTEXT_PATH
assert(Regexp.compile(path1) =~ default_path_rules[0])
assert(Regexp.compile(path2) =~ default_path_rules[1])
end

def test_default_path_rules
GetText::LocalePath.memoize_clear
$LOAD_PATH.unshift("./lib")
default_path_rules = GetText::LocalePath.default_path_rules
assert_equal($LOAD_PATH[0], "./lib")
end
end

0 comments on commit 9ed5652

Please sign in to comment.