From: spiralofhope Date: 2011-03-26T13:13:33+09:00 Subject: Clearer errors in 1.9's minitest Hello! I've been getting back into Ruby, and one of the major changes I've made is to switch to 1.9 and to strictly use tests. I'm using the minitest[1] in 1.9 (via rvm[2]) It's nice, and I'm pleased at what I've been able to accomplish with its help. However, it's been long enough that one issue has pissed me off to no end and I need some advice on it. I'm not sure how to describe what I'm looking for concisely enough to search for it effectively, so I thought I'd sign up and ask. When an error is caught, its output is not as helpful as I wish it to be. Example script: ---------- require 'minitest/autorun' class Test_Markup < MiniTest::Unit::TestCase def test() assert_equal( ( 'asdfghjkl asdfghjkl asdfghjkl asdfghjkl asdfghjkl ' ), ( 'qwertyuiop qwertyuiop qwertyuiop qwertyuiop qwertyuiop ' ), ) end end ---------- Example output: ---------- Loaded suite /foo/bar/baz.rb Started F Finished in 0.000440 seconds. 1) Failure: test(Test_Markup) [/foo/bar/baz.rb:7]: Expected "asdfghjkl asdfghjkl asdfghjkl asdfghjkl asdfghjkl ", not "qwertyuiop qwertyuiop qwertyuiop qwertyuiop qwertyuiop ". 1 tests, 1 assertions, 1 failures, 0 errors, 0 skips Test run options: --seed 48126 ---------- The "expected/not" text is not nearly as helpful to me as it could/should be. It forces me to - copy/paste it to a text file - shove the text around to "line it up" - comb through it character-by-character for differences - slowly go insane(r) What I instead want is to have a coloured side-by-side comparison similar to a decent diff. Is this possible within minitest as it stands currently? Has anyone else done this already, perhaps with other libraries/tools? How challenging would this be to implement? If there were some way for me to "get at" that text, I could use existing and very mature external tools to do exactly what I want. e.g. if I were given one big array with sub-arrays, within which is all the error information.. then I could do some real magic. I'd really rather not use an alternative to minitest, mostly because the syntax used in them makes me want to scoop my brain out with a teaspoon. Point me to websites, documentation or source code. Any and all help is appreciated. --- [1] http://bfts.rubyforge.org/minitest/ [2] http://rvm.beginrescueend.com/rvm/ -- http://spiralofhope.com Wall of text hits you for 99,999 hp. You die!