From: Paul Brannan Date: 2003-02-25T01:16:58+09:00 Subject: Comparing strings and integers in Test::Unit I have a test that looks like this: require 'test/unit' class My_Test < Test::Unit::TestCase def test_1 assert_equal('10', '10') # okay assert_equal(10, '10') # failure end end The result looks like this: Loaded suite test2 Started F Finished in 0.00906 seconds. 1) Failure!!! test_1(My_Test) [test2.rb:6]: <10> expected but was <10> 1 tests, 2 assertions, 1 failures, 0 errors It's not immediately obvious why <10> is not equal to <10>. 1) Is there anything I can do to get a more useful assertion failure message? 2) When I want to differentiate like this in my own code, I use #inspect instead of #to_s. I'm not sure if that's appropriate here, since #inspect works well for integers and strings and regexes, but might not work well with user-defined types. Could Test::Unit use #inspect instead of #to_s, and would there be any unwanted side-effects? 3) Runit has the same problem; can I work around this in Runit? Also, I noticed that Test::Unit 0.1.8 has different output from 0.1.6. 1) What was the reason for the change? 2) Why is there a carriage return after the word "was"? 3) Is it possible to get Test::Unit to print the names of the tests as they are run, like it used to? Paul