Changes

Jump to navigation Jump to search
407 bytes added ,  13:45, 11 September 2016
→‎Error: added %!warning and checking for particular ids
Line 141: Line 141:  
  %!test foo (bar)
 
  %!test foo (bar)
   −
=== Error ===
+
=== Error / Warning ===
    
It is also important to test that a function performs its checks correctly
 
It is also important to test that a function performs its checks correctly
and throws errors when it receives garbage.  This can be done with
+
and throws errors (or warnings) when it receives garbage.  This can be done with
{{codeline|error}} blocks:
+
{{codeline|error}} (or {{codeline|warning}}) blocks:
    
  %!error foo ()  # test that causes any error
 
  %!error foo ()  # test that causes any error
  %!error <BAR must be a positive integer> foo (-1.5)  # test that throws specific error
+
  %!error <BAR must be a positive integer> foo (-1.5)  # test that throws specific error message
 
+
%!error id=Octave:invalid-fun-call foo ()  # test that throws specific error id
    +
%!warning foo ()  # test that causes any warning
 +
%!warning <negative values might give inaccurate results> foo (-1.5)  # test that triggers a specific warning message
 +
%!warning id=BAR:possibly-inaccurate-result foo (-1.5)  # test that triggers a specific warning id
    
=== Shared functions ===
 
=== Shared functions ===
240

edits

Navigation menu