view test/octave.test/eval-catch/eval-catch.exp @ 4457:d7d9ca19960a

[project @ 2003-07-11 03:05:38 by jwe]
author jwe
date Fri, 11 Jul 2003 03:05:39 +0000
parents f0ab8a324da7
children 6a1e6e87f143
line wrap: on
line source

## parse empty try string
set test eval-catch-1
set prog_output "^$"
do_test eval-catch-1.m

## parse empty catch string
set test eval-catch-2
set prog_output "^$"
do_test eval-catch-2.m

## suppress error; do not execute code after error
set test eval-catch-3
set prog_output "^ans = 2"
do_test eval-catch-3.m

## execute catch clause
set test eval-catch-4
set prog_output "^ans = 1"
do_test eval-catch-4.m

## define __error_text__ *only* within catch-string
set test eval-catch-5
set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = $"
do_test eval-catch-5.m

## throw a user-defined error
set test eval-catch-6
set prog_output "__error_text__ = user-defined error\n\n__error_text__ = $"
do_test eval-catch-6.m

## pass __error_text__ to user-defined subroutine
set test eval-catch-7
set prog_output "^ans = <`a' undefined.*\n>"
do_test eval-catch-7.m

## handle nested eval: eval in try-string
set test eval-catch-8
set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = `b' undefined.*\n$"
do_test eval-catch-8.m

## handle nested eval: eval nested in catch-string
set test eval-catch-9
set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = `b' undefined.*\n$"
do_test eval-catch-9.m

## re-throw an error
set test eval-catch-10
set prog_output "__error_text__ = rethrow: `a' undefined.*\n"
do_test eval-catch-10.m