Changeset 125 for trunk

Show
Ignore:
Timestamp:
10/17/11 14:54:04 (7 months ago)
Author:
mgalloy
Message:

Adding ability to run a single test method from a test case. Satisfies ticket #9.

Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/docs/using-mgunit.rst

    r124 r125  
    6868  end 
    6969 
    70 Running all the test case now results in the following:: 
     70Running the test case now results in the following:: 
    7171 
    7272  IDL> mgunit, 'findgen_ut' 
     
    8181 
    8282Both test failures above are expected and present only to demonstrate features of mgunit. 
     83 
     84A single test method of a test case can be run using a `.` to separate the test class name from the method name:: 
     85 
     86  IDL> mgunit, 'findgen_ut.test_basic' 
     87  "All tests" test suite starting (1 test suite/case, 1 test) 
     88     "findgen_ut" test case starting (1 test) 
     89        test_basic: passed (0.000078 seconds) 
     90     Results: 1 / 1 tests passed, 0 skipped 
     91  Results: 1 / 1 tests passed, 0 skipped 
    8392 
    8493 
  • trunk/Makefile

    r119 r125  
    1 VERSION=1.2 
     1VERSION=1.3dev 
    22REVISION=r`svn info | sed -n 's/Revision: \(.*\)/\1/p'` 
    33RELEASE="$(VERSION)-$(REVISION)" 
  • trunk/src/mguttestcase__define.pro

    r112 r125  
    343343  ntests = self.ntests 
    344344  if (arg_present(testnames)) then testnames = *self.testnames 
     345end 
     346 
     347 
     348;+ 
     349; Set properties of the object. 
     350;- 
     351pro mguttestcase::setProperty, testnames=testnames 
     352  compile_opt strictarr 
     353   
     354  if (n_elements(testnames) gt 0L) then begin 
     355    *self.testnames = strlowcase(testnames) 
     356    self.ntests = n_elements(testnames) 
     357  endif 
    345358end 
    346359 
  • trunk/src/mguttestsuite__define.pro

    r112 r125  
    266266  endif else begin 
    267267    for t = 0L, n_elements(tests) - 1L do begin 
     268      dotpos = strpos(tests[t], '.') 
     269      if (dotpos eq -1L) then begin 
     270        classname = tests[t] 
     271      endif else begin 
     272        classname = strmid(tests[t], 0, dotpos) 
     273        methodname = strmid(tests[t], dotpos + 1L) 
     274      endelse 
     275       
    268276      ; don't add yourself to yourself 
    269       if (tests[t] eq self.name) then continue 
     277      if (classname eq self.name) then continue 
    270278 
    271279      ; see if test is valid 
    272       otestcase = self->_makeTestCase(tests[t], error=error) 
     280      otestcase = self->_makeTestCase(classname, error=error) 
    273281      if (error ne 0L) then begin 
    274         print, 'Error creating ' + tests[t] + ' object: ' + !error_state.msg 
     282        print, 'Error creating ' + classname + ' object: ' + !error_state.msg 
    275283        continue 
    276284      endif 
     
    278286      ; test case is OK so now set it up 
    279287      otestcase->setLevel, self.level + 1L 
     288      if (n_elements(methodname) gt 0L) then begin 
     289        otestcase->setProperty, testnames=[methodname] 
     290      endif 
    280291      self.testcases->add, otestcase 
    281292    endfor