Please review pull request #151: (#12012) Fix ENV['LANG'] spec tests on Windows opened by (joshcooper)
Description:
Previously, the tests were failing because there isn't an echo.exe
on Windows.
This commit just wraps the command in a cmd.exe shell and expands
the variables using %LANG% syntax on Windows.
- Opened: Sat Jan 21 18:51:42 UTC 2012
- Based on: puppetlabs:master (362adf5d0eb2edccf5f14375d35c485208d644ae)
- Requested merge: joshcooper:ticket/master/12012-env-lang-windows (c93922c26fb8248529ebfd8999e17277f295e697)
Diff follows:
diff --git a/spec/unit/util/resolution_spec.rb b/spec/unit/util/resolution_spec.rb
index f308738..b775639 100755
--- a/spec/unit/util/resolution_spec.rb
+++ b/spec/unit/util/resolution_spec.rb
@@ -342,16 +342,22 @@
end
it "should execute the binary" do
- Facter::Util::Resolution.exec("echo foo").should == "foo"
+ Facter::Util::Resolution.exec(
+ Facter::Util::Config.is_windows? ? 'cmd.exe /c "echo foo"' : 'echo foo'
+ ).should == "foo"
end
it "should override the LANG environment variable" do
- Facter::Util::Resolution.exec("echo $LANG").should == "C"
+ Facter::Util::Resolution.exec(
+ Facter::Util::Config.is_windows? ? 'cmd.exe /c "echo %LANG%"' : 'echo $LANG'
+ ).should == "C"
end
it "should respect other overridden environment variables" do
Facter::Util::Resolution.with_env( {"FOO" => "foo"} ) do
- Facter::Util::Resolution.exec("echo $FOO").should == "foo"
+ Facter::Util::Resolution.exec(
+ Facter::Util::Config.is_windows? ? 'cmd.exe /c "echo %FOO%"' : 'echo $FOO'
+ ).should == "foo"
end
end
end
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
