[Wtr-general] assert_arrayEquals

Dave Hoover dave.hoover at gmail.com
Tue Jul 11 15:22:21 EDT 2006


On 7/11/06, Chris McMahon <christopher.mcmahon at gmail.com> wrote:
> You could write your own, but the coolest way I know to do this is like
>
> require 'test/unit'
>
> class Foo < Test::Unit::TestCase
>   def test_foo
> array_1 = [1,2,3]
> array_2 = [1,2,3]
>
> assert_equal(array_1 - array_2 ,[])

That doesn't quite cut it.  Check this out...

irb(main):001:0> a = [1, 2]
=> [1, 2]
irb(main):002:0> b = [1, 2, 3]
=> [1, 2, 3]
irb(main):003:0> a - b
=> []



More information about the Wtr-general mailing list