Changeset 59

Show
Ignore:
Timestamp:
04/20/09 07:58:25 (3 years ago)
Author:
mgalloy
Message:

Merging 57:58 from trunk to the mgunit-1.0 branch.

Location:
branches/mgunit-1.0/mgunit/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/mgunit-1.0/mgunit/src/mgutclirunner__define.pro

    r54 r59  
    182182    printf, lun, text, _extra=e 
    183183  endelse 
     184   
     185  if (lun gt 0L) then flush, lun 
    184186end 
    185187 
  • branches/mgunit-1.0/mgunit/src/mguthtmlrunner__define.pro

    r54 r59  
    2222;- 
    2323pro mguthtmlrunner::reportTestSuiteStart, testsuite, $ 
    24                                            ntestcases=ntestcases, $ 
    25                                            ntests=ntests, $ 
    26                                            level=level 
    27   compile_opt strictarr 
    28  
    29   printf, self.lun, $ 
    30           '<ul class="testsuite"><li><span class="suitename">' $ 
    31           + testsuite $ 
    32           + '</span> test suite starting (' $ 
    33           + strtrim(ntestcases, 2) + ' test suite' $ 
    34           + (ntestcases eq 1 ? '' : 's') $ 
    35           + '/case' $ 
    36           + (ntestcases eq 1 ? '' : 's') $ 
    37           + ', ' $ 
    38           + strtrim(ntests, 2) + ' test' + (ntests eq 1 ? '' : 's') $ 
    39           + ')</li>' 
     24                                          ntestcases=ntestcases, $ 
     25                                          ntests=ntests, $ 
     26                                          level=level 
     27  compile_opt strictarr 
     28 
     29  self->_print, self.lun, $ 
     30                '<ul class="testsuite"><li><span class="suitename">' $ 
     31                  + testsuite $ 
     32                  + '</span> test suite starting (' $ 
     33                  + strtrim(ntestcases, 2) + ' test suite' $ 
     34                  + (ntestcases eq 1 ? '' : 's') $ 
     35                  + '/case' $ 
     36                  + (ntestcases eq 1 ? '' : 's') $ 
     37                  + ', ' $ 
     38                  + strtrim(ntests, 2) + ' test' + (ntests eq 1 ? '' : 's') $ 
     39                  + ')</li>' 
    4040end 
    4141 
     
    5757  compile_opt strictarr 
    5858 
    59   printf, self.lun, $ 
    60           '<span class="results">Results: ' $ 
    61           + strtrim(npass, 2) + ' / ' + strtrim(npass + nfail, 2) $ 
    62           + ' tests passed</span></ul>' 
     59  self->_print, self.lun, $ 
     60                '<span class="results">Results: ' $ 
     61                  + strtrim(npass, 2) + ' / ' + strtrim(npass + nfail, 2) $ 
     62                  + ' tests passed</span></ul>' 
    6363end 
    6464 
     
    8080  compile_opt strictarr 
    8181 
    82   printf, self.lun, $ 
    83           '<ul class="testcase"><li><span class="casename">' + testcase $ 
    84           + '</span> test case starting (' + strtrim(ntests, 2) $ 
    85           + ' test' + (ntests eq 1 ? '' : 's') + ')</li>'  
    86   printf, self.lun, '<ol>' 
     82  self->_print, self.lun, $ 
     83                '<ul class="testcase"><li><span class="casename">' + testcase $ 
     84                  + '</span> test case starting (' + strtrim(ntests, 2) $ 
     85                  + ' test' + (ntests eq 1 ? '' : 's') + ')</li>'  
     86  self->_print, self.lun, '<ol>' 
    8787end 
    8888 
     
    102102  compile_opt strictarr 
    103103 
    104   printf, self.lun, '</ol>' 
    105   printf, self.lun, $ 
    106           '<span class="results">Results: ' $ 
    107           + strtrim(npass, 2) + ' / ' + strtrim(npass + nfail, 2) $ 
    108           + ' tests passed</span></ul>' 
     104  self->_print, self.lun, '</ol>' 
     105  self->_print, self.lun, $ 
     106                '<span class="results">Results: ' $ 
     107                  + strtrim(npass, 2) + ' / ' + strtrim(npass + nfail, 2) $ 
     108                  + ' tests passed</span></ul>' 
    109109end 
    110110 
     
    124124  compile_opt strictarr 
    125125 
    126   printf, self.lun, '<li>' + testname + ': ', format='(A, $)' 
     126  self->_print, self.lun, '<li>' + testname + ': ', format='(A, $)' 
    127127end 
    128128 
     
    145145 
    146146  result = keyword_set(passed) ? 'passed' : 'failed' 
    147   ;printf, self.lun, $ 
    148   ;  '<span class="' + result + '">' $ 
    149   ;  + result $ 
    150   ;  + (keyword_set(passed) ? '': (msg eq '' ? '' : ' "' + msg + '"')) $ 
    151   ;  + '</span> (seconds)</li>' 
    152  
    153   printf, self.lun, $ 
    154           result, $ 
    155           result, $ 
    156           keyword_set(passed) ? '': (msg eq '' ? '' : ' "' + msg + '"'), $ 
    157           time, $ 
    158           format='(%"<span class=\"%s\">%s%s</span> <span class=\"time\">%f seconds</span></li>")'    
     147 
     148  s = string(result, $ 
     149             result, $ 
     150             keyword_set(passed) ? '': (msg eq '' ? '' : ' "' + msg + '"'), $ 
     151             time, $ 
     152             format='(%"<span class=\"%s\">%s%s</span> <span class=\"time\">%f seconds</span></li>")') 
     153 
     154  self->_print, self.lun, s 
     155end 
     156 
     157 
     158;+ 
     159; Prints a message to a LUN. 
     160; 
     161; :Params: 
     162;    lun : in, required, type=long 
     163;       logical unit number to print to 
     164;    text : in, required, type=string 
     165;       text to print 
     166; 
     167; :Keywords: 
     168;    _extra : in, optional, type=keywords 
     169;       keywords to MG_ANSICODE i.e. RED or GREEN 
     170;- 
     171pro mguthtmlrunner::_print, lun, text, _extra=e 
     172  compile_opt strictarr 
     173   
     174  printf, lun, text, _extra=e 
     175  if (lun gt 0L) then flush, lun 
    159176end 
    160177 
     
    166183  compile_opt strictarr 
    167184 
    168   printf, self.lun, '<span id="dateline">Test results from ' + systime() + '</span>' 
    169   printf, self.lun, '</body></html>' 
     185  self->_print, self.lun, '<span id="dateline">Test results from ' + systime() + '</span>' 
     186  self->_print, self.lun, '</body></html>' 
     187   
    170188  if (self.lun gt 0) then free_lun, self.lun 
    171189  self->mguttestrunner::cleanup 
     
    207225  endelse 
    208226 
    209   printf, self.lun, '<html><head>' 
    210   printf, self.lun, '<title>Test results</title>' 
    211   printf, self.lun, '<style type="text/css" media="all">' 
     227  self->_print, self.lun, '<html><head>' 
     228  self->_print, self.lun, '<title>Test results</title>' 
     229  self->_print, self.lun, '<style type="text/css" media="all">' 
     230   
    212231  styleFilename = mg_src_root() + 'style.css' 
    213232  styles = strarr(file_lines(styleFilename)) 
     
    215234  readf, styleLun, styles 
    216235  free_lun, styleLun 
    217   printf, self.lun, transpose(styles) 
    218   printf, self.lun, '</style></head><body>' 
     236   
     237  self->_print, self.lun, transpose(styles) 
     238  self->_print, self.lun, '</style></head><body>' 
     239   
    219240  return, 1B 
    220241end