https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8ed9a46dc260f28167674c343d6c73c698724256

commit 8ed9a46dc260f28167674c343d6c73c698724256
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Mon Jul 27 00:42:11 2020 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Wed Aug 19 20:35:59 2020 +0200

    [CMD_ROSTEST] Add tests for GOTO and CALL label search ordering.
---
 modules/rostests/win32/cmd/test_goto_call.cmd     | 41 +++++++++++++++++++++++
 modules/rostests/win32/cmd/test_goto_call.cmd.exp |  4 +++
 2 files changed, 45 insertions(+)

diff --git a/modules/rostests/win32/cmd/test_goto_call.cmd 
b/modules/rostests/win32/cmd/test_goto_call.cmd
index 44add4cd9ec..14c374770f6 100644
--- a/modules/rostests/win32/cmd/test_goto_call.cmd
+++ b/modules/rostests/win32/cmd/test_goto_call.cmd
@@ -8,6 +8,47 @@ setlocal enabledelayedexpansion
 ::
 
 
+:: GOTO/CALL jump to labels present forward to their call-point. Only when
+:: the label cannot be found forward, the search is then restarted from the
+:: beginning of the batch file onwards up to the original call-point.
+::
+goto :test_start
+
+:: Execution must never go there!
+:test_goto
+echo Unexpected GOTO jump^^!
+exit
+:test_call
+echo Unexpected CALL jump^^!
+goto :EOF
+
+
+:test_start
+
+:: Testing GOTO/CALL forwards.
+echo --------- Testing GOTO ---------
+goto :test_goto
+
+:do_test_call
+echo --------- Testing CALL within batch ---------
+call :test_call
+goto :continue
+
+:test_goto
+echo Test GOTO ok
+goto :do_test_call
+
+:test_call
+echo Test CALL ok from %0
+:: We exit this CALL invocation
+goto :EOF
+
+
+::
+:: Next suite of tests.
+::
+:continue
+
 
 ::
 :: Testing GOTO/CALL from and to within parenthesized blocks.
diff --git a/modules/rostests/win32/cmd/test_goto_call.cmd.exp 
b/modules/rostests/win32/cmd/test_goto_call.cmd.exp
index 802e6c5dca3..e3566367b04 100644
--- a/modules/rostests/win32/cmd/test_goto_call.cmd.exp
+++ b/modules/rostests/win32/cmd/test_goto_call.cmd.exp
@@ -1,3 +1,7 @@
+--------- Testing GOTO ---------
+Test GOTO ok
+--------- Testing CALL within batch ---------
+Test CALL ok from :test_call
 --------- Testing GOTO within block ---------
 Block-test 1: Single-line
 Block-test 2: Multi-line

Reply via email to