]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
new testcase for while and until loops
authorBVK Chaitanya <bvk.groups@gmail.com>
Tue, 26 Jan 2010 07:02:47 +0000 (12:32 +0530)
committerBVK Chaitanya <bvk.groups@gmail.com>
Tue, 26 Jan 2010 07:02:47 +0000 (12:32 +0530)
tests/grub_script_while1.in [new file with mode: 0644]

diff --git a/tests/grub_script_while1.in b/tests/grub_script_while1.in
new file mode 100644 (file)
index 0000000..554247f
--- /dev/null
@@ -0,0 +1,32 @@
+#! @builddir@/grub-shell-tester
+
+echo one
+foo=""
+while test "$foo" != "1111"; do foo="${foo}1"; echo "$foo"; done
+
+echo two
+foo=""
+while test "$foo" != "aaaa"
+do
+  foo="${foo}a"
+  echo $foo
+done
+
+foo=""
+until test "$foo" = "1111"; do foo="${foo}1"; echo $foo; done
+foo=""
+until test "$foo" = "aaaa"
+do
+  foo="${foo}a"
+  echo $foo
+done
+
+# check "$?" in condition gets its value from while body commands
+foo=""
+false
+while test "$?" != "0"
+do
+    echo $foo
+    foo="${foo}1"
+    test "$foo" = "111111"
+done