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 <what I test>, <what I expect>
is natural?
BTW, "my" order seems more natural to mee also because long expressions:
assert_equal some/very*long.calculations(Of::My.value), 'blah'
vs.
assert_equal 'blah', some/very*long.calculations(Of::My.value)
Thanks,
Victor.
expected always comes first for all the assertions.
···
On May 4, 2006, at 10:19 PM, Victor Shepelev wrote:
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 <what I test>, <what I expect>
is natural?
--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant
http://trackmap.robotcoop.com
BTW, "my" order seems more natural to mee also because long expressions:
assert_equal some/very*long.calculations(Of::My.value), 'blah'
vs.
assert_equal 'blah', some/very*long.calculations(Of::My.value)
Wrong example
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 
victor.
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