jehanne/qa/lib/c/env.rc

29 lines
802 B
Plaintext
Raw Normal View History

#!/cmd/rc
# verify that environment variables can have names 127 byte long
# why 127? because it's the size of genbuf in the kernel's Proc structure
# minus the ending \0
abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678=10
if ( ! ~ $abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678 10 ) {
echo FAIL: cannot read an environment variable with a long name
exit FAIL
}
# verify that rc lists work
list=(How now brown cow)
string=$"list
if( ! ~ $#list 4 ) {
echo FAIL: list count does not work on a 4 elements list
exit FAIL
}
if( ! ~ $#string 1 ) {
echo FAIL: list count does not work on a single string
exit FAIL
}
echo PASS
exit PASS