mksh/tests/read.t
tg a34b05d2e6 Import OpenBSD 3.3 source repository from CTM 3132 the first time
This opens an OpenBSD-mirabile (aka MirBSD) repository.

### MirBSD is:
# Copyright (c) 1982-2003 by Thorsten "mirabile" Glaser <x86@ePost.de>
# Copyright © 1968-2003  The authors of And contributors to UNIX®, the
#       C Language, BSD/Berkeley Unix; 386BSD, NetBSD 1.1 and OpenBSD.
#
# Anyone who obtained a copy of this work is hereby permitted to freely use,
# distribute, modify, merge, sublicence, give away or sell it as long as the
# authors are given due credit and the following notice is retained:
#
# This work is provided "as is", with no explicit or implicit warranty what-
# soever. Use it only at your own risk. In no event may an author or contri-
# butor be held liable for any damage, directly or indirectly, that origina-
# ted through or is caused by creation or modification of this work.

MirBSD is my private tree. MirBSD does not differ very much from OpenBSD
and intentionally tracks OpenBSD. That's why it _is_ OpenBSD, just not the
official one. It's like with DarrenBSD.

At time of this writing, no advertising for MirBSD must be done,
because the advertising clause has not yet been sorted out.

http://templeofhate.com/tglaser/MirBSD/index.php
2003-03-22 17:35:03 +00:00

59 lines
1.3 KiB
Perl

# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
#
# To test:
# POSIX:
# - if no -r, \ is escape character
# - \newline disappear
# - \<IFS> -> don't break here
# - \<anything-else> -> <anything-else>
# - if -r, backslash is not special
# - if stdin is tty and shell interactive
# - prompt for continuation if \newline (prompt to stderr)
# - a here-document isn't terminated after newline ????
# - remaining vars set to empty string (not null)
# - check field splitting
# - left over fields and their separators assigned to last var
# - exit status is normally 0
# - exit status is > 0 on eof
# - exit status > 0 on error
# - signals interrupt reads
# extra:
# - can't change read-only variables
# - error if var name bogus
# - set -o allexport effects read
# ksh:
# x check default variable: REPLY
# - check -p, -s, -u options
# - check var?prompt stuff
# - "echo a b | read x y" sets x,y in parent shell (at&t)
#
name: read-IFS-1
description:
Simple test, default IFS
stdin:
echo "A B " > IN
unset x y z
read x y z < IN
echo 1: "x[$x] y[$y] z[$z]"
echo 1a: ${z-z not set}
read x < IN
echo 2: "x[$x]"
expected-stdout:
1: x[A] y[B] z[]
1a:
2: x[A B]
---
name: read-ksh-1
description:
If no var specified, REPLY is used
stdin:
echo "abc" > IN
read < IN
echo "[$REPLY]";
expected-stdout:
[abc]
---