You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by James McCoy <ja...@debian.org> on 2015/11/05 04:39:42 UTC
[PATCH] Convert Ruby tests from test-unit to minitest
Ruby 2.2 changed test/unit from an in-tree wrapper around minitest
4 to a bundled version of the externally maintained ruby-test-unit gem.
Similarly, the in-tree minitest was removed and the externally
maintained ruby-minitest gem (of the 5.x series) is bundled. These
changes broke check-swig-rb, since the test framework APIs behave
differently.
The test suite needs to be adapted to either the new ruby-test-unit API
or to the ruby-minitest API. Since ruby-minitest is simpler, more
typical Ruby code, convert the tests to use the maintained 5.x series.
* Makefile.in
(check-swig-rb): Use SWIG_RB_TEST_VERBOSE as a flag for whether
--verbose should be used, instead of a level. Remove Ruby version
check to determine whether --verbose can be used.
* subversion/bindings/swig/INSTALL
(): Document the requirement of the minitest gem to run check-swig-rb.
[in subversion/bindings/swig/ruby/test]
* my-assertions.rb
(assert_true, assert_false, assert_nested_sorted_array,
assert_equal_log_entries): Remove use of _my_assert_block. Rely on
the pass/fail status of the contained assertions.
(): Inject the assert_* functions into Minitest::Assertions namespace
instead of Test::Unit::Assertions.
* run-test.rb
(): Ensure minitest >= 5.0.0 is available.
(): Remove test/unit and test-unit-ext requires in favor of
minitest/autorun.
(): Replace runner invocation with require of all test_*.rb files
under test_dir. minitest/autorun runs all present test_* functions,
instead of scanning subdirectories for test_* files.
* test-unit-ext.rb,
test-unit-ext/always-show-result.rb,
test-unit-ext/backtrace-filter.rb,
test-unit-ext/long-display-for-emacs.rb,
test-unit-ext/priority.rb
Remove. Stub functionality to support different versions of
test/unit.
* test_client.rb
(SvnClientTest): Derive test class from Minitest::Test.
(assert_changed, assert_merge, test_resolved, test_resolve_base,
test_resolve_theirs_full, test_resolve_mine_full,
test_resolve_their_conflict, test_resolve_mine_conflict,
test_resolve_merged): Replace test/unit assert_not_* assertions with
minitest's refute_*.
(test_add_not_recurse, test_add_force, test_add_no_ignore,
test_update, test_blame, test_username_provider, test_commit_item,
test_log_msg_func_cancel):
Replace assert_raise calls with assert_raises.
* test_core-rb
(SvnCoreTest): Derive test class from Minitest::Test.
(test_version_equal, test_mergeinfo_to_s, test_range_list_to_s,
test_mergerange_equality): Replace test/unit assert_not_* assertions
with minitest's refute_*.
(test_not_new_auth_provider_object, test_auth_parameter): Replace
assert_raise calls with assert_raises.
* test_delta.rb
(SvnDeltaTest): Derive test class from Minitest::Test.
(test_txdelta_window, test_txdelta_window_compose): Remove use of
_my_assert_block.
* test_error.rb
(SvnErrorTest): Derive test class from Minitest::Test.
* test_fs.rb
(SvnFsTest): Derive test class from Minitest::Test.
(test_transation, assert_recover): Remove assert_nothing_raised. Such
an assertion is useless since if an exception were raised, the test
will fail, by definition.
* test_info.rb
(SvnInfoTest): Derive test class from Minitest::Test.
* test_ra.rb
(SvnRaTest): Derive test class from Minitest::Test.
(test_open_without_callback): Remove assert_nothing_raised. Such an
assertion is useless since if an exception were raised, the test
will fail, by definition.
(test_reparent): Replace assert_raise calls with assert_raises.
* test_repos.rb
(SvnReposTest): Derive test class from Minitest::Test.
(test_prop, test_dump): Remove assert_nothing_raised. Such an
assertion is useless since if an exception were raised, the test
will fail, by definition.
(test_prop, test_load): Replace test/unit assert_not_* assertions with
minitest's refute_*.
* test_util.rb
(SvnUtilTest): Derive test class from Minitest::Test.
* test_wc.rb
(SvnWcTest): Derive test class from Minitest::Test.
(test_status, test_context_create): Remove assert_nothing_raised.
Such an assertion is useless since if an exception were raised, the
test will fail, by definition.
(test_wc, test_context_new_default_config,
test_context_new_specified_config, test_context_create): Replace
test/unit assert_not_* assertions with minitest's refute_*.
(assert_translated_eol): Remove use of _my_assert_block.
---
Makefile.in | 12 +-
subversion/bindings/swig/INSTALL | 2 +-
.../bindings/swig/ruby/test/my-assertions.rb | 78 +++------
subversion/bindings/swig/ruby/test/run-test.rb | 10 +-
.../bindings/swig/ruby/test/test-unit-ext.rb | 23 ---
.../ruby/test/test-unit-ext/always-show-result.rb | 47 -----
.../ruby/test/test-unit-ext/backtrace-filter.rb | 36 ----
.../test/test-unit-ext/long-display-for-emacs.rb | 44 -----
.../swig/ruby/test/test-unit-ext/priority.rb | 195 ---------------------
subversion/bindings/swig/ruby/test/test_client.rb | 150 ++++++----------
subversion/bindings/swig/ruby/test/test_core.rb | 18 +-
subversion/bindings/swig/ruby/test/test_delta.rb | 53 +++---
subversion/bindings/swig/ruby/test/test_error.rb | 2 +-
subversion/bindings/swig/ruby/test/test_fs.rb | 10 +-
subversion/bindings/swig/ruby/test/test_info.rb | 2 +-
subversion/bindings/swig/ruby/test/test_ra.rb | 12 +-
subversion/bindings/swig/ruby/test/test_repos.rb | 18 +-
subversion/bindings/swig/ruby/test/test_util.rb | 2 +-
subversion/bindings/swig/ruby/test/test_wc.rb | 66 ++++---
19 files changed, 173 insertions(+), 607 deletions(-)
delete mode 100644 subversion/bindings/swig/ruby/test/test-unit-ext.rb
delete mode 100644 subversion/bindings/swig/ruby/test/test-unit-ext/always-show-result.rb
delete mode 100644 subversion/bindings/swig/ruby/test/test-unit-ext/backtrace-filter.rb
delete mode 100644 subversion/bindings/swig/ruby/test/test-unit-ext/long-display-for-emacs.rb
delete mode 100644 subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb
diff --git a/Makefile.in b/Makefile.in
index fbac5ab..2c6caa6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -921,14 +921,14 @@ swig-rb: autogen-swig-rb
check-swig-rb: swig-rb svnserve
$(TEST_SHLIB_VAR_SWIG_RB) \
cd $(SWIG_RB_DIR); \
- if [ "$(RUBY_MAJOR)" -eq 1 -a "$(RUBY_MINOR)" -lt 9 ] ; then \
- $(RUBY) -I $(SWIG_RB_SRC_DIR) \
- $(SWIG_RB_SRC_DIR)/test/run-test.rb \
- --verbose=$(SWIG_RB_TEST_VERBOSE); \
- else \
+ if [ "$(SWIG_RB_TEST_VERBOSE)" != "normal" ] ; then \
+ $(RUBY) -I $(SWIG_RB_SRC_DIR) \
+ $(SWIG_RB_SRC_DIR)/test/run-test.rb \
+ --verbose; \
+ else \
$(RUBY) -I $(SWIG_RB_SRC_DIR) \
$(SWIG_RB_SRC_DIR)/test/run-test.rb; \
- fi
+ fi
EXTRACLEAN_SWIG_RB=rm -f $(SWIG_RB_SRC_DIR)/svn_*.c $(SWIG_RB_SRC_DIR)/core.c
diff --git a/subversion/bindings/swig/INSTALL b/subversion/bindings/swig/INSTALL
index a37657a..72dced6 100644
--- a/subversion/bindings/swig/INSTALL
+++ b/subversion/bindings/swig/INSTALL
@@ -208,7 +208,7 @@ Step 3: Install Specific Language Bindings
of the configure command in the top level of the Subversion source
tree. Make sure that the Ruby version used is the same one that you
configured SWIG to run against during the SWIG configure (see above).
-
+ The minitest gem, 5.0.0 or later, is require to run tests.
BUILDING SWIG BINDINGS FOR SVN ON WINDOWS
diff --git a/subversion/bindings/swig/ruby/test/my-assertions.rb b/subversion/bindings/swig/ruby/test/my-assertions.rb
index 77c42e7..b47acb7 100644
--- a/subversion/bindings/swig/ruby/test/my-assertions.rb
+++ b/subversion/bindings/swig/ruby/test/my-assertions.rb
@@ -17,64 +17,40 @@
# under the License.
# ====================================================================
-require "test/unit"
-require "test/unit/assertions"
+require "minitest/assertions"
-module Test
- module Unit
- module Assertions
+module Minitest
+ module Assertions
- # make an intermediary assertion block handler
- def _my_assert_block(&block)
- if RUBY_VERSION > '1.9'
- assert_block do
- yield
- end
- else
- _wrap_assertion do
- yield
- end
- end
- end
-
- def assert_true(boolean, message=nil)
- _my_assert_block do
- assert_equal(true, boolean, message)
- end
- end
+ def assert_true(boolean, message=nil)
+ assert_equal(true, boolean, message)
+ end
- def assert_false(boolean, message=nil)
- _my_assert_block do
- assert_equal(false, boolean, message)
- end
- end
+ def assert_false(boolean, message=nil)
+ assert_equal(false, boolean, message)
+ end
- def assert_nested_sorted_array(expected, actual, message=nil)
- _my_assert_block do
- assert_equal(expected.collect {|elem| elem.sort},
- actual.collect {|elem| elem.sort},
- message)
- end
- end
+ def assert_nested_sorted_array(expected, actual, message=nil)
+ assert_equal(expected.collect {|elem| elem.sort},
+ actual.collect {|elem| elem.sort},
+ message)
+ end
- def assert_equal_log_entries(expected, actual, message=nil)
- _my_assert_block do
- actual = actual.collect do |entry|
- changed_paths = entry.changed_paths
- changed_paths.each_key do |path|
- changed_path = changed_paths[path]
- changed_paths[path] = [changed_path.action,
- changed_path.copyfrom_path,
- changed_path.copyfrom_rev]
- end
- [changed_paths,
- entry.revision,
- entry.revision_properties.reject {|key, value| key == "svn:date"},
- entry.has_children?]
- end
- assert_equal(expected, actual, message)
+ def assert_equal_log_entries(expected, actual, message=nil)
+ actual = actual.collect do |entry|
+ changed_paths = entry.changed_paths
+ changed_paths.each_key do |path|
+ changed_path = changed_paths[path]
+ changed_paths[path] = [changed_path.action,
+ changed_path.copyfrom_path,
+ changed_path.copyfrom_rev]
end
+ [changed_paths,
+ entry.revision,
+ entry.revision_properties.reject {|key, value| key == "svn:date"},
+ entry.has_children?]
end
+ assert_equal(expected, actual, message)
end
end
end
diff --git a/subversion/bindings/swig/ruby/test/run-test.rb b/subversion/bindings/swig/ruby/test/run-test.rb
index 5c9a2c9..3802976 100755
--- a/subversion/bindings/swig/ruby/test/run-test.rb
+++ b/subversion/bindings/swig/ruby/test/run-test.rb
@@ -19,7 +19,8 @@
# under the License.
# ====================================================================
-require "test/unit"
+gem 'minitest', '>=5.0.0'
+require "minitest/autorun"
require "fileutils"
test_dir = File.expand_path(File.join(File.dirname(__FILE__)))
@@ -35,7 +36,6 @@ at_exit {FileUtils.rm_rf(ext_dir)}
$LOAD_PATH.unshift(test_dir)
require 'util'
-require 'test-unit-ext'
SvnTestUtil.setup_test_environment(top_dir, base_dir, ext_svn_ext_dir)
@@ -47,8 +47,4 @@ $LOAD_PATH.unshift(test_dir)
require 'svn/core'
Svn::Locale.set
-if Test::Unit::AutoRunner.respond_to?(:standalone?)
- exit Test::Unit::AutoRunner.run($0, File.dirname($0))
-else
- exit Test::Unit::AutoRunner.run(false, File.dirname($0))
-end
+Dir.entries(test_dir).grep(/^test_.*\.rb/).each { |f| require f }
diff --git a/subversion/bindings/swig/ruby/test/test-unit-ext.rb b/subversion/bindings/swig/ruby/test/test-unit-ext.rb
deleted file mode 100644
index ce88d75..0000000
--- a/subversion/bindings/swig/ruby/test/test-unit-ext.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# ====================================================================
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ====================================================================
-
-require "test-unit-ext/always-show-result" if RUBY_VERSION < '1.9.3'
-require "test-unit-ext/priority"
-require "test-unit-ext/backtrace-filter" if RUBY_VERSION < '1.9.3'
-require "test-unit-ext/long-display-for-emacs" if RUBY_VERSION < '1.9.3'
diff --git a/subversion/bindings/swig/ruby/test/test-unit-ext/always-show-result.rb b/subversion/bindings/swig/ruby/test/test-unit-ext/always-show-result.rb
deleted file mode 100644
index 6866f7d..0000000
--- a/subversion/bindings/swig/ruby/test/test-unit-ext/always-show-result.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# ====================================================================
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ====================================================================
-
-require "test/unit/ui/testrunnermediator"
-
-module Test
- module Unit
- module UI
- class TestRunnerMediator
- alias_method :original_run_suite, :run_suite
- def run_suite
- @notified_finished = false
- begin_time = Time.now
- original_run_suite
- rescue Interrupt
- unless @notified_finished
- end_time = Time.now
- elapsed_time = end_time - begin_time
- notify_listeners(FINISHED, elapsed_time)
- end
- raise
- end
-
- def notify_listeners(channel_name, *arguments)
- @notified_finished = true if channel_name == FINISHED
- super
- end
- end
- end
- end
-end
diff --git a/subversion/bindings/swig/ruby/test/test-unit-ext/backtrace-filter.rb b/subversion/bindings/swig/ruby/test/test-unit-ext/backtrace-filter.rb
deleted file mode 100644
index daa5ec7..0000000
--- a/subversion/bindings/swig/ruby/test/test-unit-ext/backtrace-filter.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# ====================================================================
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ====================================================================
-
-require 'test/unit/util/backtracefilter'
-
-module Test
- module Unit
- module Util
- module BacktraceFilter
- TEST_UNIT_EXT_PREFIX = File.dirname(__FILE__)
-
- alias_method :original_filter_backtrace, :filter_backtrace
- def filter_backtrace(backtrace, prefix=nil)
- original_result = original_filter_backtrace(backtrace, prefix)
- original_filter_backtrace(original_result, TEST_UNIT_EXT_PREFIX)
- end
- end
- end
- end
-end
diff --git a/subversion/bindings/swig/ruby/test/test-unit-ext/long-display-for-emacs.rb b/subversion/bindings/swig/ruby/test/test-unit-ext/long-display-for-emacs.rb
deleted file mode 100644
index 46b0512..0000000
--- a/subversion/bindings/swig/ruby/test/test-unit-ext/long-display-for-emacs.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# ====================================================================
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ====================================================================
-
-require 'test/unit/failure'
-require 'test/unit/error'
-
-module Test
- module Unit
- BACKTRACE_INFO_RE = /.+:\d+:in `.+?'/
- class Failure
- alias_method :original_long_display, :long_display
- def long_display
- extract_backtraces_re =
- /^ \[(#{BACKTRACE_INFO_RE}(?:\n #{BACKTRACE_INFO_RE})+)\]:$/
- original_long_display.gsub(extract_backtraces_re) do |backtraces|
- $1.gsub(/^ (#{BACKTRACE_INFO_RE})/, '\1') + ':'
- end
- end
- end
-
- class Error
- alias_method :original_long_display, :long_display
- def long_display
- original_long_display.gsub(/^ (#{BACKTRACE_INFO_RE})/, '\1')
- end
- end
- end
-end
diff --git a/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb b/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb
deleted file mode 100644
index 6e5e9a5..0000000
--- a/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb
+++ /dev/null
@@ -1,195 +0,0 @@
-# ====================================================================
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ====================================================================
-
-require "test/unit"
-
-require "fileutils"
-
-module Test
- module Unit
- class TestCase
- class << self
- def inherited(sub)
- super
- sub.instance_variable_set("@priority_initialized", true)
- sub.instance_variable_set("@priority_table", {})
- sub.priority :normal
- end
-
- def include(*args)
- args.reverse_each do |mod|
- super(mod)
- next unless defined?(@priority_initialized)
- mod.instance_methods(false).each do |name|
- set_priority(name)
- end
- end
- end
-
- def method_added(name)
- set_priority(name) if defined?(@priority_initialized)
- end
-
- def priority(name, *tests)
- singleton_class = (class << self; self; end)
- priority_check_method = priority_check_method_name(name)
- unless singleton_class.private_method_defined?(priority_check_method)
- raise ArgumentError, "unknown priority: #{name}"
- end
- if tests.empty?
- @current_priority = name
- else
- tests.each do |test|
- set_priority(test, name)
- end
- end
- end
-
- def need_to_run?(test_name)
- normalized_test_name = normalize_test_name(test_name)
- priority = @priority_table[normalized_test_name]
- return true unless priority
- __send__(priority_check_method_name(priority), test_name)
- end
-
- private
- def priority_check_method_name(priority_name)
- "run_priority_#{priority_name}?"
- end
-
- def normalize_test_name(test_name)
- "test_#{test_name.to_s.sub(/^test_/, '')}"
- end
-
- def set_priority(name, priority=@current_priority)
- @priority_table[normalize_test_name(name)] = priority
- end
-
- def run_priority_must?(test_name)
- true
- end
-
- def run_priority_important?(test_name)
- rand > 0.1
- end
-
- def run_priority_high?(test_name)
- rand > 0.3
- end
-
- def run_priority_normal?(test_name)
- rand > 0.5
- end
-
- def run_priority_low?(test_name)
- rand > 0.75
- end
-
- def run_priority_never?(test_name)
- false
- end
- end
-
- def need_to_run?
- !previous_test_success? or self.class.need_to_run?(@method_name)
- end
-
- alias_method :original_run, :run
- def run(result, &block)
- original_run(result, &block)
- ensure
- if passed?
- FileUtils.touch(passed_file)
- else
- FileUtils.rm_f(passed_file)
- end
- end
-
- private
- def previous_test_success?
- File.exist?(passed_file)
- end
-
- def result_dir
- dir = File.join(File.dirname($0), ".test-result",
- self.class.name, escaped_method_name)
- dir = File.expand_path(dir)
- FileUtils.mkdir_p(dir)
- dir
- end
-
- def passed_file
- File.join(result_dir, "passed")
- end
-
- def escaped_method_name
- @method_name.to_s.gsub(/[!?]$/) do |matched|
- case matched
- when "!"
- ".destructive"
- when "?"
- ".predicate"
- end
- end
- end
- end
-
- class TestSuite
- @@priority_mode = false
-
- class << self
- def priority_mode=(bool)
- @@priority_mode = bool
- end
- end
-
- alias_method :original_run, :run
- def run(*args, &block)
- priority_mode = @@priority_mode
- if priority_mode
- @original_tests = @tests
- apply_priority
- end
- original_run(*args, &block)
- ensure
- @tests = @original_tests if priority_mode
- end
-
- def apply_priority
- @tests = @tests.reject {|test| !test.need_to_run?}
- end
-
- def need_to_run?
- apply_priority
- !@tests.empty?
- end
- end if RUBY_VERSION < '1.9.3'
-
- class AutoRunner
- alias_method :original_options, :options
- def options
- opts = original_options
- opts.on("--[no-]priority", "use priority mode") do |bool|
- TestSuite.priority_mode = bool
- end
- opts
- end
- end
- end
-end
diff --git a/subversion/bindings/swig/ruby/test/test_client.rb b/subversion/bindings/swig/ruby/test/test_client.rb
index 7f3343b..00949de 100644
--- a/subversion/bindings/swig/ruby/test/test_client.rb
+++ b/subversion/bindings/swig/ruby/test/test_client.rb
@@ -23,7 +23,7 @@ require "util"
require "svn/core"
require "svn/client"
-class SvnClientTest < Test::Unit::TestCase
+class SvnClientTest < Minitest::Test
include SvnTestUtil
def setup
@@ -51,7 +51,7 @@ class SvnClientTest < Test::Unit::TestCase
ctx.add(dir_path, false)
ctx.commit(@wc_path)
- assert_raise(Svn::Error::FS_NOT_FOUND) do
+ assert_raises(Svn::Error::FS_NOT_FOUND) do
ctx.cat(uri)
end
end
@@ -91,7 +91,7 @@ class SvnClientTest < Test::Unit::TestCase
ctx.add(dir_path, false)
ctx.commit(@wc_path)
- assert_raise(Svn::Error::ENTRY_EXISTS) do
+ assert_raises(Svn::Error::ENTRY_EXISTS) do
ctx.add(dir_path, true, false)
end
@@ -120,7 +120,7 @@ class SvnClientTest < Test::Unit::TestCase
ctx.add(dir_path, true, true, false)
ctx.commit(@wc_path)
- assert_raise(Svn::Error::FS_NOT_FOUND) do
+ assert_raises(Svn::Error::FS_NOT_FOUND) do
ctx.cat(uri)
end
@@ -276,10 +276,8 @@ class SvnClientTest < Test::Unit::TestCase
assert_raises(Svn::Error::ClientModified) do
ctx.delete(path)
end
- assert_nothing_raised do
- ctx.delete(path, true)
- ctx.commit(@wc_path)
- end
+ ctx.delete(path, true)
+ ctx.commit(@wc_path)
assert(!File.exist?(path))
end
end
@@ -313,10 +311,8 @@ class SvnClientTest < Test::Unit::TestCase
assert_raises(Svn::Error::ClientModified) do
ctx.rm(path)
end
- assert_nothing_raised do
- ctx.rm_f(path)
- ctx.commit(@wc_path)
- end
+ ctx.rm_f(path)
+ ctx.commit(@wc_path)
assert(!File.exist?(path))
File.open(path, "w") {|f| f.print(src)}
@@ -554,9 +550,7 @@ class SvnClientTest < Test::Unit::TestCase
make_context(log) do |ctx|
- assert_nothing_raised do
- ctx.update(File.join(@wc_path, "non-exist"), youngest_rev)
- end
+ ctx.update(File.join(@wc_path, "non-exist"), youngest_rev)
ctx.add(path)
commit_info = ctx.commit(@wc_path)
@@ -573,16 +567,14 @@ class SvnClientTest < Test::Unit::TestCase
ctx.update([path], commit_info.revision))
assert_equal(content, File.read(path))
- assert_raise(Svn::Error::FS_NO_SUCH_REVISION) do
+ assert_raises(Svn::Error::FS_NO_SUCH_REVISION) do
begin
ctx.update(path, commit_info.revision + 1)
ensure
ctx.cleanup(@wc_path)
end
end
- assert_nothing_raised do
- ctx.update(path + "non-exist", commit_info.revision)
- end
+ ctx.update(path + "non-exist", commit_info.revision)
end
end
@@ -776,7 +768,7 @@ class SvnClientTest < Test::Unit::TestCase
ctx.prop_set(Svn::Core::PROP_MIME_TYPE, "image/DUMMY", path)
ctx.commit(@wc_path)
- assert_raise(Svn::Error::CLIENT_IS_BINARY_FILE) do
+ assert_raises(Svn::Error::CLIENT_IS_BINARY_FILE) do
ctx.ann(path) {}
end
end
@@ -938,7 +930,7 @@ class SvnClientTest < Test::Unit::TestCase
ctx.status(path) do |_, status|
statuses << status
end
- assert_not_equal([], statuses)
+ refute_empty(statuses)
end
def assert_not_changed(ctx, path)
@@ -946,7 +938,7 @@ class SvnClientTest < Test::Unit::TestCase
ctx.status(path) do |_, status|
statuses << status
end
- assert_equal([], statuses)
+ assert_empty(statuses)
end
def assert_merge
@@ -999,7 +991,7 @@ class SvnClientTest < Test::Unit::TestCase
],
merged_entries)
mergeinfo = ctx.merged(trunk)
- assert_not_nil(mergeinfo)
+ refute_nil(mergeinfo)
assert_equal([branch_uri], mergeinfo.keys)
ranges = mergeinfo[branch_uri].collect {|range| range.to_a}
assert_equal([[1, 2, true]], ranges)
@@ -1103,12 +1095,12 @@ class SvnClientTest < Test::Unit::TestCase
ctx.up(@wc_path, rev - 1)
File.open(path, "w") {|f| f.print(src)}
- assert_raise(Svn::Error::WC_OBSTRUCTED_UPDATE) do
+ assert_raises(Svn::Error::WC_OBSTRUCTED_UPDATE) do
ctx.up(@wc_path, rev)
end
Svn::Wc::AdmAccess.open(nil, @wc_path, true, -1) do |access|
- assert_raise(Svn::Error::WC_LOCKED) do
+ assert_raises(Svn::Error::WC_LOCKED) do
ctx.commit(@wc_path)
end
end
@@ -1117,21 +1109,17 @@ class SvnClientTest < Test::Unit::TestCase
raise Svn::Error::CANCELLED
end
Svn::Wc::AdmAccess.open(nil, @wc_path, true, -1) do |access|
- assert_raise(Svn::Error::CANCELLED) do
+ assert_raises(Svn::Error::CANCELLED) do
ctx.cleanup(@wc_path)
end
- assert_raise(Svn::Error::WC_LOCKED) do
+ assert_raises(Svn::Error::WC_LOCKED) do
ctx.commit(@wc_path)
end
end
ctx.set_cancel_func(nil)
- assert_nothing_raised do
- ctx.cleanup(@wc_path)
- end
- assert_nothing_raised do
- ctx.commit(@wc_path)
- end
+ ctx.cleanup(@wc_path)
+ ctx.commit(@wc_path)
end
end
=end
@@ -1147,9 +1135,7 @@ class SvnClientTest < Test::Unit::TestCase
ctx.add(path)
ctx.commit(@wc_path)
- assert_nothing_raised do
- ctx.cat(path)
- end
+ ctx.cat(path)
ctx.add_simple_prompt_provider(0) do |cred, realm, username, may_save|
cred.username = @author
@@ -1201,10 +1187,8 @@ class SvnClientTest < Test::Unit::TestCase
ctx.resolved(dir_path)
info = nil
- assert_nothing_raised do
- info = ctx.ci(@wc_path)
- end
- assert_not_nil(info)
+ info = ctx.ci(@wc_path)
+ refute_nil(info)
assert_equal(rev2 + 1, info.revision)
end
end
@@ -1294,15 +1278,11 @@ class SvnClientTest < Test::Unit::TestCase
ctx.ci(@wc_path)
File.open(path1, "w") {|f| f.print(src2)}
- assert_nothing_raised do
- ctx.mv(path1, path2)
- end
+ ctx.mv(path1, path2)
ctx.revert([path1, path2])
File.open(path1, "w") {|f| f.print(src2)}
- assert_nothing_raised do
- ctx.mv_f(path1, path2)
- end
+ ctx.mv_f(path1, path2)
notifies = []
ctx.set_notify_func do |notify|
@@ -1421,11 +1401,9 @@ class SvnClientTest < Test::Unit::TestCase
end
ctx.cleanup(@wc_path)
- assert_nothing_raised do
- ctx.ps(Svn::Core::PROP_MIME_TYPE,
- invalid_mime_type_prop_value,
- path, false, true)
- end
+ ctx.ps(Svn::Core::PROP_MIME_TYPE,
+ invalid_mime_type_prop_value,
+ path, false, true)
ctx.commit(@wc_path)
assert_equal({uri => invalid_mime_type_prop_value},
ctx.pg(Svn::Core::PROP_MIME_TYPE, path))
@@ -2145,17 +2123,15 @@ class SvnClientTest < Test::Unit::TestCase
setup_auth_baton(ctx.auth_baton)
ctx.auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = @author
ctx.add_username_provider
- assert_nothing_raised do
- ctx.revprop_set(Svn::Core::PROP_REVISION_LOG, new_log,
- repos_uri, info_revision)
- end
+ ctx.revprop_set(Svn::Core::PROP_REVISION_LOG, new_log,
+ repos_uri, info_revision)
end
Svn::Client::Context.new do |ctx|
setup_auth_baton(ctx.auth_baton)
ctx.auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = "#{@author}-NG"
ctx.add_username_provider
- assert_raise(Svn::Error::REPOS_HOOK_FAILURE) do
+ assert_raises(Svn::Error::REPOS_HOOK_FAILURE) do
ctx.revprop_set(Svn::Core::PROP_REVISION_LOG, new_log,
repos_uri, info_revision)
end
@@ -2166,7 +2142,7 @@ class SvnClientTest < Test::Unit::TestCase
ctx.auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = nil
ctx.add_username_prompt_provider(0) do |cred, realm, may_save|
end
- assert_raise(Svn::Error::REPOS_HOOK_FAILURE) do
+ assert_raises(Svn::Error::REPOS_HOOK_FAILURE) do
ctx.revprop_set(Svn::Core::PROP_REVISION_LOG, new_log,
repos_uri, info_revision)
end
@@ -2178,32 +2154,28 @@ class SvnClientTest < Test::Unit::TestCase
ctx.add_username_prompt_provider(0) do |cred, realm, may_save|
cred.username = @author
end
- assert_nothing_raised do
- ctx.revprop_set(Svn::Core::PROP_REVISION_LOG, new_log,
- repos_uri, info_revision)
- end
+ ctx.revprop_set(Svn::Core::PROP_REVISION_LOG, new_log,
+ repos_uri, info_revision)
end
end
def test_add_providers
Svn::Client::Context.new do |ctx|
- assert_nothing_raised do
- ctx.add_ssl_client_cert_file_provider
- ctx.add_ssl_client_cert_pw_file_provider
- ctx.add_ssl_server_trust_file_provider
- if Svn::Core.respond_to?(:auth_get_windows_ssl_server_trust_provider)
- ctx.add_windows_ssl_server_trust_provider
- end
+ ctx.add_ssl_client_cert_file_provider
+ ctx.add_ssl_client_cert_pw_file_provider
+ ctx.add_ssl_server_trust_file_provider
+ if Svn::Core.respond_to?(:auth_get_windows_ssl_server_trust_provider)
+ ctx.add_windows_ssl_server_trust_provider
end
end
end
def test_commit_item
- assert_raise(NoMethodError) do
+ assert_raises(NoMethodError) do
Svn::Client::CommitItem.new
end
- assert_raise(NoMethodError) do
+ assert_raises(NoMethodError) do
Svn::Client::CommitItem2.new
end
@@ -2259,7 +2231,7 @@ class SvnClientTest < Test::Unit::TestCase
raise Svn::Error::Cancelled
end
ctx.mkdir(dir_path)
- assert_raise(Svn::Error::Cancelled) do
+ assert_raises(Svn::Error::Cancelled) do
ctx.commit(@wc_path)
end
end
@@ -2446,10 +2418,8 @@ class SvnClientTest < Test::Unit::TestCase
def test_resolve_base
assert_resolve(Svn::Wc::CONFLICT_CHOOSE_BASE) do |ctx,path|
info = nil
- assert_nothing_raised do
- info = ctx.ci(@wc_path)
- end
- assert_not_nil(info)
+ info = ctx.ci(@wc_path)
+ refute_nil(info)
assert_equal(3, info.revision)
assert_equal("", File.read(path))
@@ -2459,10 +2429,8 @@ class SvnClientTest < Test::Unit::TestCase
def test_resolve_theirs_full
assert_resolve(Svn::Wc::CONFLICT_CHOOSE_THEIRS_FULL) do |ctx,path|
info = nil
- assert_nothing_raised do
- info = ctx.ci(@wc_path)
- end
- assert_not_nil(info)
+ info = ctx.ci(@wc_path)
+ refute_nil(info)
assert_equal(-1, info.revision)
assert_equal("before\n", File.read(path))
@@ -2472,10 +2440,8 @@ class SvnClientTest < Test::Unit::TestCase
def test_resolve_mine_full
assert_resolve(Svn::Wc::CONFLICT_CHOOSE_MINE_FULL) do |ctx,path|
info = nil
- assert_nothing_raised do
- info = ctx.ci(@wc_path)
- end
- assert_not_nil(info)
+ info = ctx.ci(@wc_path)
+ refute_nil(info)
assert_equal(3, info.revision)
assert_equal("after\n", File.read(path))
@@ -2485,10 +2451,8 @@ class SvnClientTest < Test::Unit::TestCase
def test_resolve_theirs_conflict
assert_resolve(Svn::Wc::CONFLICT_CHOOSE_THEIRS_FULL) do |ctx,path|
info = nil
- assert_nothing_raised do
- info = ctx.ci(@wc_path)
- end
- assert_not_nil(info)
+ info = ctx.ci(@wc_path)
+ refute_nil(info)
assert_equal(-1, info.revision)
assert_equal("before\n", File.read(path))
@@ -2498,10 +2462,8 @@ class SvnClientTest < Test::Unit::TestCase
def test_resolve_mine_conflict
assert_resolve(Svn::Wc::CONFLICT_CHOOSE_MINE_FULL) do |ctx,path|
info = nil
- assert_nothing_raised do
- info = ctx.ci(@wc_path)
- end
- assert_not_nil(info)
+ info = ctx.ci(@wc_path)
+ refute_nil(info)
assert_equal(3, info.revision)
assert_equal("after\n", File.read(path))
@@ -2511,10 +2473,8 @@ class SvnClientTest < Test::Unit::TestCase
def test_resolve_merged
assert_resolve(Svn::Wc::CONFLICT_CHOOSE_MERGED) do |ctx,path|
info = nil
- assert_nothing_raised do
- info = ctx.ci(@wc_path)
- end
- assert_not_nil(info)
+ info = ctx.ci(@wc_path)
+ refute_nil(info)
assert_equal(3, info.revision)
assert_equal("<<<<<<< .mine\nafter\n||||||| .r1\n=======\nbefore\n>>>>>>> .r2\n",
diff --git a/subversion/bindings/swig/ruby/test/test_core.rb b/subversion/bindings/swig/ruby/test/test_core.rb
index 9d5743c..9a93da1 100644
--- a/subversion/bindings/swig/ruby/test/test_core.rb
+++ b/subversion/bindings/swig/ruby/test/test_core.rb
@@ -26,7 +26,7 @@ require "stringio"
require "svn/core"
require "svn/repos"
-class SvnCoreTest < Test::Unit::TestCase
+class SvnCoreTest < Minitest::Test
include SvnTestUtil
def setup
@@ -66,7 +66,7 @@ class SvnCoreTest < Test::Unit::TestCase
end
def test_not_new_auth_provider_object
- assert_raise(NoMethodError) do
+ assert_raises(NoMethodError) do
Svn::Core::AuthProviderObject.new
end
end
@@ -97,7 +97,7 @@ class SvnCoreTest < Test::Unit::TestCase
ver2 = Svn::Core::Version.new(major, minor, patch, tag)
ver3 = Svn::Core::Version.new
assert_equal(ver1, ver2)
- assert_not_equal(ver1, ver3)
+ refute_equal(ver1, ver3)
end
def test_version_compatible?
@@ -149,7 +149,7 @@ class SvnCoreTest < Test::Unit::TestCase
auth[key] = value
assert_equal(value, auth[key])
- assert_raise(TypeError) do
+ assert_raises(TypeError) do
auth[key] = 1
end
end
@@ -788,11 +788,11 @@ EOM
def test_mergeinfo_to_s
info = Svn::Core::MergeInfo.parse("/trunk: 5,7,9-13")
assert_equal("/trunk:5,7,9-13", info.to_s)
- assert_not_equal(info.to_s, info.inspect)
+ refute_equal(info.to_s, info.inspect)
info = Svn::Core::MergeInfo.parse("/trunk: 5*,7,9-13")
assert_equal("/trunk:5*,7,9-13", info.to_s)
- assert_not_equal(info.to_s, info.inspect)
+ refute_equal(info.to_s, info.inspect)
end
def test_mergeinfo_sort
@@ -861,7 +861,7 @@ EOM
[6, 8, true], [9, 13, true])
expectation = "5-6,7-8,10-13"
assert_equal(expectation, range_list.to_s)
- assert_not_equal(expectation, range_list.inspect)
+ refute_equal(expectation, range_list.inspect)
end
def test_mergerange_equality
@@ -871,8 +871,8 @@ EOM
mergerange4 = Svn::Core::MergeRange.new(1,4,true)
assert_equal(mergerange1, mergerange2)
- assert_not_equal(mergerange1, mergerange3)
- assert_not_equal(mergerange1, mergerange4)
+ refute_equal(mergerange1, mergerange3)
+ refute_equal(mergerange1, mergerange4)
end
private
diff --git a/subversion/bindings/swig/ruby/test/test_delta.rb b/subversion/bindings/swig/ruby/test/test_delta.rb
index 541a4fe..1c60710 100644
--- a/subversion/bindings/swig/ruby/test/test_delta.rb
+++ b/subversion/bindings/swig/ruby/test/test_delta.rb
@@ -26,7 +26,7 @@ require 'tempfile'
require "svn/info"
-class SvnDeltaTest < Test::Unit::TestCase
+class SvnDeltaTest < Minitest::Test
include SvnTestUtil
def setup
@@ -48,23 +48,20 @@ class SvnDeltaTest < Test::Unit::TestCase
target = StringIO.new(t)
stream = Svn::Delta::TextDeltaStream.new(source, target)
assert_nil(stream.md5_digest)
- _my_assert_block do
- ret = stream.each do |window|
- window.ops.each do |op|
- op_size = op.offset + op.length
- case op.action_code
- when Svn::Delta::TXDELTA_SOURCE
- assert_operator(op_size, :<=, window.sview_len)
- when Svn::Delta::TXDELTA_NEW
- assert_operator(op_size, :<=, window.new_data.length)
- when Svn::Delta::TXDELTA_TARGET
- assert_operator(op_size, :<=, window.tview_len)
- else
- flunk
- end
+ stream.each do |window|
+ window.ops.each do |op|
+ op_size = op.offset + op.length
+ case op.action_code
+ when Svn::Delta::TXDELTA_SOURCE
+ assert_operator(op_size, :<=, window.sview_len)
+ when Svn::Delta::TXDELTA_NEW
+ assert_operator(op_size, :<=, window.new_data.length)
+ when Svn::Delta::TXDELTA_TARGET
+ assert_operator(op_size, :<=, window.tview_len)
+ else
+ flunk
end
end
- true if RUBY_VERSION > '1.9' # this block returns nil in > ruby '1.9'
end
assert_equal(Digest::MD5.hexdigest(t), stream.md5_digest)
end
@@ -84,19 +81,17 @@ class SvnDeltaTest < Test::Unit::TestCase
end
end
- _my_assert_block do
- composed_window.ops.each do |op|
- op_size = op.offset + op.length
- case op.action_code
- when Svn::Delta::TXDELTA_SOURCE
- assert_operator(op_size, :<=, composed_window.sview_len)
- when Svn::Delta::TXDELTA_NEW
- assert_operator(op_size, :<=, composed_window.new_data.length)
- when Svn::Delta::TXDELTA_TARGET
- assert_operator(op_size, :<=, composed_window.tview_len)
- else
- flunk
- end
+ composed_window.ops.each do |op|
+ op_size = op.offset + op.length
+ case op.action_code
+ when Svn::Delta::TXDELTA_SOURCE
+ assert_operator(op_size, :<=, composed_window.sview_len)
+ when Svn::Delta::TXDELTA_NEW
+ assert_operator(op_size, :<=, composed_window.new_data.length)
+ when Svn::Delta::TXDELTA_TARGET
+ assert_operator(op_size, :<=, composed_window.tview_len)
+ else
+ flunk
end
end
end
diff --git a/subversion/bindings/swig/ruby/test/test_error.rb b/subversion/bindings/swig/ruby/test/test_error.rb
index 5b55687..14f8bf2 100644
--- a/subversion/bindings/swig/ruby/test/test_error.rb
+++ b/subversion/bindings/swig/ruby/test/test_error.rb
@@ -21,7 +21,7 @@ require "my-assertions"
require "svn/error"
-class SvnErrorTest < Test::Unit::TestCase
+class SvnErrorTest < Minitest::Test
def test_error_name
Svn::Error.constants.each do |const_name|
if /\A[A-Z0-9_]+\z/ =~ const_name and
diff --git a/subversion/bindings/swig/ruby/test/test_fs.rb b/subversion/bindings/swig/ruby/test/test_fs.rb
index 8808055..73475e8 100644
--- a/subversion/bindings/swig/ruby/test/test_fs.rb
+++ b/subversion/bindings/swig/ruby/test/test_fs.rb
@@ -27,7 +27,7 @@ require "svn/fs"
require "svn/repos"
require "svn/client"
-class SvnFsTest < Test::Unit::TestCase
+class SvnFsTest < Minitest::Test
include SvnTestUtil
def setup
@@ -240,9 +240,7 @@ class SvnFsTest < Test::Unit::TestCase
assert_equal(txn1.base_revision, txn1.root.base_revision)
@fs.transaction do |txn|
- assert_nothing_raised do
- @fs.open_txn(txn.name)
- end
+ @fs.open_txn(txn.name)
txn2 = txn
end
@@ -451,9 +449,7 @@ class SvnFsTest < Test::Unit::TestCase
yield(:create, [path, config], Proc.new{})
- assert_nothing_raised do
- yield(:recover, [path], Proc.new{})
- end
+ yield(:recover, [path], Proc.new{})
end
def test_recover_for_backward_compatibility
diff --git a/subversion/bindings/swig/ruby/test/test_info.rb b/subversion/bindings/swig/ruby/test/test_info.rb
index e69ab79..91af535 100644
--- a/subversion/bindings/swig/ruby/test/test_info.rb
+++ b/subversion/bindings/swig/ruby/test/test_info.rb
@@ -21,7 +21,7 @@ require "util"
require "svn/info"
-class SvnInfoTest < Test::Unit::TestCase
+class SvnInfoTest < Minitest::Test
include SvnTestUtil
def setup
diff --git a/subversion/bindings/swig/ruby/test/test_ra.rb b/subversion/bindings/swig/ruby/test/test_ra.rb
index 1d20ca4..d58cc6b 100644
--- a/subversion/bindings/swig/ruby/test/test_ra.rb
+++ b/subversion/bindings/swig/ruby/test/test_ra.rb
@@ -21,7 +21,7 @@ require "util"
require "svn/ra"
-class SvnRaTest < Test::Unit::TestCase
+class SvnRaTest < Minitest::Test
include SvnTestUtil
def setup
@@ -43,9 +43,7 @@ class SvnRaTest < Test::Unit::TestCase
end
def test_open_without_callback
- assert_nothing_raised do
- Svn::Ra::Session.open(@repos_uri).close
- end
+ Svn::Ra::Session.open(@repos_uri).close
end
def test_session
@@ -377,18 +375,18 @@ class SvnRaTest < Test::Unit::TestCase
entries, props = session.dir(dir, nil)
assert_equal([deep_dir], entries.keys)
- assert_raise(Svn::Error::FS_NOT_FOUND) do
+ assert_raises(Svn::Error::FS_NOT_FOUND) do
session.dir(deep_dir)
end
session.reparent("#{@repos_uri}/#{dir}")
- assert_raise(Svn::Error::FS_NOT_FOUND) do
+ assert_raises(Svn::Error::FS_NOT_FOUND) do
session.dir(dir)
end
entries, props = session.dir(deep_dir)
assert_equal([], entries.keys)
- assert_raise(Svn::Error::RA_ILLEGAL_URL) do
+ assert_raises(Svn::Error::RA_ILLEGAL_URL) do
session.reparent("file:///tmp/xxx")
end
end
diff --git a/subversion/bindings/swig/ruby/test/test_repos.rb b/subversion/bindings/swig/ruby/test/test_repos.rb
index 89ca8c1..96d158e 100644
--- a/subversion/bindings/swig/ruby/test/test_repos.rb
+++ b/subversion/bindings/swig/ruby/test/test_repos.rb
@@ -27,7 +27,7 @@ require "svn/fs"
require "svn/repos"
require "svn/client"
-class SvnReposTest < Test::Unit::TestCase
+class SvnReposTest < Minitest::Test
include SvnTestUtil
def setup
@@ -614,12 +614,10 @@ class SvnReposTest < Test::Unit::TestCase
assert_raises(Svn::Error::ReposHookFailure) do
@repos.set_prop(@author, Svn::Core::PROP_REVISION_DATE, nil)
end
- assert_not_nil(@repos.prop(Svn::Core::PROP_REVISION_DATE))
+ refute_nil(@repos.prop(Svn::Core::PROP_REVISION_DATE))
- assert_nothing_raised do
- @repos.set_prop(@author, Svn::Core::PROP_REVISION_DATE, nil, nil, nil,
- false)
- end
+ @repos.set_prop(@author, Svn::Core::PROP_REVISION_DATE, nil, nil, nil,
+ false)
assert_nil(@repos.prop(Svn::Core::PROP_REVISION_DATE))
assert_equal([
Svn::Core::PROP_REVISION_AUTHOR,
@@ -642,9 +640,7 @@ class SvnReposTest < Test::Unit::TestCase
File.open(path, "a") {|f| f.print(source)}
rev2 = ctx.ci(@wc_path).revision
- assert_nothing_raised do
- @repos.dump_fs(nil, nil, rev1, rev2)
- end
+ @repos.dump_fs(nil, nil, rev1, rev2)
dump = StringIO.new("")
feedback = StringIO.new("")
@@ -690,8 +686,8 @@ class SvnReposTest < Test::Unit::TestCase
].each_with_index do |args, i|
dest_path = File.join(@tmp_path, "dest#{i}")
Svn::Repos.create(dest_path) do |repos|
- assert_not_equal(@repos.fs.root.committed_info("/"),
- repos.fs.root.committed_info("/"))
+ refute_equal(@repos.fs.root.committed_info("/"),
+ repos.fs.root.committed_info("/"))
dump.rewind
repos.load_fs(dump, *args)
assert_equal(@repos.fs.root.committed_info("/"),
diff --git a/subversion/bindings/swig/ruby/test/test_util.rb b/subversion/bindings/swig/ruby/test/test_util.rb
index 5f9b1ac..595fe67 100644
--- a/subversion/bindings/swig/ruby/test/test_util.rb
+++ b/subversion/bindings/swig/ruby/test/test_util.rb
@@ -22,7 +22,7 @@ require "my-assertions"
require "svn/core"
require "svn/util"
-class SvnUtilTest < Test::Unit::TestCase
+class SvnUtilTest < Minitest::Test
def test_to_ruby_const_name
assert_equal("ABC", Svn::Util.to_ruby_const_name("abc"))
diff --git a/subversion/bindings/swig/ruby/test/test_wc.rb b/subversion/bindings/swig/ruby/test/test_wc.rb
index 3a2aa65..43fe655 100644
--- a/subversion/bindings/swig/ruby/test/test_wc.rb
+++ b/subversion/bindings/swig/ruby/test/test_wc.rb
@@ -25,7 +25,7 @@ require "svn/wc"
require "svn/repos"
require "svn/ra"
-class SvnWcTest < Test::Unit::TestCase
+class SvnWcTest < Minitest::Test
include SvnTestUtil
def setup
@@ -51,9 +51,7 @@ class SvnWcTest < Test::Unit::TestCase
end
non_exist_child_path = File.join(@wc_path, "NOT-EXIST")
- assert_nothing_raised do
- Svn::Wc::AdmAccess.probe_open(nil, non_exist_child_path, false, 0){}
- end
+ Svn::Wc::AdmAccess.probe_open(nil, non_exist_child_path, false, 0){}
FileUtils.touch(file1_path)
Svn::Wc::AdmAccess.open(nil, @wc_path, false, 0) do |adm|
@@ -81,7 +79,7 @@ class SvnWcTest < Test::Unit::TestCase
end
def test_wc
- assert_not_equal(0, Svn::Wc.check_wc(@wc_path))
+ refute_equal(0, Svn::Wc.check_wc(@wc_path))
assert(Svn::Wc.normal_prop?("name"))
assert(Svn::Wc.wc_prop?("#{Svn::Core::PROP_WC_PREFIX}name"))
assert(Svn::Wc.entry_prop?("#{Svn::Core::PROP_ENTRY_PREFIX}name"))
@@ -534,25 +532,23 @@ EOE
ctx.ci(lf_path)
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
- _my_assert_block do
- File.open(src_path, "wb") {|f| f.print(source)}
- args = [method_name, src_path, crlf_path, Svn::Wc::TRANSLATE_FROM_NF]
- result = yield(access.send(*args), source)
- result ||= File.open(src_path, "rb") {|f| f.read}
- assert_equal(crlf_source, result)
-
- File.open(src_path, "wb") {|f| f.print(source)}
- args = [method_name, src_path, cr_path, Svn::Wc::TRANSLATE_FROM_NF]
- result = yield(access.send(*args), source)
- result ||= File.open(src_path, "rb") {|f| f.read}
- assert_equal(cr_source, result)
-
- File.open(src_path, "wb") {|f| f.print(source)}
- args = [method_name, src_path, lf_path, Svn::Wc::TRANSLATE_FROM_NF]
- result = yield(access.send(*args), source)
- result ||= File.open(src_path, "rb") {|f| f.read}
- assert_equal(lf_source, result)
- end
+ File.open(src_path, "wb") {|f| f.print(source)}
+ args = [method_name, src_path, crlf_path, Svn::Wc::TRANSLATE_FROM_NF]
+ result = yield(access.send(*args), source)
+ result ||= File.open(src_path, "rb") {|f| f.read}
+ assert_equal(crlf_source, result)
+
+ File.open(src_path, "wb") {|f| f.print(source)}
+ args = [method_name, src_path, cr_path, Svn::Wc::TRANSLATE_FROM_NF]
+ result = yield(access.send(*args), source)
+ result ||= File.open(src_path, "rb") {|f| f.read}
+ assert_equal(cr_source, result)
+
+ File.open(src_path, "wb") {|f| f.print(source)}
+ args = [method_name, src_path, lf_path, Svn::Wc::TRANSLATE_FROM_NF]
+ result = yield(access.send(*args), source)
+ result ||= File.open(src_path, "rb") {|f| f.read}
+ assert_equal(lf_source, result)
end
end
end
@@ -1053,7 +1049,7 @@ EOE
def test_context_new_default_config
- assert_not_nil context = Svn::Wc::Context.new
+ refute_nil context = Svn::Wc::Context.new
ensure
context.destroy
end
@@ -1061,22 +1057,20 @@ EOE
def test_context_new_specified_config
config_file = File.join(@config_path, Svn::Core::CONFIG_CATEGORY_CONFIG)
config = Svn::Core::Config.read(config_file)
- assert_not_nil context = Svn::Wc::Context.new(:config=>config)
+ refute_nil context = Svn::Wc::Context.new(:config=>config)
ensure
context.destroy
end
def test_context_create
- assert_nothing_raised do
- result = Svn::Wc::Context.create do |context|
- assert_not_nil context
- assert_kind_of Svn::Wc::Context, context
- end
- if RUBY_VERSION > '1.9'
- assert_equal(result,true)
- else
- assert_nil result
- end
+ result = Svn::Wc::Context.create do |context|
+ refute_nil context
+ assert_kind_of Svn::Wc::Context, context
+ end
+ if RUBY_VERSION > '1.9'
+ assert_equal(result,true)
+ else
+ assert_nil result
end
end
--
2.6.2
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by Philip Martin <ph...@wandisco.com>.
James McCoy <ja...@debian.org> writes:
> Yeah, if you install the ruby-minitest gem, you also need to install the
> ruby-test-unit gem.
>
> Mixing the built-in version of one with the gem version of the other
> doesn't work well, due to the behavior changes.
So it's really a Ruby problem: allowing incompatible components. I
originally installed ruby-minitest for your first patch.
I'm happy to commit this, it's r1714790.
--
Philip Martin
WANdisco
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by James McCoy <ja...@debian.org>.
On Nov 17, 2015 8:07 AM, "Philip Martin" <ph...@wandisco.com> wrote:
>
> Philip Martin <ph...@wandisco.com> writes:
>
> > James McCoy <ja...@debian.org> writes:
> >
> >> On Mon, Nov 09, 2015 at 12:15:51AM -0500, James McCoy wrote:
> >>> On Sat, Nov 07, 2015 at 10:09:37PM -0500, James McCoy wrote:
> >>> > The attached patch, however, at least gets the test suite working
with
> >>> > the test-unit gem, which is a pre-requisite for testing against Ruby
> >>> > 2.2.
> >>>
> >>> Updated to fix a typo in Makefile.in.
> >>
> >> Ping?
> >
> > Doesn't work on my Debian/stable box if I have the ruby-minitest package
> > installed. I think check_rb() is failing with:
> >
> > /usr/lib/ruby/2.1.0/test/unit.rb:676:in `<class:Runner>': undefined
method `_run_suite' for class `Test::Unit::Runner' (NameError)
> >
> > If I don't have ruby-minitest installed then the tests work. It appears
> > that ruby comes with minitest 4.7.5 and that works, but ruby-mintest
> > installs 5.4.2 and that fails.
>
> Hmm, the same problem affects the current code so this is not a new
> problem introduced by your patch.
Yeah, if you install the ruby-minitest gem, you also need to install the
ruby-test-unit gem.
Mixing the built-in version of one with the gem version of the other
doesn't work well, due to the behavior changes.
Cheers,
James
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by Philip Martin <ph...@wandisco.com>.
Philip Martin <ph...@wandisco.com> writes:
> James McCoy <ja...@debian.org> writes:
>
>> On Mon, Nov 09, 2015 at 12:15:51AM -0500, James McCoy wrote:
>>> On Sat, Nov 07, 2015 at 10:09:37PM -0500, James McCoy wrote:
>>> > The attached patch, however, at least gets the test suite working with
>>> > the test-unit gem, which is a pre-requisite for testing against Ruby
>>> > 2.2.
>>>
>>> Updated to fix a typo in Makefile.in.
>>
>> Ping?
>
> Doesn't work on my Debian/stable box if I have the ruby-minitest package
> installed. I think check_rb() is failing with:
>
> /usr/lib/ruby/2.1.0/test/unit.rb:676:in `<class:Runner>': undefined method `_run_suite' for class `Test::Unit::Runner' (NameError)
>
> If I don't have ruby-minitest installed then the tests work. It appears
> that ruby comes with minitest 4.7.5 and that works, but ruby-mintest
> installs 5.4.2 and that fails.
Hmm, the same problem affects the current code so this is not a new
problem introduced by your patch.
--
Philip Martin
WANdisco
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by Philip Martin <ph...@wandisco.com>.
James McCoy <ja...@debian.org> writes:
> On Mon, Nov 09, 2015 at 12:15:51AM -0500, James McCoy wrote:
>> On Sat, Nov 07, 2015 at 10:09:37PM -0500, James McCoy wrote:
>> > The attached patch, however, at least gets the test suite working with
>> > the test-unit gem, which is a pre-requisite for testing against Ruby
>> > 2.2.
>>
>> Updated to fix a typo in Makefile.in.
>
> Ping?
Doesn't work on my Debian/stable box if I have the ruby-minitest package
installed. I think check_rb() is failing with:
/usr/lib/ruby/2.1.0/test/unit.rb:676:in `<class:Runner>': undefined method `_run_suite' for class `Test::Unit::Runner' (NameError)
If I don't have ruby-minitest installed then the tests work. It appears
that ruby comes with minitest 4.7.5 and that works, but ruby-mintest
installs 5.4.2 and that fails.
Full error:
$ make check-swig-rb
if [ "LD_LIBRARY_PATH" = "DYLD_LIBRARY_PATH" ]; then for d in /home/pm/sw/subversion/obj/subversion/bindings/swig/ruby/libsvn_swig_ruby /home/pm/sw/subversion/obj/subversion/bindings/swig/ruby/../../../libsvn_*; do if [ -n "$DYLD_LIBRARY_PATH" ]; then LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$d/.libs"; else LD_LIBRARY_PATH="$d/.libs"; fi; done; export LD_LIBRARY_PATH; fi; \
cd /home/pm/sw/subversion/obj/subversion/bindings/swig/ruby; \
check_rb() { \
/usr/bin/ruby -I /home/pm/sw/subversion/obj/../src/subversion/bindings/swig/ruby /home/pm/sw/subversion/obj/../src/subversion/bindings/swig/ruby/test/run-test.rb "$@"; \
}; \
if check_rb --help 2>&1 | grep -q -- --collector; then \
check_rb --collector=dir --verbose=normal; \
elif [ "2" -eq 1 -a "1" -lt 9 ] ; then \
check_rb --verbose=normal; \
else \
check_rb; \
fi
Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
From:
/usr/lib/ruby/2.1.0/test/unit.rb:1:in `<top (required)>'
/home/pm/sw/subversion/obj/../src/subversion/bindings/swig/ruby/test/run-test.rb:22:in `<main>'
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/lib/ruby/2.1.0/test/unit/testcase.rb:8:in `<module:Unit>'
/usr/lib/ruby/2.1.0/test/unit.rb:676:in `<class:Runner>': undefined method `_run_suite' for class `Test::Unit::Runner' (NameError)
from /usr/lib/ruby/2.1.0/test/unit.rb:261:in `<module:Unit>'
from /usr/lib/ruby/2.1.0/test/unit.rb:15:in `<module:Test>'
from /usr/lib/ruby/2.1.0/test/unit.rb:7:in `<top (required)>'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/pm/sw/subversion/obj/../src/subversion/bindings/swig/ruby/test/run-test.rb:22:in `<main>'
Makefile:922: recipe for target 'check-swig-rb' failed
make: *** [check-swig-rb] Error 1
--
Philip Martin
WANdisco
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by James McCoy <ja...@debian.org>.
On Mon, Nov 09, 2015 at 12:15:51AM -0500, James McCoy wrote:
> On Sat, Nov 07, 2015 at 10:09:37PM -0500, James McCoy wrote:
> > The attached patch, however, at least gets the test suite working with
> > the test-unit gem, which is a pre-requisite for testing against Ruby
> > 2.2.
>
> Updated to fix a typo in Makefile.in.
Ping?
Cheers,
--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <ja...@debian.org>
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by James McCoy <ja...@debian.org>.
On Sat, Nov 07, 2015 at 10:09:37PM -0500, James McCoy wrote:
> The attached patch, however, at least gets the test suite working with
> the test-unit gem, which is a pre-requisite for testing against Ruby
> 2.2.
Updated to fix a typo in Makefile.in.
Cheers,
--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <ja...@debian.org>
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by James McCoy <ja...@debian.org>.
On Fri, Nov 06, 2015 at 10:56:49AM -0500, James McCoy wrote:
> On Nov 5, 2015 6:27 AM, "Philip Martin" <ph...@wandisco.com> wrote:
> >
> > James McCoy <ja...@debian.org> writes:
> >
> > > Ruby 2.2 changed test/unit from an in-tree wrapper around minitest
> > > 4 to a bundled version of the externally maintained ruby-test-unit gem.
> > > Similarly, the in-tree minitest was removed and the externally
> > > maintained ruby-minitest gem (of the 5.x series) is bundled. These
> > > changes broke check-swig-rb, since the test framework APIs behave
> > > differently.
> >
> > This patch works on my Debian/stable system but not on CentOS 7 which
> > only has minitest 4.3.2.
>
> I've taken a look at instead supporting various versions of test-unit and
> should have a patch available tonight. I just need to do some more testing.
There's an outstanding issue that I've found in test_repos.rb's
test_load due to trying to modify a nil value, when Ruby 2.2 made
"frozen". I'll follow up on this in another email.
The attached patch, however, at least gets the test suite working with
the test-unit gem, which is a pre-requisite for testing against Ruby
2.2.
[[[
Adapt Ruby tests to work with test-unit gem.
Ruby 2.2 bundles the test-unit gem instead of using the older "test-unit
API provided by minitest". This also fixes testing when the test-unit
gem happens to be installed along with older Ruby versions.
* Makefile.in:
(check-swig-rb): Detect whether test-unit supports the --collector
argument and, if so, use the dir collector.
* subversion/bindings/swig/ruby/test/my-assertions.rb:
(_my_assert_block): Remove unnecessary assert_block.
* subversion/bindings/swig/ruby/test/test_wc.rb:
(test_context_create): Remove useless assertion on result of
Svn::Wc::Create, especially since it varies based on Ruby version.
]]]
--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <ja...@debian.org>
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by James McCoy <ja...@debian.org>.
On Nov 5, 2015 6:27 AM, "Philip Martin" <ph...@wandisco.com> wrote:
>
> James McCoy <ja...@debian.org> writes:
>
> > Ruby 2.2 changed test/unit from an in-tree wrapper around minitest
> > 4 to a bundled version of the externally maintained ruby-test-unit gem.
> > Similarly, the in-tree minitest was removed and the externally
> > maintained ruby-minitest gem (of the 5.x series) is bundled. These
> > changes broke check-swig-rb, since the test framework APIs behave
> > differently.
>
> This patch works on my Debian/stable system but not on CentOS 7 which
> only has minitest 4.3.2.
I've taken a look at instead supporting various versions of test-unit and
should have a patch available tonight. I just need to do some more testing.
Cheers,
James
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by Philip Martin <ph...@wandisco.com>.
James McCoy <ja...@debian.org> writes:
> As an independent package or as part of the Ruby package?
The minitest available via yum is rubygem-minitest 4.3.2. I suppose
I could install a separate gem.
--
Philip Martin
WANdisco
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by James McCoy <ja...@debian.org>.
On Thu, Nov 05, 2015 at 11:27:23AM +0000, Philip Martin wrote:
> James McCoy <ja...@debian.org> writes:
>
> > Ruby 2.2 changed test/unit from an in-tree wrapper around minitest
> > 4 to a bundled version of the externally maintained ruby-test-unit gem.
> > Similarly, the in-tree minitest was removed and the externally
> > maintained ruby-minitest gem (of the 5.x series) is bundled. These
> > changes broke check-swig-rb, since the test framework APIs behave
> > differently.
>
> This patch works on my Debian/stable system but not on CentOS 7 which
> only has minitest 4.3.2.
As an independent package or as part of the Ruby package? The minitest
that was shipped with Ruby pre-2.2 was the 4.x series, even though there
the external minitest was already at 5.x.
Annoyingly both test frameworks had backwards incompatible changes
between the versions that were previously in-tree and the now bundled
versions.
Cheers,
--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <ja...@debian.org>
Re: [PATCH] Convert Ruby tests from test-unit to minitest
Posted by Philip Martin <ph...@wandisco.com>.
James McCoy <ja...@debian.org> writes:
> Ruby 2.2 changed test/unit from an in-tree wrapper around minitest
> 4 to a bundled version of the externally maintained ruby-test-unit gem.
> Similarly, the in-tree minitest was removed and the externally
> maintained ruby-minitest gem (of the 5.x series) is bundled. These
> changes broke check-swig-rb, since the test framework APIs behave
> differently.
This patch works on my Debian/stable system but not on CentOS 7 which
only has minitest 4.3.2.
--
Philip Martin
WANdisco