diff options
| author | Jack Nagel | 2014-09-27 23:31:08 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-09-27 23:31:08 -0500 |
| commit | 14594741e1310a8e96803c67d6ef7b67d28ca970 (patch) | |
| tree | 174a95b9c2c4976c183b54437f9b75fb3ad16d7d /Library | |
| parent | 9f9f5bf31c19b33e2c4d780b59037ba6ff0afbeb (diff) | |
| download | brew-14594741e1310a8e96803c67d6ef7b67d28ca970.tar.bz2 | |
Add test for inreplace sub!/gsub! with hash argument
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/test_inreplace.rb | 12 |
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 |
