summaryrefslogtreecommitdiff
path: root/test/test_abbrev.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-30 03:56:28 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-30 03:56:28 +0000
commit4078d42b72339cd80a88a1d2aa163b5499e2f5f7 (patch)
treeb0b1754421119ce0955de44c72d4d8fb2596b039 /test/test_abbrev.rb
parentaac52e2b87389aa41013e6fd7f26d119de10c209 (diff)
Fix a line matching problem in Abbrev.abbrev(words, "prefix").
* lib/abbrev.rb (Abbrev#abbrev): A fixed string prefix pattern should only match the beginning of each word, not the beginning of every line in it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_abbrev.rb')
-rw-r--r--test/test_abbrev.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/test_abbrev.rb b/test/test_abbrev.rb
index 13d673e..f342c59 100644
--- a/test/test_abbrev.rb
+++ b/test/test_abbrev.rb
@@ -36,12 +36,19 @@ class TestAbbrev < Test::Unit::TestCase
end
def test_abbrev_lf
+ words = ["abc", "abc\nd", "de"]
+
assert_equal({
"abc" => "abc",
"abc\n" => "abc\nd",
"abc\nd" => "abc\nd",
"d" => "de",
"de" => "de",
- }, Abbrev.abbrev(["abc", "abc\nd", "de"]))
+ }, words.abbrev)
+
+ assert_equal({
+ "d" => "de",
+ "de" => "de",
+ }, words.abbrev('d'))
end
end