Changeset 12 for trunk

Show
Ignore:
Timestamp:
06/18/07 22:47:37 (5 years ago)
Author:
mgalloy
Message:

Fixed another typo.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/mgunit/mguttestsuite__define.pro

    r9 r12  
    1212    return 
    1313  endif 
    14    
    15   resolve_routine, testName + '__define' 
     14 
     15  resolve_routine, classname + '__define' 
    1616end 
    1717 
     
    2020; Create a new test case or test suite, but check for errors while creating 
    2121; it. 
    22 ;      
     22; 
    2323; @returns obj 
    2424; @param testName {in}{required}{type=string} 
     
    3131function mguttestsuite::_makeTestCase, testName, error=error, _extra=e 
    3232  compile_opt strictarr 
    33    
     33 
    3434  error = 0L 
    3535  catch, error 
     
    3838    return, obj_new() 
    3939  endif 
    40    
     40 
    4141  self->_recompile, testName 
    42    
     42 
    4343  return, obj_new(testName, test_runner=self.testRunner, _strict_extra=e) 
    4444end 
    4545 
    4646 
    47 ;      
     47; 
    4848;+ 
    4949; Run the contained test suites or test cases. 
     
    6262    otestcase = self.testcases->get(position=t) 
    6363    otestcase->run 
    64      
     64 
    6565    ; accumulate results 
    6666    otestcase->getProperty, npass=npass, nfail=nfail 
     
    7979; 
    8080; @param tests {in}{required}{type=strarr} classnames of test suites or test 
    81 ;        cases  
    82 ; @keyword all {in}{optional}{type=boolean} set to add all the files in the  
    83 ;          current directory that end in "_ut__define.pro" (the current  
    84 ;          directory is defined to be the directory where the method that  
     81;        cases 
     82; @keyword all {in}{optional}{type=boolean} set to add all the files in the 
     83;          current directory that end in "_ut__define.pro" (the current 
     84;          directory is defined to be the directory where the method that 
    8585;          calls this method is located) 
    8686;- 
    8787pro mguttestsuite::add, tests, all=all 
    8888  compile_opt strictarr 
    89    
     89 
    9090  if (keyword_set(all)) then begin 
    9191    ; first, add all the unit tests in the current directory 
    92      
     92 
    9393    ; find matching files 
    9494    testFiles = file_search(self.home + '*_ut__define.pro', $ 
    9595                            /fold_case, count=nTestFiles) 
    96      
     96 
    9797    ; extract just classname from each file 
    9898    myTests = file_basename(testFiles) 
     
    102102      self->add, myTests[t] 
    103103    endfor 
    104      
     104 
    105105    ; second, for each directory in the current directory, either: 
    106106    ;   1) add the *_uts__define.pro found there, or 
     
    118118        suiteName = strmid(suiteName, 0, strlen(suiteName) - 12L) 
    119119        if (suiteName ne self.name) then self->add, suiteName 
    120          
     120 
    121121        continue   ; finished with this directory 
    122122      endif 
    123        
    124       ; if there isn't a *_uts__define.pro, but there are unit tests here  
     123 
     124      ; if there isn't a *_uts__define.pro, but there are unit tests here 
    125125      ; then create a new test suite 
    126126      uts = file_search(testDirs[d] + '*_ut__define.pro', $ 
    127127                        count=nTestCases) 
    128128      if (nTestCases eq 0) then continue   ; finished with this directory 
    129        
     129 
    130130      otestsuite = obj_new('MGutTestSuite', home=testDirs[d], $ 
    131131                           name=file_basename(testDirs[d]), $ 
     
    138138      ; don't add yourself to yourself 
    139139      if (tests[t] eq self.name) then continue 
    140        
    141       ; see if test is valid       
     140 
     141      ; see if test is valid 
    142142      otestcase = self->_makeTestCase(tests[t], error=error) 
    143143      if (error ne 0L) then begin 
     
    145145        continue 
    146146      endif 
    147        
     147 
    148148      ; test case is OK so now set it up 
    149149      otestcase->setLevel, self.level + 1L 
     
    156156;+ 
    157157; Get properties of the object. 
    158 ;  
     158; 
    159159; @keyword name {out}{optional}{type=string} name of the object 
    160 ; @keyword npass {out}{optional}{type=integer} number of passing tests  
     160; @keyword npass {out}{optional}{type=integer} number of passing tests 
    161161;          contained in the hierarchy below this object 
    162 ; @keyword nfail {out}{optional}{type=integer} number of failing tests  
     162; @keyword nfail {out}{optional}{type=integer} number of failing tests 
    163163;          contained in the hierarchy below this object 
    164 ; @keyword ntestcases {out}{optional}{type=integer} number of directly  
     164; @keyword ntestcases {out}{optional}{type=integer} number of directly 
    165165;          contained test suites or test cases 
    166 ; @keyword ntests {out}{optional}{type=integer} number of tests contained in  
     166; @keyword ntests {out}{optional}{type=integer} number of tests contained in 
    167167;          the hierarchy below this object 
    168168;- 
     
    219219; 
    220220; @returns 1 for success, 0 for failure 
    221 ; @keyword name {in}{optional}{type=string}{default=classname}  
     221; @keyword name {in}{optional}{type=string}{default=classname} 
    222222;          name of the test suite 
    223 ; @keyword home {in}{optional}{type=string}{default=''}  
     223; @keyword home {in}{optional}{type=string}{default=''} 
    224224;          location of the root of the test suite 
    225 ; @keyword test_runner {in}{required}{type=object}  
     225; @keyword test_runner {in}{required}{type=object} 
    226226;          subclass of MGtestRunner 
    227227;- 
     
    230230 
    231231  self.name = n_elements(name) eq 0 ? strlowcase(obj_class(self)) : name 
    232    
     232 
    233233  if (n_elements(home) eq 0) then begin 
    234234    ; get directory of caller's source code (subtract 2L to *caller* dir) 
    235235    traceback = scope_traceback(/structure) 
    236     callingFrame = traceback[n_elements(traceback) - 2L > 0]  
     236    callingFrame = traceback[n_elements(traceback) - 2L > 0] 
    237237    self.home = file_dirname(callingFrame.filename, /mark_directory) 
    238238  endif else begin 
     
    241241      : home + path_sep() 
    242242  endelse 
    243    
    244   self.level = 0L  
     243 
     244  self.level = 0L 
    245245 
    246246  self.testRunner = testRunner 
    247247 
    248248  self.testcases = obj_new('IDL_Container') 
    249    
     249 
    250250  self.npass = 0L 
    251251  self.nfail = 0L 
     
    257257;+ 
    258258; Define member variables. 
    259 ;  
     259; 
    260260; @file_comments Test suites are containers for test cases. Either subclass 
    261 ;                MGutTestSuite and add test suites/test cases in its init  
    262 ;                method or create a MGutTestSuite and use the add method to  
     261;                MGutTestSuite and add test suites/test cases in its init 
     262;                method or create a MGutTestSuite and use the add method to 
    263263;                add test suites/cases. 
    264 ;  
     264; 
    265265; @field name name of the object 
    266266; @field level number of layers below the top-most containing test suite 
    267267; @field testcases IDL_Container holding test suites or test cases 
    268268; @field testRunner subclass of MGutTestRunner 
    269 ; @field npass number of passing tests contained in the hierarchy below this  
     269; @field npass number of passing tests contained in the hierarchy below this 
    270270;        test suite 
    271271; @field nfail number of failing tests contained in the hierarchy below this