aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/test/test_inreplace.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_inreplace.rb b/Library/Homebrew/test/test_inreplace.rb
index 5b226eb8d..5a477be48 100644
--- a/Library/Homebrew/test/test_inreplace.rb
+++ b/Library/Homebrew/test/test_inreplace.rb
@@ -87,4 +87,16 @@ class InreplaceTest < Homebrew::TestCase
s.gsub!("o", "e")
assert_equal "bee", s
end
+
+ def test_sub_gsub_with_hash
+ s = "foo"
+ s.extend(StringInreplaceExtension)
+
+ repl = { "f" => "b", "o" => "e" }
+ s.sub!(/[fo]/, repl)
+ assert_equal "boo", s
+
+ s.gsub!(/[fo]/, repl)
+ assert_equal "bee", s
+ end
end