comparison scripts/testfun/test.m @ 12687:6d4c18565de1

Deprecate error_text(), __error_text__() * __error_text__.m, error_text.m: New functions added to deprecated/ directory to issue warning message. * NEWS: Add functions to list of deprecated functions in 3.6. * mk_undocumented_list: Remove error_text from alias list. * demo.m, test.m: Replace __error_text__ with lasterr * error.cc: Remove DEFALIAS of functions to lasterr.
author Rik <octave@nomad.inbox5.com>
date Wed, 25 May 2011 14:09:00 -0700
parents 55430618bd5f
children 63463570d9fe
comparison
equal deleted inserted replaced
12685:5cbf660e649d 12687:6d4c18565de1
284 eval (sprintf ("function __test__()\n%s\nendfunction", __code)); 284 eval (sprintf ("function __test__()\n%s\nendfunction", __code));
285 __test__; 285 __test__;
286 input ("Press <enter> to continue: ", "s"); 286 input ("Press <enter> to continue: ", "s");
287 catch 287 catch
288 __success = 0; 288 __success = 0;
289 __msg = sprintf ("%sdemo failed\n%s", __signal_fail, __error_text__); 289 __msg = sprintf ("%sdemo failed\n%s", __signal_fail, lasterr ());
290 end_try_catch 290 end_try_catch
291 clear __test__; 291 clear __test__;
292 292
293 endif 293 endif
294 ## Code already processed. 294 ## Code already processed.
357 eval(__code); ## Define the function 357 eval(__code); ## Define the function
358 __clear = sprintf ("%sclear %s;\n", __clear, __name); 358 __clear = sprintf ("%sclear %s;\n", __clear, __name);
359 catch 359 catch
360 __success = 0; 360 __success = 0;
361 __msg = sprintf ("%stest failed: syntax error\n%s", 361 __msg = sprintf ("%stest failed: syntax error\n%s",
362 __signal_fail, __error_text__); 362 __signal_fail, lasterr ());
363 end_try_catch 363 end_try_catch
364 endif 364 endif
365 __code = ""; 365 __code = "";
366 366
367 ### ASSERT/FAIL 367 ### ASSERT/FAIL
387 eval (sprintf ("function __test__(%s)\n%s\nendfunction", 387 eval (sprintf ("function __test__(%s)\n%s\nendfunction",
388 __shared, __code)); 388 __shared, __code));
389 catch 389 catch
390 __success = 0; 390 __success = 0;
391 __msg = sprintf ("%stest failed: syntax error\n%s", 391 __msg = sprintf ("%stest failed: syntax error\n%s",
392 __signal_fail, __error_text__); 392 __signal_fail, lasterr ());
393 end_try_catch 393 end_try_catch
394 394
395 if (__success) 395 if (__success)
396 __success = 0; 396 __success = 0;
397 __warnstate = warning ("query", "quiet"); 397 __warnstate = warning ("query", "quiet");
486 eval (sprintf ("function %s__test__(%s)\n%s\nendfunction", 486 eval (sprintf ("function %s__test__(%s)\n%s\nendfunction",
487 __shared_r,__shared, __code)); 487 __shared_r,__shared, __code));
488 eval (sprintf ("%s__test__(%s);", __shared_r, __shared)); 488 eval (sprintf ("%s__test__(%s);", __shared_r, __shared));
489 catch 489 catch
490 if (strcmp (__type, "xtest")) 490 if (strcmp (__type, "xtest"))
491 __msg = sprintf ("%sknown failure\n%s", __signal_fail, __error_text__); 491 __msg = sprintf ("%sknown failure\n%s", __signal_fail, lasterr ());
492 __xfail++; 492 __xfail++;
493 else 493 else
494 __msg = sprintf ("%stest failed\n%s", __signal_fail, __error_text__); 494 __msg = sprintf ("%stest failed\n%s", __signal_fail, lasterr ());
495 __success = 0; 495 __success = 0;
496 endif 496 endif
497 if (isempty (__error_text__)) 497 if (isempty (lasterr ()))
498 error ("empty error text, probably Ctrl-C --- aborting"); 498 error ("empty error text, probably Ctrl-C --- aborting");
499 endif 499 endif
500 end_try_catch 500 end_try_catch
501 clear __test__; 501 clear __test__;
502 endif 502 endif