mksh/tests/lineno.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

112 lines
1.5 KiB
Perl

name: lineno-stdin
description:
See if $LINENO is updated and can be modified.
stdin:
echo A $LINENO
echo B $LINENO
LINENO=20
echo C $LINENO
expected-stdout:
A 1
B 2
C 20
---
name: lineno-inc
description:
See if $LINENO is set for .'d files.
file-setup: file 644 "dotfile"
echo dot A $LINENO
echo dot B $LINENO
LINENO=20
echo dot C $LINENO
stdin:
echo A $LINENO
echo B $LINENO
. ./dotfile
expected-stdout:
A 1
B 2
dot A 1
dot B 2
dot C 20
---
name: lineno-func
description:
See if $LINENO is set for commands in a function.
stdin:
echo A $LINENO
echo B $LINENO
bar() {
echo func A $LINENO
echo func B $LINENO
}
bar
echo C $LINENO
expected-stdout:
A 1
B 2
func A 4
func B 5
C 8
---
name: lineno-unset
description:
See if unsetting LINENO makes it non-magic.
file-setup: file 644 "dotfile"
echo dot A $LINENO
echo dot B $LINENO
stdin:
unset LINENO
echo A $LINENO
echo B $LINENO
bar() {
echo func A $LINENO
echo func B $LINENO
}
bar
. ./dotfile
echo C $LINENO
expected-stdout:
A
B
func A
func B
dot A
dot B
C
---
name: lineno-unset-use
description:
See if unsetting LINENO makes it non-magic even
when it is re-used.
file-setup: file 644 "dotfile"
echo dot A $LINENO
echo dot B $LINENO
stdin:
unset LINENO
LINENO=3
echo A $LINENO
echo B $LINENO
bar() {
echo func A $LINENO
echo func B $LINENO
}
bar
. ./dotfile
echo C $LINENO
expected-stdout:
A 3
B 3
func A 3
func B 3
dot A 3
dot B 3
C 3
---