On Fri, Nov 06, 2015 at 10:56:49AM -0500, James McCoy wrote:
> On Nov 5, 2015 6:27 AM, "Philip Martin" <philip.mar...@wandisco.com> wrote:
> >
> > James McCoy <james...@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 <james...@debian.org>
commit 8517b4e66b659be66b32970ffe6115b3620bb4d9
Author: James McCoy <james...@debian.org>
Date:   Sat Nov 7 22:00:59 2015 -0500

    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.

diff --git a/Makefile.in b/Makefile.in
index fbac5ab..509eaf0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -921,13 +921,15 @@ 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 \
-	    $(RUBY) -I $(SWIG_RB_SRC_DIR) \
-	      $(SWIG_RB_SRC_DIR)/test/run-test.rb; \
+	  check_rb() { \
+	    $(RUBY) -I $(SWIG_RB_SRC_DIR) $(SWIG_RB_SRC_DIR)/test/run-test.rb "$$@"; \
+	  }; \
+	  if check_rb --help 2>&1 | grep -q -- --collector; then \
+	    check_rb --collector=dir --verbose=$(SWIG_RB_TEST_VERBOSE); \
+	  if [ "$(RUBY_MAJOR)" -eq 1 -a "$(RUBY_MINOR)" -lt 9 ] ; then \
+	    check_rb --verbose=$(SWIG_RB_TEST_VERBOSE); \
+	  else \
+	    check_rb; \
           fi
 
 EXTRACLEAN_SWIG_RB=rm -f $(SWIG_RB_SRC_DIR)/svn_*.c $(SWIG_RB_SRC_DIR)/core.c
diff --git a/subversion/bindings/swig/ruby/test/my-assertions.rb b/subversion/bindings/swig/ruby/test/my-assertions.rb
index 77c42e7..0aa3d94 100644
--- a/subversion/bindings/swig/ruby/test/my-assertions.rb
+++ b/subversion/bindings/swig/ruby/test/my-assertions.rb
@@ -27,9 +27,7 @@ module Test
       # make an intermediary assertion block handler
       def _my_assert_block(&block)
        if RUBY_VERSION > '1.9'
-         assert_block do
-           yield
-         end
+         yield
        else
          _wrap_assertion do
            yield
diff --git a/subversion/bindings/swig/ruby/test/test_wc.rb b/subversion/bindings/swig/ruby/test/test_wc.rb
index 3a2aa65..763cbf6 100644
--- a/subversion/bindings/swig/ruby/test/test_wc.rb
+++ b/subversion/bindings/swig/ruby/test/test_wc.rb
@@ -1068,15 +1068,10 @@ EOE
 
   def test_context_create
     assert_nothing_raised do
-      result = Svn::Wc::Context.create do |context|
+      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
     end
   end
 

Reply via email to