Project

General

Profile

Actions

Bug #984

closed

Test::Unit::Assertions#assert_match double counts number of assertions

Added by ngoto (Naohisa Goto) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.1p5000 (2009-01-27 trunk 21804) [i686-linux]
Backport:
[ruby-dev:37703]

Description

=begin
Ruby 1.9.1-rc1 にて、Test::Unit::Assertions#assert_match が
assertionsの数を1回あたり2ずつ増やしています。
なお、failure の数は正しく増えています。

以下の例では、2回しかassert_matchを実行しないはずなのに"4 assertions"になっています。

$ ruby191rc1 -v -r test/unit -e 'class A<Test::Unit::TestCase; def test_a; assert_match(/a/, "a"); end; def test_b; assert_match(/b/, "a"); end; end'
ruby 1.9.1 (2008-12-30 patchlevel-0 revision 21203) [i686-linux]
Loaded suite -e
Started
.F
Finished in 0.001318 seconds.

  1. Failure:
    test_b(A) [-e:1]:
    Expected /b/ to match "a".

2 tests, 4 assertions, 1 failures, 0 errors, 0 skips

1.8.7 では正しくカウントしています。

% ruby187p72 -v -r test/unit -e 'class A<Test::Unit::TestCase; def test_a; assert_match(/a/, "a"); end; def test_b; assert_match(/b/, "a"); end; end'
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]
Loaded suite -e
Started
.F
Finished in 0.030196 seconds.

  1. Failure:
    test_b(A) [-e:1]:
    <"a"> expected to be =~
    </b/>.

2 tests, 2 assertions, 1 failures, 0 errors
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0