Add test for inreplace sub!/gsub! with hash argument
This commit is contained in:
parent
9f9f5bf31c
commit
14594741e1
@ -87,4 +87,16 @@ class InreplaceTest < Homebrew::TestCase
|
|||||||
s.gsub!("o", "e")
|
s.gsub!("o", "e")
|
||||||
assert_equal "bee", s
|
assert_equal "bee", s
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user