test-unit 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9cfd2190829c1b6c4c0905528cdb5fc4a268628
4
- data.tar.gz: bf46e41d08f2611ac2525eaff7d8cbe80abdbb36
3
+ metadata.gz: bd5a2e8e6372713e4ae42dc006acfb16de09a67a
4
+ data.tar.gz: c747a09eee2677c68409c1624c76960457b132c7
5
5
  SHA512:
6
- metadata.gz: 614e4c8a515908878c257ae37d231a44cf2044b127d61c65d0d8aba63d1cf67494a13c21e73e62c093e6d7c43af65ffc6ca2c425c65bf26922c10bea33008d78
7
- data.tar.gz: 9bfde8f312ac6c198c2270ab32baf1e905e365e2bd36d40598d77a8ee39cac4b783bd88c9e5dc824a9e9ac7fe15e3b4730a34c0762c6c277046471457f59a932
6
+ metadata.gz: 7999814cc3207edb8859e365c2b7f9e16809c3981c08cb538c0bae723543398b7fec62c97b412dbc00bf853c165075f0347e1c13d4c02cf60221215eff5f810f
7
+ data.tar.gz: 056ce1b04bdd3255d2330ef089fc68ee6712f0fbd24fd192b57fb7f19ea289333dd57cfd602f7517e2156e2e6f1799fbc8a83373925913c2789b6f18c59415fe
data/COPYING CHANGED
@@ -61,4 +61,7 @@ version 2 (see the file GPL), or the conditions below:
61
61
  Exceptions
62
62
  ----------
63
63
 
64
- * lib/test/unit/diff.rb: PSFL
64
+ * lib/test/unit/diff.rb: This license, PSF license and/or LGPLv2.1
65
+ or later
66
+
67
+ * lib/test-unit.rb: This license and/or LGPLv2.1 or later
data/README.md CHANGED
@@ -57,8 +57,8 @@ This software is distributed under the same terms as ruby.
57
57
 
58
58
  Exception:
59
59
 
60
- * lib/test/unit/diff.rb is a double license of the Ruby license and
61
- PSF license.
60
+ * lib/test/unit/diff.rb is a triple license of the Ruby license,
61
+ PSF license and LGPLv2.1 or later.
62
62
 
63
63
  * lib/test-unit.rb is a dual license of the Ruby license and LGPLv2.1
64
64
  or later.
@@ -1,5 +1,23 @@
1
1
  # News
2
2
 
3
+ ## 3.2.1 - 2016-07-19 {#version-3-2-1}
4
+
5
+ ### Improvements
6
+
7
+ * Clarified lib/test/unit/diff.rb license. It's a triple license of
8
+ the Ruby license, PSF license and LGPLv2.1 or later.
9
+ [Reported by Luisa Pace]
10
+
11
+ * Reported norification when data driven test doesn't have
12
+ parameter.
13
+ [GitHub#122][Reported by Satoshi "Moris" Tagomori]
14
+
15
+ ### Thanks
16
+
17
+ * Luisa Pace
18
+
19
+ * Satoshi "Moris" Tagomori
20
+
3
21
  ## 3.2.0 - 2016-06-12 {#version-3-2-0}
4
22
 
5
23
  ### Improvements
@@ -3,9 +3,9 @@
3
3
  # Copyright (c) 2001-2008 Python Software Foundation; All Rights Reserved
4
4
  # Copyright (c) 2008-2011 Kouhei Sutou; All Rights Reserved
5
5
  #
6
- # It is free software, and is distributed under the Ruby
7
- # license and/or the PSF license. See the COPYING file and
8
- # PSFL file.
6
+ # It is free software, and is distributed under the Ruby license, the
7
+ # PSF license and/or LGPLv2.1 or later. See the COPYING file, the PSFL
8
+ # file and the LGPL file.
9
9
 
10
10
  module Test
11
11
  module Unit
@@ -365,6 +365,11 @@ module Test
365
365
  # @option query [String] :method_name (nil)
366
366
  # the method name for a test.
367
367
  def test_defined?(query)
368
+ locations = find_locations(query)
369
+ not locations.empty?
370
+ end
371
+
372
+ def find_locations(query)
368
373
  query_path = query[:path]
369
374
  query_line = query[:line]
370
375
  query_method_name = query[:method_name]
@@ -377,19 +382,19 @@ module Test
377
382
  available_location = available_locations.find do |location|
378
383
  query_line >= location[:line]
379
384
  end
380
- return false if available_location.nil?
381
- return false if available_location[:test_case] != self
385
+ return [] if available_location.nil?
386
+ return [] if available_location[:test_case] != self
382
387
  available_locations = [available_location]
383
388
  end
384
389
  if query_method_name
385
390
  available_location = available_locations.find do |location|
386
391
  query_method_name == location[:method_name]
387
392
  end
388
- return false if available_location.nil?
393
+ return [] if available_location.nil?
389
394
  available_locations = [available_location]
390
395
  end
391
396
 
392
- not available_locations.empty?
397
+ available_locations
393
398
  end
394
399
 
395
400
  private
@@ -441,9 +446,7 @@ module Test
441
446
  def valid? # :nodoc:
442
447
  return false unless respond_to?(@method_name)
443
448
  test_method = method(@method_name)
444
- if @internal_data.have_test_data?
445
- return false unless test_method.arity == 1
446
- else
449
+ unless @internal_data.have_test_data?
447
450
  return false unless test_method.arity <= 0
448
451
  end
449
452
  owner = Util::MethodOwnerFinder.find(self, @method_name)
@@ -733,13 +736,24 @@ module Test
733
736
  end
734
737
 
735
738
  def run_test
739
+ signature = "#{self.class}\##{@method_name}"
736
740
  redefined_info = self[:redefined]
737
741
  if redefined_info
738
- notify("#{self.class}\##{@method_name} was redefined",
742
+ notify("#{signature} was redefined",
739
743
  :backtrace => redefined_info[:backtrace])
740
744
  end
741
745
  if @internal_data.have_test_data?
742
- __send__(@method_name, @internal_data.test_data)
746
+ test_method = method(@method_name)
747
+ if test_method.arity == 1 or test_method.arity < 0
748
+ __send__(@method_name, @internal_data.test_data)
749
+ else
750
+ locations = self.class.find_locations(:method_name => @method_name)
751
+ backtrace = locations.collect do |location|
752
+ "#{location[:path]}:#{location[:line]}"
753
+ end
754
+ notify("#{signature} misses a parameter to take test data",
755
+ :backtrace => backtrace)
756
+ end
743
757
  else
744
758
  __send__(@method_name)
745
759
  end
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = '3.2.0'
3
+ VERSION = '3.2.1'
4
4
  end
5
5
  end
@@ -543,6 +543,23 @@ module Test
543
543
  assert_predicate(test, :valid?)
544
544
  end
545
545
 
546
+ def test_data_driven_test_without_parameter
547
+ test_case = Class.new(TestCase) do
548
+ data("label" => "value")
549
+ def test_without_parameter
550
+ end
551
+ end
552
+
553
+ suite = test_case.suite
554
+ assert_equal(["test_without_parameter"],
555
+ suite.tests.collect {|test| test.method_name})
556
+ result = TestResult.new
557
+ suite.run(result) {}
558
+ assert_equal("1 tests, 0 assertions, 0 failures, " +
559
+ "0 errors, 0 pendings, 0 omissions, 1 notifications",
560
+ result.summary)
561
+ end
562
+
546
563
  private
547
564
  def check(message, passed)
548
565
  add_assertion
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-unit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-12 00:00:00.000000000 Z
12
+ date: 2016-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert