Permalink
Browse files

Update to work with new test/unit in 1.9.1

  • Loading branch information...
1 parent b8d591e commit 95bba790bd2b4eb355320f1331c2d0c221b0f28f rmagick committed Jan 2, 2009
Showing with 36 additions and 33 deletions.
  1. +2 −2 test/Draw.rb
  2. +3 −3 test/Image1.rb
  3. +4 −4 test/Image2.rb
  4. +3 −3 test/Image3.rb
  5. +8 −6 test/ImageList1.rb
  6. +2 −2 test/ImageList2.rb
  7. +3 −3 test/Image_attributes.rb
  8. +2 −2 test/Import_Export.rb
  9. +1 −1 test/Info.rb
  10. +2 −2 test/Magick.rb
  11. +1 −1 test/Pixel.rb
  12. +2 −2 test/Preview.rb
  13. +3 −2 test/all_basic.rb
View
@@ -3,7 +3,7 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
class Magick::Draw
def self._dummy_img_
@@ -109,6 +109,6 @@ def test_patterns
end
if __FILE__ == $0
-Test::Unit::UI::Console::TestRunner.run(Draw_UT)
+Test::Unit::UI::Console::TestRunner.run(Draw_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -2,11 +2,11 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
class Image1_UT < Test::Unit::TestCase
- FreezeError = RUBY_VERSION == '1.9.0' ? RuntimeError : TypeError
+ FreezeError = RUBY_VERSION == '1.9.1' ? RuntimeError : TypeError
def setup
@img = Magick::Image.new(20, 20)
@@ -726,5 +726,5 @@ def test_composite
if __FILE__ == $0
IMAGES_DIR = '../doc/ex/images'
FILES = Dir[IMAGES_DIR+'/Button_*.gif']
-Test::Unit::UI::Console::TestRunner.run(Image1_UT)
+Test::Unit::UI::Console::TestRunner.run(Image1_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -2,13 +2,13 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
# TODO: improve exif tests - need a benchmark image with EXIF data
class Image2_UT < Test::Unit::TestCase
- FreezeError = RUBY_VERSION == '1.9.0' ? RuntimeError : TypeError
+ FreezeError = RUBY_VERSION == '1.9.1' ? RuntimeError : TypeError
def setup
@img = Magick::Image.new(20, 20)
@@ -235,7 +235,7 @@ def test_despeckle
# ensure methods detect destroyed images
def test_destroy
methods = Magick::Image.instance_methods(false).sort
- if RUBY_VERSION == '1.9.0'
+ if RUBY_VERSION == '1.9.1'
methods -= [:__display__, :destroy!, :destroyed?, :inspect, :cur_image, :marshal_load]
else
methods -= %w{ __display__ destroy! destroyed? inspect cur_image marshal_load}
@@ -1248,5 +1248,5 @@ def test_posterize
if __FILE__ == $0
IMAGES_DIR = '../doc/ex/images'
FILES = Dir[IMAGES_DIR+'/Button_*.gif']
-Test::Unit::UI::Console::TestRunner.run(Image2_UT)
+Test::Unit::UI::Console::TestRunner.run(Image2_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -2,7 +2,7 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
require 'fileutils'
ColorspaceTypes = [
@@ -33,7 +33,7 @@
class Image3_UT < Test::Unit::TestCase
- FreezeError = RUBY_VERSION == '1.9.0' ? RuntimeError : TypeError
+ FreezeError = RUBY_VERSION == '1.9.1' ? RuntimeError : TypeError
def setup
@img = Magick::Image.new(20, 20)
@@ -982,5 +982,5 @@ def test_write
if __FILE__ == $0
IMAGES_DIR = '../doc/ex/images'
FILES = Dir[IMAGES_DIR+'/Button_*.gif']
-Test::Unit::UI::Console::TestRunner.run(Image3_UT)
+Test::Unit::UI::Console::TestRunner.run(Image3_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -2,7 +2,7 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
class ImageList1_UT < Test::Unit::TestCase
@@ -500,10 +500,12 @@ def test_map!
assert_raise(ArgumentError) { @list.map! { 2 } }
end
- def test_nitems
- n = nil
- assert_nothing_raised { n = @list.nitems }
- assert_equal(10, n)
+ if RUBY_VERSION != '1.9.1'
+ def test_nitems
+ n = nil
+ assert_nothing_raised { n = @list.nitems }
+ assert_equal(10, n)
+ end
end
def test_partition
@@ -802,5 +804,5 @@ def test_spaceship
if __FILE__ == $0
IMAGES_DIR = '../doc/ex/images'
FILES = Dir[IMAGES_DIR+'/Button_*.gif'].sort
-Test::Unit::UI::Console::TestRunner.run(ImageList1_UT)
+Test::Unit::UI::Console::TestRunner.run(ImageList1_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -4,7 +4,7 @@
require 'fileutils'
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
class ImageList2_UT < Test::Unit::TestCase
@@ -385,5 +385,5 @@ def test_write
if __FILE__ == $0
IMAGES_DIR = '../doc/ex/images'
FLOWER_HAT = IMAGES_DIR+'/Flower_Hat.jpg'
-Test::Unit::UI::Console::TestRunner.run(ImageList2_UT)
+Test::Unit::UI::Console::TestRunner.run(ImageList2_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -3,7 +3,7 @@
require 'fileutils'
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
# TODO
# test frozen attributes!
@@ -12,7 +12,7 @@
class Image_Attributes_UT < Test::Unit::TestCase
- FreezeError = RUBY_VERSION == '1.9.0' ? RuntimeError : TypeError
+ FreezeError = RUBY_VERSION == '1.9.1' ? RuntimeError : TypeError
def setup
@img = Magick::Image.new(100, 100)
@@ -673,5 +673,5 @@ def test_frozen
if __FILE__ == $0
FLOWER_HAT = '../doc/ex/images/Flower_Hat.jpg'
-Test::Unit::UI::Console::TestRunner.run(Image_Attributes_UT)
+Test::Unit::UI::Console::TestRunner.run(Image_Attributes_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -1,6 +1,6 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
class Import_Export_UT < Test::Unit::TestCase
@@ -111,6 +111,6 @@ def test_import_export
if __FILE__ == $0
IMAGES_DIR = '../doc/ex/images'
-Test::Unit::UI::Console::TestRunner.run(Import_Export_UT)
+Test::Unit::UI::Console::TestRunner.run(Import_Export_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -3,7 +3,7 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
class Info_UT < Test::Unit::TestCase
View
@@ -3,7 +3,7 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
module Magick
@@ -359,6 +359,6 @@ def test_trace_proc
end
if __FILE__ == $0
-Test::Unit::UI::Console::TestRunner.run(Magick_UT)
+Test::Unit::UI::Console::TestRunner.run(Magick_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -2,7 +2,7 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
class Pixel_UT < Test::Unit::TestCase
View
@@ -2,7 +2,7 @@
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
class Preview_UT < Test::Unit::TestCase
@@ -57,6 +57,6 @@ def test_preview
if __FILE__ == $0
IMAGES_DIR = '../doc/ex/images'
-Test::Unit::UI::Console::TestRunner.run(Preview_UT)
+Test::Unit::UI::Console::TestRunner.run(Preview_UT) if RUBY_VERSION != '1.9.1'
end
View
@@ -1,15 +1,16 @@
#! /usr/local/bin/ruby -w
require 'RMagick'
require 'test/unit'
-require 'test/unit/ui/console/testrunner'
+require 'test/unit/ui/console/testrunner' if RUBY_VERSION != '1.9.1'
module Test
module Unit
class TestCase
alias :_old_run_ :run
def run(result, &blk)
- puts "Running #{@method_name}"
+ method_name = RUBY_VERSION == '1.9.1' ? self.name : @method_name
+ puts "Running #{method_name}"
_old_run_(result, &blk)
end
end

0 comments on commit 95bba79

Please sign in to comment.