From 14594741e1310a8e96803c67d6ef7b67d28ca970 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sat, 27 Sep 2014 23:31:08 -0500 Subject: [PATCH] Add test for inreplace sub!/gsub! with hash argument --- Library/Homebrew/test/test_inreplace.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Homebrew/test/test_inreplace.rb b/Library/Homebrew/test/test_inreplace.rb index 5b226eb8d6..5a477be480 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