summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2011-05-21 03:03:31 +0000
committermurphy <murphy@rubychan.de>2011-05-21 03:03:31 +0000
commit5efcf487985e7348ed3d39f33b7185028a6e3716 (patch)
treeddaa71a4884a5349d985526f88f11a7514c7b6d7 /test
parentc5a193f08ddef1ba1cb5e1f9b0789b2f587022c4 (diff)
downloadcoderay-5efcf487985e7348ed3d39f33b7185028a6e3716.tar.gz
various fixes and cleanups in CodeRay's helpers
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/basic.rb2
-rwxr-xr-xtest/unit/plugin.rb2
-rw-r--r--test/unit/word_list.rb33
3 files changed, 11 insertions, 26 deletions
diff --git a/test/functional/basic.rb b/test/functional/basic.rb
index 1d0c760..c9879dd 100755
--- a/test/functional/basic.rb
+++ b/test/functional/basic.rb
@@ -149,7 +149,7 @@ more code # and another comment, in-line.
def test_list_of_scanners
assert_kind_of(Array, CodeRay::Scanners.list)
- assert CodeRay::Scanners.list.include?(:plaintext)
+ assert CodeRay::Scanners.list.include?(:text)
end
def test_token_kinds
diff --git a/test/unit/plugin.rb b/test/unit/plugin.rb
index ee3e2cc..678b883 100755
--- a/test/unit/plugin.rb
+++ b/test/unit/plugin.rb
@@ -31,7 +31,7 @@ class PluginScannerTest < Test::Unit::TestCase
def test_load_all
assert_instance_of Symbol, Plugins.load_all.first
assert_operator Plugins.all_plugins.first, :<, Plugins::Plugin
- assert_equal 'The Example', Plugins.all_titles.sort.first
+ assert_equal 'The Example', Plugins.all_plugins.map { |plugin| plugin.title }.sort.first
end
def test_default
diff --git a/test/unit/word_list.rb b/test/unit/word_list.rb
index 803e268..2d02d66 100644
--- a/test/unit/word_list.rb
+++ b/test/unit/word_list.rb
@@ -25,7 +25,7 @@ class WordListTest < Test::Unit::TestCase
add(RESERVED_WORDS, :reserved).
add(PREDEFINED_TYPES, :predefined_type).
add(PREDEFINED_CONSTANTS, :predefined_constant)
-
+
def test_word_list_example
assert_equal :predefined_type, IDENT_KIND['void']
# assert_equal :predefined_constant, IDENT_KIND['...'] # not specified
@@ -35,38 +35,23 @@ class WordListTest < Test::Unit::TestCase
list = WordList.new(:ident).add(['foobar'], :reserved)
assert_equal :reserved, list['foobar']
assert_equal :ident, list['FooBar']
+ assert_equal 1, list.size
end
-
- def test_word_list_cached
- list = WordList.new(:ident, true).add(['foobar'], :reserved)
- assert_equal :reserved, list['foobar']
- assert_equal :ident, list['FooBar']
- end
-
+
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']
-
+ assert_equal 1, list.size
+
list = CaseIgnoringWordList.new(:ident).add(['FooBar'], :reserved)
assert_equal :ident, list['foo']
assert_equal :reserved, list['foobar']
assert_equal :reserved, list['FooBar']
+ assert_equal 1, list.size
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
-
+
def test_dup
list = WordList.new(:ident).add(['foobar'], :reserved)
assert_equal :reserved, list['foobar']
@@ -75,5 +60,5 @@ class WordListTest < Test::Unit::TestCase
assert_equal :keyword, list2['foobar']
assert_equal :reserved, list['foobar']
end
-
-end \ No newline at end of file
+
+end