diff options
-rw-r--r-- | lib/coderay/helpers/word_list.rb | 1 | ||||
-rw-r--r-- | test/functional/word_list.rb | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/coderay/helpers/word_list.rb b/lib/coderay/helpers/word_list.rb index 5196a5d..c8cc7ac 100644 --- a/lib/coderay/helpers/word_list.rb +++ b/lib/coderay/helpers/word_list.rb @@ -104,6 +104,7 @@ class CaseIgnoringWordList < WordList h[k] = h.fetch k.downcase, default end else + super(default, false) def self.[] key # :nodoc: super(key.downcase) end diff --git a/test/functional/word_list.rb b/test/functional/word_list.rb index 0ef275a..4fa8dbb 100644 --- a/test/functional/word_list.rb +++ b/test/functional/word_list.rb @@ -45,20 +45,24 @@ class WordListTest < Test::Unit::TestCase def test_case_ignoring_word_list list = CaseIgnoringWordList.new(:ident).add(['foobar'], :reserved) + assert_equal :ident, list['foo'] assert_equal :reserved, list['foobar'] assert_equal :reserved, list['FooBar'] list = CaseIgnoringWordList.new(:ident).add(['FooBar'], :reserved) + assert_equal :ident, list['foo'] assert_equal :reserved, list['foobar'] assert_equal :reserved, list['FooBar'] end def test_case_ignoring_word_list_cached list = CaseIgnoringWordList.new(:ident, true).add(['foobar'], :reserved) + assert_equal :ident, list['foo'] assert_equal :reserved, list['foobar'] assert_equal :reserved, list['FooBar'] list = CaseIgnoringWordList.new(:ident, true).add(['FooBar'], :reserved) + assert_equal :ident, list['foo'] assert_equal :reserved, list['foobar'] assert_equal :reserved, list['FooBar'] end |