What is the standard way to put a standard set of asserts into a called subroutine in test/unit?

I want to do something like:

require ‘test/unit’

class TestMyStuff < Test::Unit::TestCase

def mysub(x,y)
assert_not_nil(x,“x nil”)
assert_not_nil(y,“y nil”)
assert(x == y,“messages”)
end

def test_my_stuff
mysub(X,Y)
end

end

On 4/30/10, Xeno C. / Eskimo North and Gmail
[email protected] wrote:

end

def test_my_stuff
mysub(X,Y)
end

end

Yes, and? That works perfectly for me. I do it all the time.

On Apr 30, 2:42 pm, Xeno C. / Eskimo North and Gmail
[email protected] wrote:

    end

Call it assert_mysub().

In general, generic assertions have mundane names, such as
assert_equal, and application-specific assertions have long names that
reveal their application-specific intent. Such as assert_x_and_y.

Next, all tests use the pattern Assemble, Activate, Assert, but your
test case might be missing its Activate line. The line that actually
does something important, in your production code! That pattern is,
generally, why I always call the assembly methods “assemble_”, and I
always call assertions “assert_”.

And, as always, props for writing developer tests. You are now among
the top 5% of all programmers. (More’s the pity!:wink: