polserver/testsuite/pol/testpkgs/debugger/debuggee.src
Kevin Eady 3ccf701ce9
Format testsuite scripts, pol-core support modules (#713)
* Format escript testsuite

* Manual formatting for escript testsuite
- Add format-off to places where formatter does what it should, but we don't like the results
- Manually change places where formatter outputs weird things _without_ format-off, so next format-all would show changes if not fixed

* Update .err files; add update_err.py helper script

Use the format `:line:col: message` for all .err file checks. This
allows us to change the file names without needing to edit the .err
contents.

Note that `in/inc0{1,2}.err` need have error messages between POSIX and
Windows, so their messages are a bit more "generic" than the other errs.

* Format pol testsuite

* Manual formatting for pol testsuite

* Format pol-core modules

* Manual formatting for pol-core modules

* Additional format pol-core modules

Use FormatterLineWidth=10000 since module functions must be on one line
because of the parse_modules target

* Address Discord comments

- Support multi-line module function declarations in parse_modules

* Format on df07831
2024-10-04 10:29:55 +02:00

64 lines
1.9 KiB
Text

use os;
use uo;
var global_string := "global_string";
var global_long := 1;
var global_float := 3.14;
var global_array := array{ "global_array[1]", "global_array[2]", "global_array[3]" };
var global_struct := struct{ "key1" := "global_struct.key1", "key2" := "global_struct.key2",
"key3" := "global_struct.key3" };
var global_dict := dictionary{ 1 -> "global_dict[1]", 2 -> "global_dict[2]",
"three" -> "global_dict[\"three\"]" };
var shadowed_variable := "shadowed_variable:global";
program main( running )
do
Debugger();
var func1_result := func1( "func1:param1", global_string, global_long );
var func2_result := func2( "func2:param1", global_float, global_array );
var shadowed_result := funcShadowed( "funcShadowed:param1" );
Sleepms( 1 );
dowhile ( running && running != "stop" );
// This only prints in the "launch" test, as the "attach" test never finishes the loop.
//
// [NB: The "launch" test kills this script once the test finishes, whereas the "launch"
// script waits for this script to exit.]
print( "Loop finished!" ); /* print */
endprogram
function func1( func1_param1, func1_param2, func1_param3 )
func1_param1;
func1_param2;
func1_param3;
return "func1:return";
endfunction
function func2( func2_param1, func2_param2, func2_param3 )
func2_param1;
func2_param2;
func2_param3;
var funct3_result := func3( "func3:param1", global_struct, global_dict ); /* set_bp */
return "func2:return";
endfunction
function func3( func3_param1, func3_param2, func3_param3 )
func3_param1;
func3_param2;
func3_param3;
return "func3:return";
endfunction
function funcShadowed( shadowed_variable )
shadowed_variable; /* set_bp */
var was_paused := 0; // Set by debugger
for i := 1 to 10
if ( was_paused )
break;
endif
Sleepms( 100 ); // Used for `pause`
endfor
return was_paused;
endfunction