# Test/unit : params order in assert\_equal

**URL:** <https://www.ruby-forum.com/t/test-unit-params-order-in-assert-equal/59664>\
**Category:** Ruby\
**Created:** [May 5, 2006, 7:19am UTC](https://www.ruby-forum.com/t/test-unit-params-order-in-assert-equal/59664 "2006-05-05T07:19:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor123789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@victor123789](https://www.ruby-forum.com/u/victor123789)\
**Post date:** [May 5, 2006, 7:19am UTC](https://www.ruby-forum.com/t/test-unit-params-order-in-assert-equal/59664/1 "2006-05-05T07:19:57Z")

</div>

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/very_long.calculations(Of::My.value), ‘blah’  
vs.  
assert\_equal ‘blah’, some/very_long.calculations(Of::My.value)

Thanks,  
Victor.

---

<div class="post-metadata">

**Author:** ![victor123789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@victor123789](https://www.ruby-forum.com/u/victor123789)\
**Post date:** [May 5, 2006, 10:04am UTC](https://www.ruby-forum.com/t/test-unit-params-order-in-assert-equal/59664/2 "2006-05-05T10:04:17Z")

</div>

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. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![victor123789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@victor123789](https://www.ruby-forum.com/u/victor123789)\
**Post date:** [May 17, 2006, 8:03am UTC](https://www.ruby-forum.com/t/test-unit-params-order-in-assert-equal/59664/3 "2006-05-17T08:03:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![victor123789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@victor123789](https://www.ruby-forum.com/u/victor123789)\
**Post date:** [May 5, 2006, 12:36pm UTC](https://www.ruby-forum.com/t/test-unit-params-order-in-assert-equal/59664/4 "2006-05-05T12:36:43Z")

</div>

> 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.
