Changeset 76 for trunk

Show
Ignore:
Timestamp:
07/14/09 12:24:38 (3 years ago)
Author:
mgalloy
Message:

Added extra argument to ASSERT which can be placed into msg via C-style format codes.

Location:
trunk/mgunit
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/mgunit/Makefile

    r73 r76  
    1 VERSION=1.0.0 
     1VERSION=1.1dev 
    22REVISION=r`svn info | sed -n 's/Revision: \(.*\)/\1/p'` 
    33RELEASE="$(VERSION)-$(REVISION)" 
  • trunk/mgunit/RELEASE

    r60 r76  
    33------------- 
    44 
     5mgunit 1.1 
     6---------- 
     7 
     8* Added an extra argument to ASSERT which can be inserted into msg via C-style 
     9  format codes. 
     10   
     11   
    512mgunit 1.0 
    613---------- 
  • trunk/mgunit/src/assert.pro

    r17 r76  
    1313;    msg : in, optional, type=string, default="Assertion failed" 
    1414;       message to throw if condition is not met 
     15;    arg : in, optional, type=string 
     16;       argument for any C format codes in msg 
    1517;- 
    16 pro assert, condition, msg 
     18pro assert, condition, msg, arg 
    1719  compile_opt strictarr, logical_predicate, hidden 
    1820  on_error, 2 
    1921 
    20   if (~condition) then message, n_elements(msg) eq 0 ? 'Assertion failed' : msg 
     22  case n_params() of 
     23    0:  
     24    1: if (~condition) then message, 'Assertion failed' 
     25    2: if (~condition) then message, msg 
     26    3: if (~condition) then message, string(arg, format='(%"' + msg + '")') 
     27  endcase 
    2128end