d461b314130d16f3fb866680555801ec49772edb — Simon Ser 4 months ago 32aff6e break
test: add basic break/continue tests
1 files changed, 22 insertions(+), 0 deletions(-)

M test/loop.sh
M test/loop.sh => test/loop.sh +22 -0
@@ 1,5 1,6 @@ #!/bin/sh
  
+ echo "basic while loop"
  n=asdf
  echo start
  while [ "$n" != "fdsa" ]; do


@@ 9,6 10,27 @@ done
  echo stop
  
+ echo "continue in while loop should skip the iteration"
+ n=asdf
+ echo start
+ while [ "$n" != fdsa ]; do
+ 	n=fdsa
+ 	continue
+ 	echo "this shouldn't be printed"
+ done
+ echo stop
+ 
+ echo "break in while loop should stop the loop"
+ n=asdf
+ echo start
+ while true; do
+ 	if [ "$n" = fdsa ]; then
+ 		break
+ 	fi
+ 	n=fdsa
+ done
+ echo stop
+ 
  # Should exit immediately
  while true
  do