gap> #############################################################################
gap> ##
gap> ##  Test UpEnv and DownEnv, and what happens when they are asked to go beyond
gap> ##  the first/last active execution context.
gap> ##
gap> f:=lvl -> 1/lvl + f(lvl-1);
function( lvl ) ... end
gap> f(7);
Error, Rational operations: <divisor> must not be zero
Stack trace:
*[1] 1 / lvl
   @ *stdin*:7
 [2] f( lvl - 1 )
   @ *stdin*:7
 [3] f( lvl - 1 )
   @ *stdin*:7
 [4] f( lvl - 1 )
   @ *stdin*:7
 [5] f( lvl - 1 )
   @ *stdin*:7
...  at *stdin*:8
type 'quit;' to quit to outer loop
brk> UpEnv(1); lvl;
0
brk> DownEnv(1); lvl;
1
brk> DownEnv(1); lvl;
2
brk> UpEnv(1); lvl;
1
brk> DownEnv(10); lvl;
7
brk> UpEnv(1); lvl;
6
brk> UpEnv(3); lvl;
3
brk> DownEnv(2); lvl;
5
brk> 
brk> #############################################################################
brk> ##
brk> ##  Reading a file without an error should have no effect on the execution
brk> ##  context. In particular, setting lvl there does not affect it in the
brk> ##  current execution context, but rather sets a global variable; likewise
brk> ##  unbinding lvl has no effect here.
brk> ##
brk> Read("good.g");
All is well
brk> lvl;
5
brk> 
brk> #############################################################################
brk> ##
brk> ##  start a fresh execution context
brk> ##
brk> Read("top-level-error.g");
Error, foo
Stack trace:
not in any function at top-level-error.g:1
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk_2> Where(20);
not in any function at *errin*:1
brk_2> lvl; # since `Read` started a fresh execution context, we can't access lvl here
Error, Variable: 'lvl' must have a value
Stack trace:
not in any function at *errin*:2
brk_2> quit;
brk> lvl;
5
brk> QUIT;
