Test/unit : params order in assert_equal

Hi all.

I’ve found myself to always writing:

assert_equal variable_to_test, ‘value expected’

And Test::Unit says to me:
‘some wrong value’ expected but was ‘value expected’

when I’d want to see

‘value expected’ expected but was ‘some wrong value’

Is it because English is not my native? I mean, all others think that
order

assert equal ,

is natural?

BTW, “my” order seems more natural to mee also because long expressions:
assert_equal some/verylong.calculations(Of::My.value), ‘blah’
vs.
assert_equal ‘blah’, some/very
long.calculations(Of::My.value)

Thanks,
Victor.

On May 4, 2006, at 10:19 PM, Victor S. wrote:

‘value expected’ expected but was ‘some wrong value’

Is it because English is not my native? I mean, all others think
that order

assert equal ,

is natural?

expected always comes first for all the assertions.


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

assert_equal seems backwards to native english speakers, too. use rspec
instead.

require ‘spec’ # gem install rspec

calculate x

x.should.equal %w(one two three four five)

it actually works!

bret

BTW, “my” order seems more natural to mee also because long expressions:
assert_equal some/verylong.calculations(Of::My.value), ‘blah’
vs.
assert_equal ‘blah’, some/very
long.calculations(Of::My.value)

Wrong example :slight_smile: I meant the opposite:

[Some very long calculation of x]
assert_equal x, %w(one two three four five) #my way
vs.
[Some very long calculation of x]
assert_equal %w(one two three four five), x #common way

sorry :slight_smile:

victor.