Convert the tests to the MiniTest test framework, but keeping the usage
of the old Test::Unit as fallback in case MiniTest is not available.
In the latter case, use a bit of "glue" to make the old API look like
the new API, so we can just rely on the newer MiniTest API.
(This is the same change as 2f5e9066db817f75b245f256abc0c64dd1ae54eb
in libguestfs.)
---
ruby/tests/tc_010_load.rb | 4 ++--
ruby/tests/tc_021_close.rb | 4 ++--
ruby/tests/tc_120_rlenvalue.rb | 8 ++++----
ruby/tests/tc_130_special.rb | 6 +++---
ruby/tests/tc_200_write.rb | 4 ++--
ruby/tests/tc_210_setvalue.rb | 4 ++--
ruby/tests/test_helper.rb | 13 ++++++++++++-
7 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/ruby/tests/tc_010_load.rb b/ruby/tests/tc_010_load.rb
index a45e904..76fef60 100644
--- a/ruby/tests/tc_010_load.rb
+++ b/ruby/tests/tc_010_load.rb
@@ -17,9 +17,9 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestLoad < Test::Unit::TestCase
+class TestLoad < MiniTest::Unit::TestCase
def test_load
h = Hivex::open("../images/minimal", {})
- assert_not_nil (h)
+ refute_nil (h)
end
end
diff --git a/ruby/tests/tc_021_close.rb b/ruby/tests/tc_021_close.rb
index 3068e23..38b88a9 100644
--- a/ruby/tests/tc_021_close.rb
+++ b/ruby/tests/tc_021_close.rb
@@ -17,10 +17,10 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestClose < Test::Unit::TestCase
+class TestClose < MiniTest::Unit::TestCase
def test_close
h = Hivex::open("../images/minimal", {})
- assert_not_nil (h)
+ refute_nil (h)
h.close()
end
end
diff --git a/ruby/tests/tc_120_rlenvalue.rb b/ruby/tests/tc_120_rlenvalue.rb
index f269805..6c03f43 100644
--- a/ruby/tests/tc_120_rlenvalue.rb
+++ b/ruby/tests/tc_120_rlenvalue.rb
@@ -23,16 +23,16 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestRLenValue < Test::Unit::TestCase
+class TestRLenValue < MiniTest::Unit::TestCase
def test_RLenValue
h = Hivex::open(File::join(ENV['abs_srcdir'], '..', 'images',
'rlenvalue_test_hive'), {})
- assert_not_nil(h)
+ refute_nil(h)
root = h.root()
- assert_not_nil(root)
+ refute_nil(root)
moderate_value_node = h.node_get_child(root, "ModerateValueParent")
- assert_not_nil(moderate_value_node)
+ refute_nil(moderate_value_node)
moderate_value_value = h.node_get_value(moderate_value_node, "33Bytes")
diff --git a/ruby/tests/tc_130_special.rb b/ruby/tests/tc_130_special.rb
index aedb543..282b288 100644
--- a/ruby/tests/tc_130_special.rb
+++ b/ruby/tests/tc_130_special.rb
@@ -3,13 +3,13 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestRLenValue < Test::Unit::TestCase
+class TestRLenValue < MiniTest::Unit::TestCase
def test_RLenValue
h = Hivex::open(File::join(ENV['abs_srcdir'], '..', 'images',
'special'), {})
- assert_not_nil(h)
+ refute_nil(h)
root = h.root()
- assert_not_nil(root)
+ refute_nil(root)
nodes = h.node_children (root)
node = nodes.find { |n| h.node_name(n) == "abcd_äöüß" }
diff --git a/ruby/tests/tc_200_write.rb b/ruby/tests/tc_200_write.rb
index 36faec2..327d0a8 100644
--- a/ruby/tests/tc_200_write.rb
+++ b/ruby/tests/tc_200_write.rb
@@ -17,10 +17,10 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestWrite < Test::Unit::TestCase
+class TestWrite < MiniTest::Unit::TestCase
def test_write
h = Hivex::open("../images/minimal", {:write => 1})
- assert_not_nil (h)
+ refute_nil (h)
root = h.root()
assert (root)
diff --git a/ruby/tests/tc_210_setvalue.rb b/ruby/tests/tc_210_setvalue.rb
index 3796dad..62ffd99 100644
--- a/ruby/tests/tc_210_setvalue.rb
+++ b/ruby/tests/tc_210_setvalue.rb
@@ -17,10 +17,10 @@
require File::join(File::dirname(__FILE__), 'test_helper')
-class TestSetValue < Test::Unit::TestCase
+class TestSetValue < MiniTest::Unit::TestCase
def test_set_value
h = Hivex::open("../images/minimal", {:write => 1})
- assert_not_nil (h)
+ refute_nil (h)
root = h.root()
assert (root)
diff --git a/ruby/tests/test_helper.rb b/ruby/tests/test_helper.rb
index 67e1b14..f939b94 100644
--- a/ruby/tests/test_helper.rb
+++ b/ruby/tests/test_helper.rb
@@ -15,6 +15,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-require 'test/unit'
+begin
+ require 'minitest/autorun'
+rescue LoadError
+ require 'test/unit'
+ MiniTest = Test
+ module Test
+ Assertions = Unit::Assertions
+ module Assertions
+ alias refute_nil assert_not_nil
+ end
+ end
+end
require 'hivex'
--
1.9.0