Add a few tests for the read built-in.
This commit is contained in:
parent
7836b44d7b
commit
79a3bf3a75
25
tools/regression/bin/sh/builtins/read1.0
Normal file
25
tools/regression/bin/sh/builtins/read1.0
Normal file
@ -0,0 +1,25 @@
|
||||
# $FreeBSD$
|
||||
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 " | { 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"; }
|
19
tools/regression/bin/sh/builtins/read1.0.stdout
Normal file
19
tools/regression/bin/sh/builtins/read1.0.stdout
Normal file
@ -0,0 +1,19 @@
|
||||
x1 2 3x
|
||||
x1x2 3x
|
||||
x1x2x3x
|
||||
x1x2x3xx
|
||||
x1x2x3x
|
||||
x1x2x3x
|
||||
x 1 2 3 xx
|
||||
x1x2x3x
|
||||
xx2x3x
|
||||
x1xx3x
|
||||
x1xx3x
|
||||
x1x2x3x
|
||||
x1x2x3,,x
|
||||
x1x2x3x
|
||||
xx2x3x
|
||||
x1xx3x
|
||||
x1xx3x
|
||||
x1x2x3x
|
||||
x1x2x3,,x
|
Loading…
Reference in New Issue
Block a user