From e16bc71590d3577769551263948a96642a0c83be Mon Sep 17 00:00:00 2001 From: elij Date: Tue, 25 Jan 2011 00:27:15 -0800 Subject: [PATCH] Explicitly handle the exception for failed loading. The exception handler was only catching RuntimeError, which probably should not be caught by the harness (so a test fails), when it should have been catching LoadError exceptions (module not present to test). Signed-off-by: Konstantin Haase --- test/coffee_test.rb | 2 +- test/erubis_test.rb | 6 ++++++ test/haml_test.rb | 3 ++- test/less_test.rb | 6 ++++++ test/liquid_test.rb | 3 ++- test/markaby_test.rb | 3 ++- test/markdown_test.rb | 5 +++-- test/nokogiri_test.rb | 3 ++- test/radius_test.rb | 5 +++-- test/rdoc_test.rb | 3 ++- test/sass_test.rb | 2 +- test/scss_test.rb | 2 +- test/slim_test.rb | 3 ++- test/textile_test.rb | 3 ++- 14 files changed, 35 insertions(+), 14 deletions(-) diff --git a/test/coffee_test.rb b/test/coffee_test.rb index bf8b0a69..918139b4 100644 --- a/test/coffee_test.rb +++ b/test/coffee_test.rb @@ -83,6 +83,6 @@ class CoffeeTest < Test::Unit::TestCase end end -rescue +rescue LoadError warn "#{$!.to_s}: skipping coffee tests" end diff --git a/test/erubis_test.rb b/test/erubis_test.rb index 447f25fa..6e2323cb 100644 --- a/test/erubis_test.rb +++ b/test/erubis_test.rb @@ -1,4 +1,6 @@ require File.dirname(__FILE__) + '/helper' + +begin require 'erubis' class ERubisTest < Test::Unit::TestCase @@ -80,3 +82,7 @@ class ERubisTest < Test::Unit::TestCase assert_equal 'hi', body end end + +rescue LoadError + warn "#{$!.to_s}: skipping erubis tests" +end diff --git a/test/haml_test.rb b/test/haml_test.rb index 06ec10f4..7404251d 100644 --- a/test/haml_test.rb +++ b/test/haml_test.rb @@ -95,6 +95,7 @@ class HAMLTest < Test::Unit::TestCase assert_equal "bar\n", body end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping haml tests" end diff --git a/test/less_test.rb b/test/less_test.rb index ef9ac158..b761f4f0 100644 --- a/test/less_test.rb +++ b/test/less_test.rb @@ -1,4 +1,6 @@ require File.dirname(__FILE__) + '/helper' + +begin require 'less' class LessTest < Test::Unit::TestCase @@ -59,3 +61,7 @@ class LessTest < Test::Unit::TestCase assert_raise(Errno::ENOENT) { get('/') } end end + +rescue LoadError + warn "#{$!.to_s}: skipping less tests" +end diff --git a/test/liquid_test.rb b/test/liquid_test.rb index 3315bd16..9c226c71 100644 --- a/test/liquid_test.rb +++ b/test/liquid_test.rb @@ -53,6 +53,7 @@ class LiquidTest < Test::Unit::TestCase assert_equal 'foo', body end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping liquid tests" end diff --git a/test/markaby_test.rb b/test/markaby_test.rb index 50139e54..104295ea 100644 --- a/test/markaby_test.rb +++ b/test/markaby_test.rb @@ -74,6 +74,7 @@ class MarkabyTest < Test::Unit::TestCase assert_equal 'foo', body end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping markaby tests" end diff --git a/test/markdown_test.rb b/test/markdown_test.rb index f1f12f1d..8e676dbf 100644 --- a/test/markdown_test.rb +++ b/test/markdown_test.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/helper' begin -fail "rdiscount not available" if defined? JRuby +fail LoadError, "rdiscount not available" if defined? JRuby require 'rdiscount' class MarkdownTest < Test::Unit::TestCase @@ -30,6 +30,7 @@ class MarkdownTest < Test::Unit::TestCase assert_raise(Errno::ENOENT) { get('/') } end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping markdown tests" end diff --git a/test/nokogiri_test.rb b/test/nokogiri_test.rb index 832f792e..31230832 100644 --- a/test/nokogiri_test.rb +++ b/test/nokogiri_test.rb @@ -64,6 +64,7 @@ class NokogiriTest < Test::Unit::TestCase assert_raise(Errno::ENOENT) { get('/') } end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping nokogiri tests" end diff --git a/test/radius_test.rb b/test/radius_test.rb index 7f43928a..b1107bfc 100644 --- a/test/radius_test.rb +++ b/test/radius_test.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/helper' begin -fail 'Radius broken on 1.9.' if RUBY_VERSION >= '1.9.1' +fail LoadError, 'Radius broken on 1.9.' if RUBY_VERSION >= '1.9.1' require 'radius' class RadiusTest < Test::Unit::TestCase @@ -54,6 +54,7 @@ class RadiusTest < Test::Unit::TestCase assert_equal 'foo', body end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping radius tests" end diff --git a/test/rdoc_test.rb b/test/rdoc_test.rb index 93a71a5d..53d73426 100644 --- a/test/rdoc_test.rb +++ b/test/rdoc_test.rb @@ -29,6 +29,7 @@ class RdocTest < Test::Unit::TestCase assert_raise(Errno::ENOENT) { get('/') } end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping rdoc tests" end diff --git a/test/sass_test.rb b/test/sass_test.rb index e1a24329..9a0372e6 100644 --- a/test/sass_test.rb +++ b/test/sass_test.rb @@ -110,6 +110,6 @@ class SassTest < Test::Unit::TestCase end end -rescue +rescue LoadError warn "#{$!.to_s}: skipping sass tests" end diff --git a/test/scss_test.rb b/test/scss_test.rb index d1df4919..722f0dcf 100644 --- a/test/scss_test.rb +++ b/test/scss_test.rb @@ -83,6 +83,6 @@ class ScssTest < Test::Unit::TestCase end end -rescue +rescue LoadError warn "#{$!.to_s}: skipping scss tests" end diff --git a/test/slim_test.rb b/test/slim_test.rb index 4c1533f3..96a8cab6 100644 --- a/test/slim_test.rb +++ b/test/slim_test.rb @@ -92,6 +92,7 @@ class SlimTest < Test::Unit::TestCase assert_equal "

Hello World

", body end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping slim tests" end diff --git a/test/textile_test.rb b/test/textile_test.rb index 38df1d2e..f9535b43 100644 --- a/test/textile_test.rb +++ b/test/textile_test.rb @@ -29,6 +29,7 @@ class TextileTest < Test::Unit::TestCase assert_raise(Errno::ENOENT) { get('/') } end end -rescue + +rescue LoadError warn "#{$!.to_s}: skipping textile tests" end