aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_inreplace.rb8
-rw-r--r--Library/Homebrew/utils.rb2
2 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/test/test_inreplace.rb b/Library/Homebrew/test/test_inreplace.rb
index ab9659b36..74a5eed65 100644
--- a/Library/Homebrew/test/test_inreplace.rb
+++ b/Library/Homebrew/test/test_inreplace.rb
@@ -6,6 +6,14 @@ class InreplaceTest < Test::Unit::TestCase
s1.change_make_var! "FLAG", "def"
assert_equal "FLAG=def", s1
end
+
+ def test_change_make_var_empty
+ # Replace empty flag
+ s1="FLAG = \nFLAG2=abc"
+ s1.extend(HomebrewInreplaceExtension)
+ s1.change_make_var! "FLAG", "def"
+ assert_equal "FLAG=def\nFLAG2=abc", s1
+ end
def test_change_make_var_append
# Append to flag
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 8c9aaa85d..021a93f01 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -157,7 +157,7 @@ module HomebrewInreplaceExtension
# value with "new_value", or removes the definition entirely.
def change_make_var! flag, new_value
new_value = "#{flag}=#{new_value}"
- gsub! Regexp.new("^#{flag}\\s*=\\s*(.*)$"), new_value
+ gsub! Regexp.new("^#{flag}\\s*=[ \\t]*(.*)$"), new_value
end
# Removes variable assignments completely.
def remove_make_var! flags