From ae75e3ef0a252ef3560f117d07fd9196a901db0a Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 12 May 2014 15:49:27 +0200 Subject: [PATCH 1/4] Make it work with Minitest 5 Deal with stuff that got deprecated with Minitest 4: NOTE: MiniTest::Unit::TestCase#assert_block is deprecated, use assert. It will be removed on 2013-01-01. Called from src/comp_tree/test/exception_test.rb:50:in `block (3 levels) in test_exception' --- test/exception_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/exception_test.rb b/test/exception_test.rb index ccc73a5..5d30bd1 100644 --- a/test/exception_test.rb +++ b/test/exception_test.rb @@ -47,9 +47,9 @@ def test_exception ) if define_all - assert_block { error.is_a? test_error } + assert ( error.is_a? test_error ) else - assert_block { error.is_a? CompTree::NoFunctionError } + assert ( error.is_a? CompTree::NoFunctionError ) assert_equal( "no function was defined for node `:border'", error.message From 7dadbfa8bfc9b4d99b4272d0e0a9777a5fb0b768 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 12 May 2014 15:49:27 +0200 Subject: [PATCH 2/4] Make tests work with Rake 10 Deal with stuff that got deprecated with Rake 9: WARNING: Global access to Rake DSL methods is deprecated. Please include ... Rake::DSL into classes and modules which use the Rake DSL methods. WARNING: DSL method Levitate#task called at src/comp_tree/devel/levitate.rb:507:in `define_changes' WARNING: DSL method Levitate#desc called at src/comp_tree/devel/levitate.rb:389:in `define_doc' --- devel/levitate.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devel/levitate.rb b/devel/levitate.rb index 38712df..745b6e6 100644 --- a/devel/levitate.rb +++ b/devel/levitate.rb @@ -1,5 +1,7 @@ class Levitate + include Rake::DSL + def initialize(gem_name) @gem_name = gem_name From d4e8a4727c305b61e20ea2ee3f137be2245f7744 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 12 May 2014 15:49:55 +0200 Subject: [PATCH 3/4] Fix throw_test test Make no assumption about initial Thread.list size. --- test/throw_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/throw_test.rb b/test/throw_test.rb index e8192f7..c6198ec 100644 --- a/test/throw_test.rb +++ b/test/throw_test.rb @@ -4,7 +4,7 @@ class ThrowTest < CompTreeTest EXPECTED = RUBY_VERSION >= "1.9.0" ? ArgumentError : ThreadError def test_throw - assert_equal 1, Thread.list.size + init_size = Thread.list.size exception = assert_raises(EXPECTED) { CompTree.build do |driver| driver.define(:root, :a) { @@ -17,6 +17,6 @@ def test_throw end } assert_match "uncaught", exception.message - assert_equal 1, Thread.list.size + assert_equal init_size, Thread.list.size end end From 83924426b3da6d2e366452c143b6819fa6b0f41e Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 12 May 2014 15:50:08 +0200 Subject: [PATCH 4/4] Fix run with Minitest 5 There's a warning due to the weird way we avoid autorun, but at least it works with both minitest 4 (present in enterprise linux 7) and minitest 5 (shipped with fedora 20): Warning: you should require 'minitest/autorun' instead. Warning: or add 'gem "minitest"' before 'require "minitest/autorun"' --- devel/levitate.rb | 8 +++++++- test/comp_tree_test_base.rb | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/devel/levitate.rb b/devel/levitate.rb index 745b6e6..e425fcf 100644 --- a/devel/levitate.rb +++ b/devel/levitate.rb @@ -338,7 +338,13 @@ def define_test test_files.each { |file| require file } # if we use at_exit hook instead, it won't run before :release - MiniTest::Unit.new.run ARGV + if MiniTest::Unit.method_defined? :run + # minitest 4 + MiniTest::Unit.new.run ARGV + else + # minitest 5 + Minitest.run ARGV + end end desc "run tests with coverage" diff --git a/test/comp_tree_test_base.rb b/test/comp_tree_test_base.rb index 2affe6f..55a0fa9 100644 --- a/test/comp_tree_test_base.rb +++ b/test/comp_tree_test_base.rb @@ -1,6 +1,7 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' $LOAD_PATH.unshift File.dirname(__FILE__) + '/../devel' +gem 'minitest' require 'minitest/unit' require 'minitest/autorun' unless defined? Rake require 'comp_tree'