From 3e4911044ac4e6419720e04a8de2bcd6773151ce Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 17 Oct 2017 16:43:55 +0200 Subject: [PATCH 01/10] Introduce struct LVarsHeader --- src/vars.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/vars.h b/src/vars.h index 97dec684d8..bcec799910 100644 --- a/src/vars.h +++ b/src/vars.h @@ -73,12 +73,18 @@ static inline int IS_LVARS_OR_HVARS(Obj obj) } +typedef struct { + Obj func; + Expr stat; + Obj parent; +} LVarsHeader; + /**************************************************************************** ** *F FUNC_LVARS . . . . . . . . . . . function to which the given lvars belong ** */ -#define FUNC_LVARS_PTR(lvars_ptr) (lvars_ptr[0]) +#define FUNC_LVARS_PTR(lvars_ptr) (((LVarsHeader *)lvars_ptr)->func) #define FUNC_LVARS(lvars_obj) FUNC_LVARS_PTR(ADDR_OBJ(lvars_obj)) @@ -87,7 +93,7 @@ static inline int IS_LVARS_OR_HVARS(Obj obj) *F STAT_LVARS . . . . . . . current statement in function of the given lvars ** */ -#define STAT_LVARS_PTR(lvars_ptr) (lvars_ptr[1]) +#define STAT_LVARS_PTR(lvars_ptr) (((LVarsHeader *)lvars_ptr)->stat) #define STAT_LVARS(lvars_obj) STAT_LVARS_PTR(ADDR_OBJ(lvars_obj)) @@ -96,7 +102,7 @@ static inline int IS_LVARS_OR_HVARS(Obj obj) *F PARENT_LVARS . . . . . . . . . . . . . . parent lvars of the given lvars ** */ -#define PARENT_LVARS_PTR(lvars_ptr) (lvars_ptr[2]) +#define PARENT_LVARS_PTR(lvars_ptr) (((LVarsHeader *)lvars_ptr)->parent) #define PARENT_LVARS(lvars_obj) PARENT_LVARS_PTR(ADDR_OBJ(lvars_obj)) @@ -136,11 +142,11 @@ static inline void SetBrkCallTo( Expr expr, const char * file, int line ) { (int)expr, (int)STATE(CurrLVars), file, line); } #endif - STAT_LVARS_PTR(STATE(PtrLVars)) = (Obj)expr; + STAT_LVARS_PTR(STATE(PtrLVars)) = expr; } #ifndef NO_BRK_CALLS -#define BRK_CALL_TO() ((Expr)STAT_LVARS_PTR(STATE(PtrLVars))) +#define BRK_CALL_TO() STAT_LVARS_PTR(STATE(PtrLVars)) #define SET_BRK_CALL_TO(expr) SetBrkCallTo(expr, __FILE__, __LINE__) #else #define BRK_CALL_TO() /* do nothing */ From d360892972d3eb32c089953c23c2507c9803f671 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 17 Oct 2017 16:37:37 +0200 Subject: [PATCH 02/10] Use {STAT,FUNC}_LVARS macros in more places --- src/gap.c | 10 +++++----- src/read.c | 8 ++++---- src/vars.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gap.c b/src/gap.c index b053e5cee6..8400861a80 100644 --- a/src/gap.c +++ b/src/gap.c @@ -2802,7 +2802,7 @@ GVarDescriptor GVarTHREAD_INIT; GVarDescriptor GVarTHREAD_EXIT; void ThreadedInterpreter(void *funcargs) { - Obj tmp, func; + Obj tmp, func, body; int i; /* intialize everything and begin an interpreter */ @@ -2815,10 +2815,10 @@ void ThreadedInterpreter(void *funcargs) { STATE(NrError) = 0; STATE(ThrownObject) = 0; STATE(BottomLVars) = NewBag( T_HVARS, 3*sizeof(Obj) ); - tmp = NewFunctionC( "bottom", 0, "", 0 ); - PTR_BAG(STATE(BottomLVars))[0] = tmp; - tmp = NewBag( T_BODY, sizeof(BodyHeader) ); - SET_BODY_FUNC( PTR_BAG(STATE(BottomLVars))[0], tmp ); + func = NewFunctionC( "bottom", 0, "", 0 ); + FUNC_LVARS(STATE(BottomLVars)) = func; + body = NewBag( T_BODY, sizeof(BodyHeader) ); + SET_BODY_FUNC( func, body ); STATE(CurrLVars) = STATE(BottomLVars); IntrBegin( STATE(BottomLVars) ); diff --git a/src/read.c b/src/read.c index 2916ff1090..475ec71764 100644 --- a/src/read.c +++ b/src/read.c @@ -415,7 +415,7 @@ void ReadCallVarAss ( lvars = lvars0; nest = 0; while ( type == ' ' && lvars != 0 && lvars != STATE(BottomLVars) ) { - nams = NAMS_FUNC(PTR_BAG(lvars)[0]); + nams = NAMS_FUNC(FUNC_LVARS(lvars)); if (nams != (Obj) 0) { indx = LEN_LIST( nams ); @@ -436,7 +436,7 @@ void ReadCallVarAss ( } } } - lvars = ENVI_FUNC( PTR_BAG( lvars )[0] ); + lvars = ENVI_FUNC( FUNC_LVARS( lvars ) ); nest++; if (nest >= 65536) { @@ -2728,11 +2728,11 @@ void RecreateStackNams( Obj context ) { Obj lvars = context; while (lvars != STATE(BottomLVars) && lvars != (Obj)0) { - Obj nams = NAMS_FUNC(PTR_BAG(lvars)[0]); + Obj nams = NAMS_FUNC(FUNC_LVARS(lvars)); if (nams != (Obj) 0) { PushPlist( STATE(StackNams), nams); } - lvars = ENVI_FUNC(PTR_BAG(lvars)[0]); + lvars = ENVI_FUNC(FUNC_LVARS(lvars)); } // At this point we have the stack upside down, so invert it diff --git a/src/vars.c b/src/vars.c index b4c9cf7184..df3723116a 100644 --- a/src/vars.c +++ b/src/vars.c @@ -2525,7 +2525,7 @@ void SaveLVars( Obj lvars ) UInt len,i; Obj *ptr; SaveSubObj(FUNC_LVARS(lvars)); - SaveUInt((UInt)ADDR_OBJ(lvars)[1]); + SaveUInt(STAT_LVARS(lvars)); SaveSubObj(PARENT_LVARS(lvars)); len = (SIZE_OBJ(lvars) - (2*sizeof(Obj)+sizeof(UInt)))/sizeof(Obj); ptr = ADDR_OBJ(lvars)+3; @@ -2544,7 +2544,7 @@ void LoadLVars( Obj lvars ) UInt len,i; Obj *ptr; FUNC_LVARS(lvars) = LoadSubObj(); - ((UInt *)ADDR_OBJ(lvars))[1] = LoadUInt(); + STAT_LVARS(lvars) = LoadUInt(); PARENT_LVARS(lvars) = LoadSubObj(); len = (SIZE_OBJ(lvars) - (2*sizeof(Obj)+sizeof(UInt)))/sizeof(Obj); ptr = ADDR_OBJ(lvars)+3; From 25a2bba0b3476ce79d0688eaf9b12814860c5313 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 17 Oct 2017 17:03:40 +0200 Subject: [PATCH 03/10] Fix FuncParentLVars for bottom lvars Now returns fail again --- src/vars.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vars.c b/src/vars.c index df3723116a..5cf317f08d 100644 --- a/src/vars.c +++ b/src/vars.c @@ -2469,7 +2469,8 @@ Obj FuncParentLVars( Obj self, Obj lvars ) (Int)TNAM_OBJ(lvars), 0L ); return 0; } - return PARENT_LVARS(lvars); + Obj parent = PARENT_LVARS(lvars); + return parent ? parent : Fail; } Obj FuncContentsLVars (Obj self, Obj lvars ) From 188236755b8bdcd8861e04c830fc3638375d72a2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 17 Oct 2017 17:45:50 +0200 Subject: [PATCH 04/10] Reset ErrorLLevel when entering/leaving break loops --- src/gap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gap.c b/src/gap.c index 8400861a80..5b70c834ae 100644 --- a/src/gap.c +++ b/src/gap.c @@ -238,8 +238,10 @@ Obj Shell ( Obj context, STATE(ShellContext) = context; oldBaseShellContext = STATE(BaseShellContext); STATE(BaseShellContext) = context; + Int oldErrorLLevel = STATE(ErrorLLevel); + STATE(ErrorLLevel) = 0; oldRecursionDepth = STATE(RecursionDepth); - + /* read-eval-print loop */ if (!OpenOutput(outFile)) ErrorQuit("SHELL: can't open outfile %s",(Int)outFile,0); @@ -353,6 +355,7 @@ Obj Shell ( Obj context, CloseOutput(); STATE(BaseShellContext) = oldBaseShellContext; STATE(ShellContext) = oldShellContext; + STATE(ErrorLLevel) = oldErrorLLevel; STATE(RecursionDepth) = oldRecursionDepth; if (STATE(UserHasQUIT)) { From b8c9f97b9b9764232246bd36c8ab498ec640e489 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 17 Oct 2017 17:47:58 +0200 Subject: [PATCH 05/10] Fix DownEnv / UpEnv handling Also get rid of STATE(ErrorLVars0) This is an example for DownEnv/UpEnv usage: gap> f:=lvl -> 1/lvl + f(lvl-1); function( lvl ) ... end gap> f(3); Error, Rational operations: must not be zero in return 1 / lvl + f( (lvl - 1) ); called from f( lvl - 1 ) called from f( lvl - 1 ) called from f( lvl - 1 ) called from ( ) called from read-eval loop at line 12 of *stdin* you can replace via 'return ;' brk> lvl; 0 brk> UpEnv(1); lvl; 0 brk> DownEnv(1); lvl; 1 brk> DownEnv(1); lvl; 2 brk> UpEnv(1); lvl; 1 brk> DownEnv(1); lvl; 2 brk> DownEnv(1); lvl; 3 brk> DownEnv(1); lvl; 3 brk> UpEnv(1); lvl; 2 Note that before this commit, the very last UpEnv(1) incorrectly returned us to level 0. --- src/gap.c | 2 +- src/gap.h | 3 --- src/gapstate.h | 3 +-- src/read.c | 4 ---- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/gap.c b/src/gap.c index 5b70c834ae..277bc48b32 100644 --- a/src/gap.c +++ b/src/gap.c @@ -950,7 +950,7 @@ void DownEnvInner( Int depth ) depth = 0; } /* ... then go back to the top, and later go down to the appropriate level. */ - STATE(ErrorLVars) = STATE(ErrorLVars0); + STATE(ErrorLVars) = STATE(BaseShellContext); STATE(ErrorLLevel) = 0; STATE(ShellContext) = STATE(BaseShellContext); } diff --git a/src/gap.h b/src/gap.h index 53851f5762..b3ac7972da 100644 --- a/src/gap.h +++ b/src/gap.h @@ -201,9 +201,6 @@ extern void ErrorReturnVoid ( Int arg2, const Char * msg2 ); -/* TL: extern Obj ErrorLVars; - TL: extern Obj ErrorLVars0; - */ /**************************************************************************** ** diff --git a/src/gapstate.h b/src/gapstate.h index e3b223a77d..9e726664ba 100644 --- a/src/gapstate.h +++ b/src/gapstate.h @@ -141,9 +141,8 @@ typedef struct GAPState { UInt UserHasQUIT; Obj ShellContext; Obj BaseShellContext; - Obj ErrorLVars0; // the initial ErrorLVars value, i.e. for the lvars were the break occurred Obj ErrorLVars; // ErrorLVars as modified by DownEnv / UpEnv - Int ErrorLLevel; // record where on the stack ErrorLVars is relative to the top, i.e. ErrorLVars0 + Int ErrorLLevel; // record where on the stack ErrorLVars is relative to the top, i.e. BaseShellContext /* From objects.c */ Obj PrintObjThis; diff --git a/src/read.c b/src/read.c index 475ec71764..5a736094ef 100644 --- a/src/read.c +++ b/src/read.c @@ -2755,7 +2755,6 @@ ExecStatus ReadEvalCommand ( Obj context, UInt *dualSemicolon ) volatile UInt readTilde; volatile UInt currLHSGVar; volatile Obj errorLVars; - volatile Obj errorLVars0; syJmp_buf readJmpError; #ifdef HPCGAP int lockSP; @@ -2792,9 +2791,7 @@ ExecStatus ReadEvalCommand ( Obj context, UInt *dualSemicolon ) STATE(CurrLHSGVar) = 0; RecreateStackNams(context); errorLVars = STATE(ErrorLVars); - errorLVars0 = STATE(ErrorLVars0); STATE(ErrorLVars) = context; - STATE(ErrorLVars0) = STATE(ErrorLVars); #ifdef HPCGAP lockSP = RegionLockSP(); #endif @@ -2862,7 +2859,6 @@ ExecStatus ReadEvalCommand ( Obj context, UInt *dualSemicolon ) STATE(ReadTilde) = readTilde; STATE(CurrLHSGVar) = currLHSGVar; STATE(ErrorLVars) = errorLVars; - STATE(ErrorLVars0) = errorLVars0; /* copy the result (if any) */ STATE(ReadEvalResult) = STATE(IntrResult); From a2182e11da2f1571d5b6b02b8c99b9eb42986ff2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 20 Oct 2017 17:07:56 +0200 Subject: [PATCH 06/10] .gitignore: change *.out -> main.out --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 009a10b209..168547729e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,7 @@ *.ind *.lab *.log -*.out +main.out *.pdf *.pnr *.six From 71df3bb8b4d1e29da72ca5fe3e9b91ed7ee73d39 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 20 Oct 2017 17:08:33 +0200 Subject: [PATCH 07/10] test-error/run_gap.sh: pipe test data in, instead of using Read --- tst/test-error/bad-add.g.out | 7 ++++--- tst/test-error/bad-array-double-1.g.out | 5 +++-- tst/test-error/bad-array-int-0.g.out | 7 ++++--- tst/test-error/bad-array-int-1.g.out | 7 ++++--- tst/test-error/bad-array-string.g.out | 7 ++++--- tst/test-error/bad-array-undef-0.g.out | 7 ++++--- tst/test-error/bad-array-undef-1.g.out | 7 ++++--- tst/test-error/bad-minus.g.out | 7 ++++--- tst/test-error/run_gap.sh | 2 +- tst/test-error/top-level-error.g.out | 4 ++-- 10 files changed, 34 insertions(+), 26 deletions(-) diff --git a/tst/test-error/bad-add.g.out b/tst/test-error/bad-add.g.out index e9a58fa8b3..45c50faa85 100644 --- a/tst/test-error/bad-add.g.out +++ b/tst/test-error/bad-add.g.out @@ -1,8 +1,9 @@ +function( ) ... end Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `+' on 2 arguments at GAPROOT/lib/methsel2.g:241 called from -1 + "abc" at bad-add.g:2 called from +1 + "abc" at *stdin*:2 called from ( ) - called from read-eval loop at bad-add.g:4 + called from read-eval loop at *stdin*:4 you can 'quit;' to quit to outer loop, or you can 'return;' to continue -brk> +brk> \ No newline at end of file diff --git a/tst/test-error/bad-array-double-1.g.out b/tst/test-error/bad-array-double-1.g.out index 39d4783d23..cb3c165dbd 100644 --- a/tst/test-error/bad-array-double-1.g.out +++ b/tst/test-error/bad-array-double-1.g.out @@ -1,8 +1,9 @@ +function( ) ... end Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `[]' on 3 arguments at GAPROOT/lib/methsel2.g:241 called from called from ( ) - called from read-eval loop at bad-array-double-1.g:4 + called from read-eval loop at *stdin*:4 you can 'quit;' to quit to outer loop, or you can 'return;' to continue -brk> +brk> \ No newline at end of file diff --git a/tst/test-error/bad-array-int-0.g.out b/tst/test-error/bad-array-int-0.g.out index 41093441a6..d40312b4ef 100644 --- a/tst/test-error/bad-array-int-0.g.out +++ b/tst/test-error/bad-array-int-0.g.out @@ -1,8 +1,9 @@ +function( ) ... end Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `[]' on 2 arguments at GAPROOT/lib/methsel2.g:241 called from -l[0] at bad-array-int-0.g:4 called from +l[0] at *stdin*:4 called from ( ) - called from read-eval loop at bad-array-int-0.g:6 + called from read-eval loop at *stdin*:6 you can 'quit;' to quit to outer loop, or you can 'return;' to continue -brk> +brk> \ No newline at end of file diff --git a/tst/test-error/bad-array-int-1.g.out b/tst/test-error/bad-array-int-1.g.out index 9b8911aec5..57ef9011d8 100644 --- a/tst/test-error/bad-array-int-1.g.out +++ b/tst/test-error/bad-array-int-1.g.out @@ -1,6 +1,7 @@ +function( ) ... end Error, List Element: must be a list (not a integer) in - return 1[1]; at bad-array-int-1.g:2 called from + return 1[1]; at *stdin*:2 called from ( ) - called from read-eval loop at bad-array-int-1.g:4 + called from read-eval loop at *stdin*:4 you can replace via 'return ;' -brk> +brk> \ No newline at end of file diff --git a/tst/test-error/bad-array-string.g.out b/tst/test-error/bad-array-string.g.out index d27ed2196b..68450ce427 100644 --- a/tst/test-error/bad-array-string.g.out +++ b/tst/test-error/bad-array-string.g.out @@ -1,8 +1,9 @@ +function( ) ... end Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `[]' on 2 arguments at GAPROOT/lib/methsel2.g:241 called from -1["abc"] at bad-array-string.g:2 called from +1["abc"] at *stdin*:2 called from ( ) - called from read-eval loop at bad-array-string.g:4 + called from read-eval loop at *stdin*:4 you can 'quit;' to quit to outer loop, or you can 'return;' to continue -brk> +brk> \ No newline at end of file diff --git a/tst/test-error/bad-array-undef-0.g.out b/tst/test-error/bad-array-undef-0.g.out index 6251b68e3f..c8c079ee57 100644 --- a/tst/test-error/bad-array-undef-0.g.out +++ b/tst/test-error/bad-array-undef-0.g.out @@ -1,6 +1,7 @@ +function( ) ... end Error, Variable: 'l' must have an assigned value in - return l[1]; at bad-array-undef-0.g:3 called from + return l[1]; at *stdin*:3 called from ( ) - called from read-eval loop at bad-array-undef-0.g:5 + called from read-eval loop at *stdin*:5 you can 'return;' after assigning a value -brk> +brk> \ No newline at end of file diff --git a/tst/test-error/bad-array-undef-1.g.out b/tst/test-error/bad-array-undef-1.g.out index 497478201d..4020942e49 100644 --- a/tst/test-error/bad-array-undef-1.g.out +++ b/tst/test-error/bad-array-undef-1.g.out @@ -1,6 +1,7 @@ +function( ) ... end Error, Variable: 'm' must have an assigned value in - return l[m]; at bad-array-undef-1.g:4 called from + return l[m]; at *stdin*:4 called from ( ) - called from read-eval loop at bad-array-undef-1.g:6 + called from read-eval loop at *stdin*:6 you can 'return;' after assigning a value -brk> +brk> \ No newline at end of file diff --git a/tst/test-error/bad-minus.g.out b/tst/test-error/bad-minus.g.out index e84e1fd4b0..566dc4a7db 100644 --- a/tst/test-error/bad-minus.g.out +++ b/tst/test-error/bad-minus.g.out @@ -1,10 +1,11 @@ +function( ) ... end Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `AdditiveInverseMutable' on 1 arguments at GAPROOT/lib/methsel2.g:241 called from AINV_MUT( elm ) at GAPROOT/lib/arith.gi:200 called from AdditiveInverseAttr( elm ) at GAPROOT/lib/arith.gi:213 called from -1 - "abc" at bad-minus.g:2 called from +1 - "abc" at *stdin*:2 called from ( ) - called from read-eval loop at bad-minus.g:4 + called from read-eval loop at *stdin*:4 you can 'quit;' to quit to outer loop, or you can 'return;' to continue -brk> +brk> \ No newline at end of file diff --git a/tst/test-error/run_gap.sh b/tst/test-error/run_gap.sh index 1b1ccb4c92..18e89febdc 100755 --- a/tst/test-error/run_gap.sh +++ b/tst/test-error/run_gap.sh @@ -8,4 +8,4 @@ # 3) Rewrite the root of gap with the string GAPROOT, # so the output is usable on other machines GAPROOT=$(cd ../..; pwd) -echo 'Read("'$2'");\n' | $1 -r -A -q -b -x 200 2>&1 | sed "s:${GAPROOT//:/\\:}:GAPROOT:g" +cat "$2" | "$1" -r -A -q -b -x 200 2>&1 | sed "s:${GAPROOT//:/\\:}:GAPROOT:g" diff --git a/tst/test-error/top-level-error.g.out b/tst/test-error/top-level-error.g.out index 5af759e555..3026709651 100644 --- a/tst/test-error/top-level-error.g.out +++ b/tst/test-error/top-level-error.g.out @@ -1,5 +1,5 @@ Error, foo called from -not in any function at top-level-error.g:1 +not in any function at *stdin*:1 you can 'quit;' to quit to outer loop, or you can 'return;' to continue -brk> +brk> brk> \ No newline at end of file From d5d8c5bb381632f4692d7bc4ffe31db8b3eefd83 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 20 Oct 2017 17:35:11 +0200 Subject: [PATCH 08/10] Add test for UpEnv/DownEnv --- tst/test-error/up-down-env.g | 10 ++++++++++ tst/test-error/up-down-env.g.out | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tst/test-error/up-down-env.g create mode 100644 tst/test-error/up-down-env.g.out diff --git a/tst/test-error/up-down-env.g b/tst/test-error/up-down-env.g new file mode 100644 index 0000000000..031a9f4b24 --- /dev/null +++ b/tst/test-error/up-down-env.g @@ -0,0 +1,10 @@ +f:=lvl -> 1/lvl + f(lvl-1); +f(7); +UpEnv(1); lvl; +DownEnv(1); lvl; +DownEnv(1); lvl; +UpEnv(1); lvl; +DownEnv(10); lvl; +UpEnv(1); lvl; +UpEnv(3); lvl; +DownEnv(2); lvl; diff --git a/tst/test-error/up-down-env.g.out b/tst/test-error/up-down-env.g.out new file mode 100644 index 0000000000..033e2665f4 --- /dev/null +++ b/tst/test-error/up-down-env.g.out @@ -0,0 +1,19 @@ +function( lvl ) ... end +Error, Rational operations: must not be zero in + return 1 / lvl + f( (lvl - 1) ); at *stdin*:1 called from +f( lvl - 1 ) at *stdin*:1 called from +f( lvl - 1 ) at *stdin*:1 called from +f( lvl - 1 ) at *stdin*:1 called from +f( lvl - 1 ) at *stdin*:1 called from +f( lvl - 1 ) at *stdin*:1 called from +... at *stdin*:2 +you can replace via 'return ;' +brk> 0 +brk> 1 +brk> 2 +brk> 1 +brk> 7 +brk> 6 +brk> 3 +brk> 5 +brk> \ No newline at end of file From 913f62b582f48515353456d49d8724226d7987ad Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 20 Oct 2017 17:41:07 +0200 Subject: [PATCH 09/10] test-error: add 'good' test --- tst/test-error/good.g | 1 + tst/test-error/good.g.out | 1 + 2 files changed, 2 insertions(+) create mode 100644 tst/test-error/good.g create mode 100644 tst/test-error/good.g.out diff --git a/tst/test-error/good.g b/tst/test-error/good.g new file mode 100644 index 0000000000..3c3230cae1 --- /dev/null +++ b/tst/test-error/good.g @@ -0,0 +1 @@ +Print("All is well\n"); diff --git a/tst/test-error/good.g.out b/tst/test-error/good.g.out new file mode 100644 index 0000000000..9c75d5200d --- /dev/null +++ b/tst/test-error/good.g.out @@ -0,0 +1 @@ +All is well From f03ff724f0b375d80991031b0f9c6338881a3edf Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 20 Oct 2017 17:44:15 +0200 Subject: [PATCH 10/10] Extend UpEnv/DownEnv test --- tst/test-error/up-down-env.g | 7 +++++++ tst/test-error/up-down-env.g.out | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/tst/test-error/up-down-env.g b/tst/test-error/up-down-env.g index 031a9f4b24..ca0666858c 100644 --- a/tst/test-error/up-down-env.g +++ b/tst/test-error/up-down-env.g @@ -8,3 +8,10 @@ DownEnv(10); lvl; UpEnv(1); lvl; UpEnv(3); lvl; DownEnv(2); lvl; +Read("good.g"); +lvl; +Read("top-level-error.g"); +Where(20); +lvl; +quit; +lvl; diff --git a/tst/test-error/up-down-env.g.out b/tst/test-error/up-down-env.g.out index 033e2665f4..ff8846171a 100644 --- a/tst/test-error/up-down-env.g.out +++ b/tst/test-error/up-down-env.g.out @@ -16,4 +16,14 @@ brk> 7 brk> 6 brk> 3 brk> 5 +brk> All is well +brk> 5 +brk> Error, foo called from +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> not in any function at *errin*:1 +brk_2> Error, Variable: 'lvl' must have a value +not in any function at *errin*:2 +brk_2> brk> 5 brk> \ No newline at end of file