Hello community,

here is the log from the commit of package rubygem-test-unit for 
openSUSE:Factory checked in at 2015-06-16 14:05:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-test-unit (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-test-unit.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-test-unit"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-test-unit/rubygem-test-unit.changes      
2015-06-12 20:30:35.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-test-unit.new/rubygem-test-unit.changes 
2015-06-16 14:06:14.000000000 +0200
@@ -1,0 +2,47 @@
+Fri Jun 12 04:36:59 UTC 2015 - co...@suse.com
+
+- updated to version 3.1.2
+ see installed news.md
+
+  ## 3.1.2 - 2015-06-09 {#version-3-1-2}
+  
+  It's command line option improvements fix release.
+  
+  ### Improvements
+  
+    * `--location`: Made path match rule more strict.
+      [Suggested by kimura wataru]
+      * Before:
+        * If test defined path ends with the specified path, the test is
+          matched.
+      * After:
+        * If base name of test defined path equals to the specified
+          path, the test is matched.
+        * If relative path of test defined path equals to the specified
+          path, the test is matched.
+        * If the specified path is absolute path and test defined path
+          equals to the specified path, the test is matched.
+    * `--pattern`: If the option is specified, the default patterns
+      aren't used. In the earlier versions, both the default patterns
+      and the specified patterns are used.
+      [Suggested by kimura wataru]
+  
+  ### Thanks
+  
+    * kimura wataru
+  
+  ## 3.1.1 - 2015-05-29 {#version-3-1-1}
+  
+  It's a bug fix release.
+  
+  ### Fixes
+  
+    * Fixed a bug that `--location` detects tests not only in sub test
+      case but also parent test case.
+      [GitHub#105][Reported by wanabe]
+  
+  ### Thanks
+  
+    * wanabe
+
+-------------------------------------------------------------------

Old:
----
  test-unit-3.1.0.gem

New:
----
  test-unit-3.1.2.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-test-unit.spec ++++++
--- /var/tmp/diff_new_pack.1i5NOQ/_old  2015-06-16 14:06:15.000000000 +0200
+++ /var/tmp/diff_new_pack.1i5NOQ/_new  2015-06-16 14:06:15.000000000 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-test-unit
-Version:        3.1.0
+Version:        3.1.2
 Release:        0
 %define mod_name test-unit
 %define mod_full_name %{mod_name}-%{version}

++++++ test-unit-3.1.0.gem -> test-unit-3.1.2.gem ++++++
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doc/text/news.md new/doc/text/news.md
--- old/doc/text/news.md        2015-05-28 05:03:43.000000000 +0200
+++ new/doc/text/news.md        2015-06-09 15:27:09.000000000 +0200
@@ -1,5 +1,46 @@
 # News
 
+## 3.1.2 - 2015-06-09 {#version-3-1-2}
+
+It's command line option improvements fix release.
+
+### Improvements
+
+  * `--location`: Made path match rule more strict.
+    [Suggested by kimura wataru]
+    * Before:
+      * If test defined path ends with the specified path, the test is
+        matched.
+    * After:
+      * If base name of test defined path equals to the specified
+        path, the test is matched.
+      * If relative path of test defined path equals to the specified
+        path, the test is matched.
+      * If the specified path is absolute path and test defined path
+        equals to the specified path, the test is matched.
+  * `--pattern`: If the option is specified, the default patterns
+    aren't used. In the earlier versions, both the default patterns
+    and the specified patterns are used.
+    [Suggested by kimura wataru]
+
+### Thanks
+
+  * kimura wataru
+
+## 3.1.1 - 2015-05-29 {#version-3-1-1}
+
+It's a bug fix release.
+
+### Fixes
+
+  * Fixed a bug that `--location` detects tests not only in sub test
+    case but also parent test case.
+    [GitHub#105][Reported by wanabe]
+
+### Thanks
+
+  * wanabe
+
 ## 3.1.0 - 2015-05-28 {#version-3-1-0}
 
 It's a bug fix release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/test/unit/autorunner.rb 
new/lib/test/unit/autorunner.rb
--- old/lib/test/unit/autorunner.rb     2015-05-28 05:03:43.000000000 +0200
+++ new/lib/test/unit/autorunner.rb     2015-06-09 15:27:09.000000000 +0200
@@ -87,8 +87,12 @@
       register_collector(:load) do |auto_runner|
         require 'test/unit/collector/load'
         collector = Collector::Load.new
-        collector.patterns.concat(auto_runner.pattern) if auto_runner.pattern
-        collector.excludes.concat(auto_runner.exclude) if auto_runner.exclude
+        unless auto_runner.pattern.empty?
+          collector.patterns.replace(auto_runner.pattern)
+        end
+        unless auto_runner.exclude.empty?
+          collector.excludes.replace(auto_runner.exclude)
+        end
         collector.base = auto_runner.base
         collector.filter = auto_runner.filters
         collector.collect(*auto_runner.to_run)
@@ -115,8 +119,12 @@
         require 'test/unit/collector/dir'
         c = Collector::Dir.new
         c.filter = auto_runner.filters
-        c.pattern.concat(auto_runner.pattern) if auto_runner.pattern
-        c.exclude.concat(auto_runner.exclude) if auto_runner.exclude
+        unless auto_runner.pattern.empty?
+          c.pattern.replace(auto_runner.pattern)
+        end
+        unless auto_runner.exclude.empty?
+          c.exclude.replace(auto_runner.exclude)
+        end
         c.base = auto_runner.base
         $:.push(auto_runner.base) if auto_runner.base
         c.collect(*(auto_runner.to_run.empty? ? ['.'] : auto_runner.to_run))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/test/unit/testcase.rb 
new/lib/test/unit/testcase.rb
--- old/lib/test/unit/testcase.rb       2015-05-28 05:03:43.000000000 +0200
+++ new/lib/test/unit/testcase.rb       2015-06-09 15:27:09.000000000 +0200
@@ -360,17 +360,16 @@
           query_line = query[:line]
           query_method_name = query[:method_name]
 
-          available_locations = method_locations
-          if query_path
-            available_locations = available_locations.find_all do |location|
-              location[:path].end_with?(query_path)
-            end
-          end
+          available_locations = target_method_locations(query_path)
           if query_line
-            available_location = available_locations.reverse.find do |location|
+            available_locations = available_locations.sort_by do |location|
+              -location[:line]
+            end
+            available_location = available_locations.find do |location|
               query_line >= location[:line]
             end
             return false if available_location.nil?
+            return false if available_location[:test_case] != self
             available_locations = [available_location]
           end
           if query_method_name
@@ -391,6 +390,28 @@
         def method_locations
           @@method_locations[self] ||= []
         end
+
+        # @private
+        def target_method_locations(path)
+          if path.nil?
+            self_location = method_locations.first
+            path = self_location[:path] if self_location
+          end
+          return [] if path.nil?
+
+          target_locations = []
+          @@method_locations.each do |test_case, locations|
+            locations.each do |location|
+              absolete_path = File.expand_path(path)
+              location_path = location[:path]
+              location_basename = File.basename(location_path)
+              if location_path == absolete_path or location_basename == path
+                target_locations << location.merge(:test_case => test_case)
+              end
+            end
+          end
+          target_locations
+        end
       end
 
       attr_reader :method_name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/test/unit/version.rb new/lib/test/unit/version.rb
--- old/lib/test/unit/version.rb        2015-05-28 05:03:43.000000000 +0200
+++ new/lib/test/unit/version.rb        2015-06-09 15:27:09.000000000 +0200
@@ -1,5 +1,5 @@
 module Test
   module Unit
-    VERSION = '3.1.0'
+    VERSION = '3.1.2'
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2015-05-28 05:03:43.000000000 +0200
+++ new/metadata        2015-06-09 15:27:09.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: test-unit
 version: !ruby/object:Gem::Version
-  version: 3.1.0
+  version: 3.1.2
 platform: ruby
 authors:
 - Kouhei Sutou
@@ -9,7 +9,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-05-28 00:00:00.000000000 Z
+date: 2015-06-09 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: power_assert
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/test-test-case.rb new/test/test-test-case.rb
--- old/test/test-test-case.rb  2015-05-28 05:03:43.000000000 +0200
+++ new/test/test-test-case.rb  2015-06-09 15:27:09.000000000 +0200
@@ -660,6 +660,28 @@
               end
               assert_true(test_case.test_defined?(:line => line_after))
             end
+
+            def test_child
+              child_test_case = nil
+              line_child = nil
+              parent_test_case = Class.new(TestCase) do
+                test "parent" do
+                end
+
+                child_test_case = Class.new(self) do
+                  line_child = __LINE__; test "child" do
+                  end
+                end
+              end
+              assert_equal([
+                             false,
+                             true,
+                           ],
+                           [
+                             parent_test_case.test_defined?(:line => 
line_child),
+                             child_test_case.test_defined?(:line => 
line_child),
+                           ])
+            end
           end
 
           class TestMethodStyle < self
@@ -691,6 +713,28 @@
               end
               assert_true(test_case.test_defined?(:line => line_after))
             end
+
+            def test_child
+              child_test_case = nil
+              line_child = nil
+              parent_test_case = Class.new(TestCase) do
+                test "parent" do
+                end
+
+                child_test_case = Class.new(self) do
+                  line_child = __LINE__; test "child" do
+                  end
+                end
+              end
+              assert_equal([
+                             false,
+                             true,
+                           ],
+                           [
+                             parent_test_case.test_defined?(:line => 
line_child),
+                             child_test_case.test_defined?(:line => 
line_child),
+                           ])
+            end
           end
         end
 


Reply via email to