]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - tests/read.tests
Bash-4.3 patch 7
[thirdparty/bash.git] / tests / read.tests
index fd59284691221d5cb0f8c8f43c0c2f699fe048d1..fe27dae3ef0b7fd1cba7ebfae1c638977d3db700 100644 (file)
@@ -13,6 +13,18 @@ echo "\ a  b\ " | ( read -r x ; echo -"$x"- )
 echo " \ a  b\ " | ( read -r x y ; echo -"$x"-"$y"- )
 echo " \ a  b\ " | ( read -r x ; echo -"$x"- )
 
+# make sure that CTLESC and CTLNUL are passed through correctly
+echo $'\001' | ( read var ; recho "$var" )
+echo $'\001' | ( read ; recho "$REPLY" )
+
+echo $'\177' | ( read var ; recho "$var" )
+echo $'\177' | ( read ; recho "$REPLY" )
+
+# make sure a backslash-quoted \\n still disappears from the input when
+# we're not reading in `raw' mode, and no stray CTLESC chars are left in
+# the input stream
+echo $'ab\\\ncd' | ( read ; recho "$REPLY" )
+
 echo "A B " > /tmp/IN
 unset x y z
 read x y z < /tmp/IN
@@ -67,3 +79,20 @@ echo " foo" | { IFS=$' \t\n' ; read line; recho "$line"; }
 
 echo " foo" | { IFS=$':' ; read line; recho "$line"; }
 
+# test read -d delim behavior
+${THIS_SH} ./read1.sub
+
+# test read -t timeout behavior
+${THIS_SH} ./read2.sub
+
+# test read -n nchars behavior
+${THIS_SH} ./read3.sub
+
+# test read -u fd behavior
+${THIS_SH} ./read4.sub
+
+# test behavior when IFS is not the default -- bug through bash-2.05b
+${THIS_SH} ./read5.sub
+
+# test behavior of read -t 0
+${THIS_SH} ./read6.sub