Development

Changeset 4246

You must first sign up to be able to contribute.

Changeset 4246

Show
Ignore:
Timestamp:
06/18/07 21:42:37 (1 year ago)
Author:
fabien
Message:

lime: added 'green bar' effect

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/lime/trunk/lib/lime.php

    r4245 r4246  
    4242    if ($total > $this->plan) 
    4343    { 
    44       $this->output->diag(sprintf("Looks like you planned %d tests but ran %d extra.", $this->plan, $total - $this->plan)); 
     44      $this->output->red_bar(sprintf(" Looks like you planned %d tests but ran %d extra.", $this->plan, $total - $this->plan)); 
    4545    } 
    4646    elseif ($total < $this->plan) 
    4747    { 
    48       $this->output->diag(sprintf("Looks like you planned %d tests but only ran %d.", $this->plan, $total)); 
     48      $this->output->red_bar(sprintf(" Looks like you planned %d tests but only ran %d.", $this->plan, $total)); 
    4949    } 
    5050 
    5151    if ($this->failed) 
    5252    { 
    53       $this->output->diag(sprintf("Looks like you failed %d tests of %d.", $this->failed, $this->plan)); 
     53      $this->output->red_bar(sprintf(" Looks like you failed %d tests of %d.", $this->failed, $this->plan)); 
     54    } 
     55    else 
     56    { 
     57      $this->output->green_bar(" Looks like everything went fine."); 
    5458    } 
    5559 
     
    306310 
    307311  function echoln($message) 
     312  { 
     313    echo "$message\n"; 
     314  } 
     315 
     316  function green_bar($message) 
     317  { 
     318    echo "$message\n"; 
     319  } 
     320 
     321  function red_bar($message) 
    308322  { 
    309323    echo "$message\n"; 
     
    343357    echo ($colorizer_parameter ? $this->colorizer->colorize($message, $colorizer_parameter) : $message)."\n"; 
    344358  } 
     359 
     360  function green_bar($message) 
     361  { 
     362    echo $this->colorizer->colorize($message.str_repeat(' ', 71 - min(71, strlen($message))), 'GREEN_BAR')."\n"; 
     363  } 
     364 
     365  function red_bar($message) 
     366  { 
     367    echo $this->colorizer->colorize($message.str_repeat(' ', 71 - min(71, strlen($message))), 'RED_BAR')."\n"; 
     368  } 
    345369} 
    346370 
     
    384408lime_colorizer::style('PARAMETER', array('fg' => 'cyan')); 
    385409lime_colorizer::style('COMMENT',  array('fg' => 'yellow')); 
     410 
     411lime_colorizer::style('GREEN_BAR',  array('fg' => 'white', 'bg' => 'green', 'bold' => true)); 
     412lime_colorizer::style('RED_BAR',  array('fg' => 'white', 'bg' => 'red', 'bold' => true)); 
    386413 
    387414class lime_harness extends lime_registration 
     
    522549      } 
    523550 
    524       $this->output->echoln(sprintf('Failed %d/%d test scripts, %.2f%% okay. %d/%d subtests failed, %.2f%% okay.', 
     551      $this->output->red_bar(sprintf('Failed %d/%d test scripts, %.2f%% okay. %d/%d subtests failed, %.2f%% okay.', 
    525552        $nb_failed_files = count($this->stats['_failed_files']), 
    526553        $nb_files = count($this->files), 
     
    529556        $nb_tests = $this->stats['_nb_tests'], 
    530557        $nb_tests > 0 ? ($nb_tests - $nb_failed_tests) * 100 / $nb_tests : 0 
    531       ), 'ERROR'); 
     558      )); 
    532559    } 
    533560    else 
    534561    { 
    535       $this->output->echoln('All tests successful.', 'INFO'); 
    536       $this->output->echoln(sprintf('Files=%d, Tests=%d', count($this->files), $this->stats['_nb_tests']), 'INFO'); 
     562      $this->output->green_bar(' All tests successful.'); 
     563      $this->output->green_bar(sprintf(' Files=%d, Tests=%d', count($this->files), $this->stats['_nb_tests'])); 
    537564    } 
    538565