Why is assert_match deprecated and not assert_no_match?

I have found assert_match useful in the past, but have noticed that it
is deprecated. That seems a shame.

However, I don’t understand why assert_match would be deprecated, but
not assert_no_match. Can anyone enlighten me?

Rob

On Aug 16, 2012, at 3:00 AM, Rob N. removed_emai[email protected] wrote:

I have found assert_match useful in the past, but have noticed that it
is deprecated. That seems a shame.

However, I don’t understand why assert_match would be deprecated, but
not assert_no_match. Can anyone enlighten me?

what test framework? what version?

we’re not psychic.

On 08/16/2012 10:00 PM, Rob N. wrote:

I have found assert_match useful in the past, but have noticed that it
is deprecated. That seems a shame.

However, I don’t understand why assert_match would be deprecated, but
not assert_no_match. Can anyone enlighten me?

Rob
Can’t comment on why it is deprecated, but it seems like you could
achieve the same thing simply using assert with a proc that does the
regexp match?

Sam

Ryan D. wrote in post #1072592:

On Aug 16, 2012, at 3:00 AM, Rob N. [email protected] wrote:

I have found assert_match useful in the past, but have noticed that it
is deprecated. That seems a shame.

However, I don’t understand why assert_match would be deprecated, but
not assert_no_match. Can anyone enlighten me?

what test framework? what version?

we’re not psychic.

Sorry. 1.9.3, Standard Library, test/unit:

http://ruby-doc.org/stdlib-1.9.3/

On Aug 17, 2012, at 12:34 AM, Rob N. [email protected] wrote:

we’re not psychic.

Sorry. 1.9.3, Standard Library, test/unit:

http://ruby-doc.org/stdlib-1.9.3/

I see no deprecation.

test/unit on 1.9.x subclasses minitest/unit. I have no intention of
removing assert_match, ever.

Ryan D. wrote in post #1072644:

I see no deprecation.

I’ve just had more of a play. You’re right, its not deprecated. It just
doesn’t appear in the rdoc:

http://ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/index.html

In fact none of the ruby 1.9 rdocs contain it.

The 1.8.7 rdoc has it though:

http://ruby-doc.org/stdlib-1.8.7/libdoc/test/unit/rdoc/index.html

Some sort of oversight?

On Aug 17, 2012, at 3:21 AM, Rob N. [email protected] wrote:

Ryan D. wrote in post #1072644:

I see no deprecation.

I’ve just had more of a play. You’re right, its not deprecated. It just
doesn’t appear in the rdoc:

http://ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/index.html

http://ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/Test/Unit/Assertions.html

says:

Included Modules
MiniTest::Assertions

which implies:

http://ruby-doc.org/stdlib-1.9.3/libdoc/minitest/unit/rdoc/MiniTest/Assertions.html#method-i-assert_match

Sam D. wrote in post #1072598:

On 08/16/2012 10:00 PM, Rob N. wrote:

I have found assert_match useful in the past, but have noticed that it
is deprecated. That seems a shame.

However, I don’t understand why assert_match would be deprecated, but
not assert_no_match. Can anyone enlighten me?

Rob
Can’t comment on why it is deprecated, but it seems like you could
achieve the same thing simply using assert with a proc that does the
regexp match?

Sam

Yes. I can do assert(pattern =~ text)

But I then have to build my own failure message. assert_match would fail
in a way that was informative.

However, my main query is not so much about the loss of assert_match,
but why assert_match would be dropped, but not assert_no_match. The two
seem to me a pair. If assert_match is deemed not to be required, then
surely assert_no_match should also go. Conversely, if there is a good
case to keep assert_no_match, then surely assert_match should also
remain.

Rob

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs