diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2011-08-19 03:09:35 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2011-08-19 03:09:35 +0200 |
commit | 75bc5455af8c3c3381066aac3d5fff42264cac6f (patch) | |
tree | 589d2c912ddd94c517eb794bcdf3257f8348f3c0 /test/unit | |
parent | fdd17b6a09efb275238a3baef275465d31452f2a (diff) | |
download | coderay-75bc5455af8c3c3381066aac3d5fff42264cac6f.tar.gz |
Major rewrite of encoders to support IO output; fixed some minor scanner bugs; cleanups; dropped NitroXHTML scanner; improved tests
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/file_type.rb | 4 | ||||
-rwxr-xr-x | test/unit/plugin.rb | 22 | ||||
-rw-r--r-- | test/unit/plugins/example.rb | 2 | ||||
-rw-r--r-- | test/unit/plugins/user_defined/user_plugin.rb | 2 | ||||
-rw-r--r-- | test/unit/plugins_with_default/default.rb | 5 | ||||
-rw-r--r-- | test/unit/plugins_with_default/default_plugin.rb | 5 | ||||
-rw-r--r-- | test/unit/plugins_with_default/example_without_register_for.rb | 4 |
7 files changed, 18 insertions, 26 deletions
diff --git a/test/unit/file_type.rb b/test/unit/file_type.rb index d62a006..1dc1ba0 100644 --- a/test/unit/file_type.rb +++ b/test/unit/file_type.rb @@ -73,8 +73,8 @@ class FileTypeTests < Test::Unit::TestCase assert_equal :page, FileType['test.htm'] assert_equal :page, FileType['test.xhtml'] assert_equal :page, FileType['test.html.xhtml'] - assert_equal :rhtml, FileType['_form.rhtml'] - assert_equal :rhtml, FileType['_form.html.erb'] + assert_equal :erb, FileType['_form.rhtml'] + assert_equal :erb, FileType['_form.html.erb'] end def test_yaml diff --git a/test/unit/plugin.rb b/test/unit/plugin.rb index 678b883..2231c75 100755 --- a/test/unit/plugin.rb +++ b/test/unit/plugin.rb @@ -1,6 +1,8 @@ require 'test/unit' +require File.expand_path('../../lib/assert_warning', __FILE__) + +$:.unshift File.expand_path('../../../lib', __FILE__) require 'coderay' -require 'pathname' class PluginScannerTest < Test::Unit::TestCase @@ -20,7 +22,7 @@ class PluginScannerTest < Test::Unit::TestCase extend CodeRay::Plugin plugin_host PluginsWithDefault end - default :default + default :default_plugin end def test_load @@ -36,7 +38,9 @@ class PluginScannerTest < Test::Unit::TestCase def test_default assert_nothing_raised do - assert_operator PluginsWithDefault[:gargamel], :<, PluginsWithDefault::Plugin + assert_warning 'PluginScannerTest::PluginsWithDefault could not load plugin :gargamel; falling back to :default_plugin' do + assert_operator PluginsWithDefault[:gargamel], :<, PluginsWithDefault::Plugin + end end assert_equal PluginsWithDefault::Default, PluginsWithDefault.default end @@ -64,16 +68,4 @@ class PluginScannerTest < Test::Unit::TestCase assert_equal 'The Example', Plugins::Example.title end - def assert_warning expected_warning - require 'stringio' - oldstderr = $stderr - $stderr = StringIO.new - yield - $stderr.rewind - given_warning = $stderr.read.chomp - assert_equal expected_warning, given_warning - ensure - $stderr = oldstderr - end - end diff --git a/test/unit/plugins/example.rb b/test/unit/plugins/example.rb index e28dc7c..af1aeba 100644 --- a/test/unit/plugins/example.rb +++ b/test/unit/plugins/example.rb @@ -3,4 +3,4 @@ class Example < PluginScannerTest::Plugins::Plugin register_for :example title 'The Example' -end
\ No newline at end of file +end diff --git a/test/unit/plugins/user_defined/user_plugin.rb b/test/unit/plugins/user_defined/user_plugin.rb index 61e5372..f47c934 100644 --- a/test/unit/plugins/user_defined/user_plugin.rb +++ b/test/unit/plugins/user_defined/user_plugin.rb @@ -2,4 +2,4 @@ class UserPlugin < PluginScannerTest::Plugins::Plugin register_for :user_plugin -end
\ No newline at end of file +end diff --git a/test/unit/plugins_with_default/default.rb b/test/unit/plugins_with_default/default.rb deleted file mode 100644 index e67c9f1..0000000 --- a/test/unit/plugins_with_default/default.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Default < PluginScannerTest::PluginsWithDefault::Plugin - - register_for :default - -end
\ No newline at end of file diff --git a/test/unit/plugins_with_default/default_plugin.rb b/test/unit/plugins_with_default/default_plugin.rb new file mode 100644 index 0000000..ae9e4c5 --- /dev/null +++ b/test/unit/plugins_with_default/default_plugin.rb @@ -0,0 +1,5 @@ +class DefaultPlugin < PluginScannerTest::PluginsWithDefault::Plugin + + register_for :default_plugin + +end diff --git a/test/unit/plugins_with_default/example_without_register_for.rb b/test/unit/plugins_with_default/example_without_register_for.rb index d9f40be..083baf6 100644 --- a/test/unit/plugins_with_default/example_without_register_for.rb +++ b/test/unit/plugins_with_default/example_without_register_for.rb @@ -1,5 +1,5 @@ -class ExampleWithoutRegisterFor < PluginScannerTest::Plugins::Plugin +class ExampleWithoutRegisterFor < PluginScannerTest::PluginsWithDefault::Plugin register_for :wrong_id -end
\ No newline at end of file +end |