xref: /openbsd/regress/bin/ksh/lineno.t (revision 771fbea0)
1name: lineno-stdin
2description:
3	See if $LINENO is updated and can be modified.
4stdin:
5	echo A $LINENO
6	echo B $LINENO
7	LINENO=20
8	echo C $LINENO
9expected-stdout:
10	A 1
11	B 2
12	C 20
13---
14
15name: lineno-inc
16description:
17	See if $LINENO is set for .'d files.
18file-setup: file 644 "dotfile"
19	echo dot A $LINENO
20	echo dot B $LINENO
21	LINENO=20
22	echo dot C $LINENO
23stdin:
24	echo A $LINENO
25	echo B $LINENO
26	. ./dotfile
27expected-stdout:
28	A 1
29	B 2
30	dot A 1
31	dot B 2
32	dot C 20
33---
34
35
36name: lineno-func
37description:
38	See if $LINENO is set for commands in a function.
39stdin:
40	echo A $LINENO
41	echo B $LINENO
42	bar() {
43	    echo func A $LINENO
44	    echo func B $LINENO
45	}
46	bar
47	echo C $LINENO
48expected-stdout:
49	A 1
50	B 2
51	func A 4
52	func B 5
53	C 8
54---
55
56name: lineno-unset
57description:
58	See if unsetting LINENO makes it non-magic.
59file-setup: file 644 "dotfile"
60	echo dot A $LINENO
61	echo dot B $LINENO
62stdin:
63	unset LINENO
64	echo A $LINENO
65	echo B $LINENO
66	bar() {
67	    echo func A $LINENO
68	    echo func B $LINENO
69	}
70	bar
71	. ./dotfile
72	echo C $LINENO
73expected-stdout:
74	A
75	B
76	func A
77	func B
78	dot A
79	dot B
80	C
81---
82
83name: lineno-unset-use
84description:
85	See if unsetting LINENO makes it non-magic even
86	when it is re-used.
87file-setup: file 644 "dotfile"
88	echo dot A $LINENO
89	echo dot B $LINENO
90stdin:
91	unset LINENO
92	LINENO=3
93	echo A $LINENO
94	echo B $LINENO
95	bar() {
96	    echo func A $LINENO
97	    echo func B $LINENO
98	}
99	bar
100	. ./dotfile
101	echo C $LINENO
102expected-stdout:
103	A 3
104	B 3
105	func A 3
106	func B 3
107	dot A 3
108	dot B 3
109	C 3
110---
111
112