summaryrefslogtreecommitdiffabout
path: root/tests/envop.at
Side-by-side diff
Diffstat (limited to 'tests/envop.at') (more/less context) (ignore whitespace changes)
-rw-r--r--tests/envop.at101
1 files changed, 101 insertions, 0 deletions
diff --git a/tests/envop.at b/tests/envop.at
new file mode 100644
index 0000000..6f634fb
--- a/dev/null
+++ b/tests/envop.at
@@ -0,0 +1,101 @@
+# ENVTEST(name,kw,args,output)
+m4_pushdef([ENVTEST],
+[AT_SETUP([$1])
+AT_KEYWORDS([envop $2])
+AT_CHECK([envtest $3],
+[0],
+[$4])
+AT_CLEANUP
+])
+dnl #############################
+dnl Start tests
+dnl #############################
+
+AT_BANNER([Environment modification framework])
+
+ENVTEST([default environment],[defenv],[],
+[HOME="/home/user"
+LC_ALL="C"
+LC_CTYPE="C"
+LC_MESSAGES="C"
+LC_NUMERIC="C"
+LOGIN="user"
+PATH="/usr/local/bin:/usr/bin:/bin"
+PWD="/home"
+USER="user"
+])
+
+ENVTEST([clear],[clear],[-clear])
+
+ENVTEST([keep name],[keep],[-clear -keep HOME USER],
+[HOME="/home/user"
+USER="user"
+])
+
+ENVTEST([keep name=value],[keep],[-clear -keep USER=user],
+[USER="user"
+])
+
+ENVTEST([keep name=value (mismatch)],[keep],[-clear -keep USER=gray])
+
+ENVTEST([keep wildcard],[keep],[-clear -keep 'LC_*'],
+[LC_ALL="C"
+LC_CTYPE="C"
+LC_MESSAGES="C"
+LC_NUMERIC="C"
+])
+
+ENVTEST([keep wildcard (2)],[keep],[-clear -keep 'LC_*A*'],
+[LC_ALL="C"
+LC_MESSAGES="C"
+])
+
+ENVTEST([keep wildcard (mismatch)],[keep],[-clear -keep 'LC_*A*R'])
+
+ENVTEST([set],[set],[-set FOO=bar BAR=bar],
+[BAR="bar"
+FOO="bar"
+HOME="/home/user"
+LC_ALL="C"
+LC_CTYPE="C"
+LC_MESSAGES="C"
+LC_NUMERIC="C"
+LOGIN="user"
+PATH="/usr/local/bin:/usr/bin:/bin"
+PWD="/home"
+USER="user"
+])
+
+ENVTEST([set (variable expansion)],[set],[-set 'PATH=${PATH}${PATH:+:}$HOME'],
+[HOME="/home/user"
+LC_ALL="C"
+LC_CTYPE="C"
+LC_MESSAGES="C"
+LC_NUMERIC="C"
+LOGIN="user"
+PATH="/usr/local/bin:/usr/bin:/bin:/home/user"
+PWD="/home"
+USER="user"
+])
+
+ENVTEST([unset name],[unset],[-unset HOME],
+[LC_ALL="C"
+LC_CTYPE="C"
+LC_MESSAGES="C"
+LC_NUMERIC="C"
+LOGIN="user"
+PATH="/usr/local/bin:/usr/bin:/bin"
+PWD="/home"
+USER="user"
+])
+
+ENVTEST([unset wildcard],[unset],[-unset 'LC_*'],
+[HOME="/home/user"
+LOGIN="user"
+PATH="/usr/local/bin:/usr/bin:/bin"
+PWD="/home"
+USER="user"
+])
+
+m4_popdef([ENVTEST])
+

Return to:

Send suggestions and report system problems to the System administrator.