Class UnitDiff
In: lib/unit_diff.rb
Parent: Object

UnitDiff makes reading Test::Unit output easy and fun. Instead of a confusing jumble of text with nearly unnoticable changes like this:

  1) Failure:
  test_to_gpoints(RouteTest) [test/unit/route_test.rb:29]:
  <"new GPolyline([\n  new GPoint(  47.00000, -122.00000),\n  new GPoint(  46.5000
  0, -122.50000),\n  new GPoint(  46.75000, -122.75000),\n  new GPoint(  46.00000,
   -123.00000)])"> expected but was
  <"new Gpolyline([\n  new GPoint(  47.00000, -122.00000),\n  new GPoint(  46.5000
  0, -122.50000),\n  new GPoint(  46.75000, -122.75000),\n  new GPoint(  46.00000,
   -123.00000)])">.

You get an easy-to-read diff output like this:

  1) Failure:
  test_to_gpoints(RouteTest) [test/unit/route_test.rb:29]:
  1c1
  < new GPolyline([
  ---
  > new Gpolyline([

Usage

  test.rb | unit_diff [options]
    options:
    -b ignore whitespace differences
    -c contextual diff
    -h show usage
    -k keep temp diff files around
    -l prefix line numbers on the diffs
    -u unified diff [default]
    -p plain diff
    -v display version

Constants

WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
DIFF = if WINDOZE

[Validate]