]> gitweb.michael.orlitzky.com - octave.git/blobdiff - unit_test/erreval.m
Move all of the tests into a subdirectory.
[octave.git] / unit_test / erreval.m
diff --git a/unit_test/erreval.m b/unit_test/erreval.m
new file mode 100644 (file)
index 0000000..995d854
--- /dev/null
@@ -0,0 +1,17 @@
+function rv = erreval(error_prefix, try_str, catch_str)
+  ## erreval() extends the built-in function eval().  Return 0 if
+  ## try_str does not raise the error of type error_prefix, return 1
+  ## otherwise.
+  
+  global unittest_results;
+  for k = 1:length(unittest_results.eval_globals)
+    eval(unittest_results.eval_globals{k});
+  end
+  
+  rv = 0;
+  try
+    eval(try_str);
+  catch
+    rv = errcheck(error_prefix);
+  end  
+endfunction