aboutsummaryrefslogtreecommitdiffstats
path: root/tests/nameref.right
blob: 53215348859936fd5c1efce88281752940ab35d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
one
two
three
declare -n fee="flip"
declare -n foo="bar"
turning off nameref attribute on foo
bar
after +n foo bar = other
one
two
one
expect <one>
argv[1] = <one>
expect <two>
argv[1] = <two>
expect <one>
one
expect <one>
one
expect <one>
argv[1] = <one>
changevar: expect <two>
argv[1] = <two>
expect <two>
argv[1] = <two>
changevar: expect <three four five>
argv[1] = <three four five>
expect <three four five>
argv[1] = <three four five>
./nameref.tests: line 93: bar: readonly variable
./nameref.tests: line 94: foo: readonly variable
one
one
./nameref.tests: line 106: foo: readonly variable
./nameref.tests: line 103: foo: readonly variable
one
one
bar

./nameref2.sub: line 5: foo: readonly variable

expect <unset>
argv[1] = <unset>
expect <unset>
argv[1] = <unset>
expect <bar>
argv[1] = <bar>
expect <unset>
argv[1] = <unset>
./nameref3.sub: line 21: unset: bar: cannot unset: readonly variable
expect <two>
two
expect <two>
two
three
unset
four
0
expect <a b>
a b
expect <foo>
foo
1 3 5 7 9
9
1 3 42 7 9
1 3 42 7 9
9
1 3 44 7 9
unset
expect <a b c d e>
argv[1] = <a b c d e>
expect <zero> <one> <seven> <three> <four>
argv[1] = <zero>
argv[2] = <one>
argv[3] = <seven>
argv[4] = <three>
argv[5] = <four>
16
expect <4>
4
expect <4>
4
expect <4>
4
expect <one>
one
expect <one>
one
expect <one>
one
expect <four>
four
errors = 0
1
2
v1: 1
v2: 2
ref -> first, value: I am first
ref -> second, value: I am in the middle
ref -> third, value: I am last
final state: ref -> third, value: I am last
ref -> one, value: 1
ref -> two, value: 2
ref -> three, value: 3
final state: ref -> three, value: 3
./nameref5.sub: line 43: unset: three: cannot unset: readonly variable
ref -> one, value: 1
ref -> two, value: 2
ref -> three, value: 3
final state: ref -> three, value: 3
./nameref6.sub: line 2: typeset: x: nameref variable self references not allowed
./nameref6.sub: line 12: typeset: x: reference variable cannot be an array
the -- 1
42 -- 0
y -- 0
2 -- 0
2 -- 0
y -- 0
bar
unset
inside
inside: two
outside:
foo
local
./nameref8.sub: line 47: typeset: v: nameref variable self references not allowed
./nameref8.sub: line 54: warning: x: circular name reference
./nameref8.sub: line 55: warning: x: circular name reference
x =