Please review pull request #686: Maint: Escape command in regexp opened by (joshcooper)

Description:

On 64-bit Windows, the directory for 32-bit applications contains
parentheses: C:/Program Files (x86). The test was using this in a regexp
comparison and failing because the parentheses are metacharcters that
need to be escaped.

This failure was introduced when the fails_on_windows exclude filter
was removed (as Puppet::Util.which now works on Windows).

  • Opened: Thu Apr 19 06:04:37 UTC 2012
  • Based on: puppetlabs:master (88911e04b7e3ade23d4dc67ffcad513878d25250)
  • Requested merge: joshcooper:maint/master/regexp-escape-command (aabbf9e1f097dce9b72f1786b04a3261ee91b2f4)

Diff follows:

diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb
index 3d17928..da850ec 100755
--- a/spec/unit/provider_spec.rb
+++ b/spec/unit/provider_spec.rb
@@ -346,10 +346,10 @@
       parent.commands :sh => command
 
       FileTest.should be_exists parent.command(:sh)
-      parent.command(:sh).should =~ /#{command}$/
+      parent.command(:sh).should =~ /#{Regexp.escape(command)}$/
 
       FileTest.should be_exists child.command(:sh)
-      child.command(:sh).should =~ /#{command}$/
+      child.command(:sh).should =~ /#{Regexp.escape(command)}$/
     end
 
     it "#1197: should find commands added in the same run" do

    

--
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.

Reply via email to