Changeset 102 for trunk

Show
Ignore:
Timestamp:
09/27/10 19:35:17 (20 months ago)
Author:
mgalloy
Message:

MGUNIT now uses color output if it can determine if the terminal is a TTY.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/mgunit.pro

    r101 r102  
    11; docformat = 'rst' 
     2 
     3;+ 
     4; Determines if the current terminal is a TTY, calling `MG_TERMISTTY` safely 
     5; even if cmdline_tools is not installed or built. 
     6; 
     7; :Returns:  
     8;    1 if current term is a TTY, 0 if not 
     9;- 
     10function mgunit_findIfTty 
     11  compile_opt strictarr, hidden 
     12   
     13  catch, error 
     14  if (error ne 0L) then begin 
     15    catch, /cancel 
     16    return, 0 
     17  endif 
     18 
     19  return, mg_termIsTty() 
     20end 
     21 
    222 
    323;+ 
     
    4363    else: runnerName = 'MgutCliRunner' 
    4464  endcase 
    45      
     65   
     66  _color = keyword_set(color) || mgunit_findIfTty() 
     67help, color, mgunit_findIfTty(), _color 
     68 
    4669  if (n_elements(tests) gt 0) then begin 
    4770    testRunner = obj_new('MGutCompoundRunner') 
     
    5578 
    5679    testRunner->add, obj_new(runnerName, parent=testRunner, $ 
    57                              filename=filename, color=color, $ 
     80                             filename=filename, color=_color, $ 
    5881                             test_suite=testsuite) 
    5982