summary refs log tree commit diff
path: root/bin/1sh/tests/builtins/read1.0
diff options
context:
space:
mode:
Diffstat (limited to 'bin/1sh/tests/builtins/read1.0')
-rw-r--r--bin/1sh/tests/builtins/read1.026
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/1sh/tests/builtins/read1.0 b/bin/1sh/tests/builtins/read1.0
new file mode 100644
index 00000000..e0d75152
--- /dev/null
+++ b/bin/1sh/tests/builtins/read1.0
@@ -0,0 +1,26 @@
+# $FreeBSD: releng/12.1/bin/sh/tests/builtins/read1.0 190300 2009-03-22 23:00:52Z stefanf $
+set -e
+
+echo "1 2 3"		| { read a; echo "x${a}x"; }
+echo "1 2 3"		| { read a b; echo "x${a}x${b}x"; }
+echo "1 2 3"		| { read a b c; echo "x${a}x${b}x${c}x"; }
+echo "1 2 3"		| { read a b c d; echo "x${a}x${b}x${c}x${d}x"; }
+
+echo "	1  2 3 "	| { read a b c; echo "x${a}x${b}x${c}x"; }
+echo "	1  2 3 "	| { unset IFS; read a b c; echo "x${a}x${b}x${c}x"; }
+echo "	1  2 3 "	| { IFS=$(printf ' \t\n') read a b c; echo "x${a}x${b}x${c}x"; }
+echo "	1  2 3 "	| { IFS= read a b; echo "x${a}x${b}x"; }
+
+echo " 1,2 3 "		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
+echo ", 2 ,3"		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
+echo " 1 ,,3"		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
+echo " 1 , , 3"		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
+echo " 1 ,2 3,"		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
+echo " 1 ,2 3,,"	| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
+
+echo " 1,2 3 "		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
+echo ", 2 ,3"		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
+echo " 1 ,,3"		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
+echo " 1 , , 3"		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
+echo " 1 ,2 3,"		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
+echo " 1 ,2 3,,"	| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }