diff options
Diffstat (limited to 'test/util/utiltest.rb')
-rwxr-xr-x | test/util/utiltest.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb index 07023d138..f0a91c49e 100755 --- a/test/util/utiltest.rb +++ b/test/util/utiltest.rb @@ -331,6 +331,32 @@ class TestPuppetUtil < Test::Unit::TestCase output = Puppet::Util.execute([patricidecommand], :failonfail => false) end end + + def test_lang_environ_in_execute + orig_lang = ENV["LANG"] + orig_lc_all = ENV["LC_ALL"] + orig_lc_messages = ENV["LC_MESSAGES"] + orig_language = ENV["LANGUAGE"] + + # Mmm, we love gettext(3) + ENV["LANG"] = "en_US" + ENV["LC_ALL"] = "en_US" + ENV["LC_MESSAGES"] = "en_US" + ENV["LANGUAGE"] = "en_US" + + %w{LANG LC_ALL LC_MESSAGES LANGUAGE}.each do |env| + assert_equal 'C', + Puppet::Util.execute(['ruby', '-e', "print ENV['#{env}']"]), + "Environment var #{env} wasn't set to 'C'" + + assert_equal 'en_US', ENV[env], "Environment var #{env} not set back correctly" + end + + ENV["LANG"] = orig_lang + ENV["LC_ALL"] = orig_lc_all + ENV["LC_MESSAGES"] = orig_lc_messages + ENV["LANGUAGE"] = orig_lc_messages + end # Check whether execute() accepts strings in addition to arrays. def test_string_exec |