Sunday, August 19, 2007

Less is more with redgreen

When running tests, it's normal to put the most basic functionality tests at the begining, but when you run a test with a lot of errors you'll end up with more complex end tests staring you in the face. I used to try to solve what was in front of me, so I would start at the end. This is obviously harder and basically a waste of time, so my next move was to run the test case and pipe it through less.
ruby test.rb | less
That worked perfectly fine until I installed redgreen to highlight my successes and failures. Now less ends up escaping all of the color codes and I'm left with a messy screen of numbers and reversed colors.
ruby test.rb | less -R
Shouldn't less default to displaying color codes? Alias that!