]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - tests/nameref.right
Bash-4.3 distribution sources and documentation
[thirdparty/bash.git] / tests / nameref.right
diff --git a/tests/nameref.right b/tests/nameref.right
new file mode 100644 (file)
index 0000000..5321534
--- /dev/null
@@ -0,0 +1,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 =