Project

General

Profile

Backport #4368

MiniTest::Assertions#assert_block ignores the given message.

Added by nobu (Nobuyoshi Nakada) about 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:35093]

Description

=begin
This method ignores the argument.

 def assert_block msg = nil
   assert yield, "Expected block to return true value."
 end

=end

History

#1

Updated by zenspider (Ryan Davis) about 8 years ago

  • Status changed from Assigned to Closed

=begin
Fixed in perforce. Migrating to svn next.
=end

Updated by deryldoucette (Deryl Doucette) about 8 years ago

=begin
We tested this against the following: 1.9.2 patch levels p136, p180, and p188 (revisions 30365, 30909, and 31204).

We came up with the same errors as shown by the following:

=== TEST FILE CONTENTS

require 'test/unit'
class TestingTest < Test::Unit::TestCase
def test_omg
assert_block("SEEING THE ACTUAL MESSAGE") { false }
end
end

=== TEST OUTPUT

pgpmbp:tmp pgpkeys$ ruby brain.rb
Loaded suite brain
Started
F
Finished in 0.000365 seconds.

1) Failure:

test_omg(TestingTest) [brain.rb:5]:
Expected block to return true value.

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

Test run options: --seed 8967

NOTE

The first revision to show correctly was revision 29036 (p0). Revision 30365 showed it correctly as well (p136).
So to summarize:

pgpmbp:tmp pgpkeys$ rvm use 1.9.2-p0
Using /Users/pgpkeys/.rvm/gems/ruby-1.9.2-p0
pgpmbp:tmp pgpkeys$ ruby brain.rb
Loaded suite brain
Started
F
Finished in 0.000618 seconds.

1) Failure:

test_omg(TestingTest) [brain.rb:5]:
SEEING THE ACTUAL MESSAGE.
Expected block to return true value.

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

Test run options: --seed 38217
pgpmbp:tmp pgpkeys$ rvm use 1.9.2-p136
Using /Users/pgpkeys/.rvm/gems/ruby-1.9.2-p136
pgpmbp:tmp pgpkeys$ ruby brain.rb
Loaded suite brain
Started
F
Finished in 0.000395 seconds.

1) Failure:

test_omg(TestingTest) [brain.rb:5]:
SEEING THE ACTUAL MESSAGE.
Expected block to return true value.

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

Test run options: --seed 58527
pgpmbp:tmp pgpkeys$ rvm use 1.9.2-p180
Using /Users/pgpkeys/.rvm/gems/ruby-1.9.2-p180
pgpmbp:tmp pgpkeys$ ruby brain.rb
Loaded suite brain
Started
F
Finished in 0.000374 seconds.

1) Failure:

test_omg(TestingTest) [brain.rb:5]:
Expected block to return true value.

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

Test run options: --seed 62205
pgpmbp:tmp pgpkeys$ rvm use 1.9.2-p188

pgpmbp:tmp pgpkeys$ ruby brain.rb
Loaded suite brain
Started
F
Finished in 0.000616 seconds.

1) Failure:

test_omg(TestingTest) [brain.rb:5]:
Expected block to return true value.

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

Test run options: --seed 34294

=== NOTE TO DEVS

So, p0 and p136 act almost correctly, but they display both the specified error message as well as the default error message. p188 or an earlier point release between p136 and p188 introduces an regression which reverts this behaviour to only showing the default error message.

It would be more appropriate if it displayed the custom error message only.
=end

Updated by deryldoucette (Deryl Doucette) about 8 years ago

=begin
This was discovered by Ryan Bigg, and Deryl Doucette.

=end

#4

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby trunk to Backport192
  • Category changed from lib to lib
  • Status changed from Closed to Assigned
  • Assignee changed from zenspider (Ryan Davis) to yugui (Yuki Sonoda)
  • Target version deleted (1.9.2)

=begin
Backport r30798.
=end

Updated by yugui (Yuki Sonoda) almost 8 years ago

  • Status changed from Assigned to Closed

=begin
backported at r31851.
=end

Also available in: Atom PDF