2024-03-30 15:10:12 +00:00
|
|
|
# RUN: %fish %s | %filter-ctrlseqs
|
2019-07-09 17:02:50 +00:00
|
|
|
|
2017-04-05 06:26:06 +00:00
|
|
|
# Verify the correct behavior of the `setenv` compatibility shim.
|
|
|
|
|
|
|
|
# No args to `setenv` should emit the current set of env vars. The first two
|
|
|
|
# commands verify that `setenv` does not report non-env vars.
|
|
|
|
set -g setenv1 abc
|
|
|
|
setenv | grep '^setenv1=$'
|
|
|
|
set -gx setenv1 xyz
|
|
|
|
setenv | grep '^setenv1=xyz$'
|
2019-07-09 17:02:50 +00:00
|
|
|
# CHECK: setenv1=xyz
|
2017-04-05 06:26:06 +00:00
|
|
|
|
|
|
|
# A single arg should set and export the named var to nothing.
|
|
|
|
setenv setenv2
|
|
|
|
env | grep '^setenv2=$'
|
2019-07-09 17:02:50 +00:00
|
|
|
# CHECK: setenv2=
|
2017-04-05 06:26:06 +00:00
|
|
|
|
|
|
|
# Three or more args should be an error.
|
|
|
|
echo too many arguments test >&2
|
|
|
|
setenv var hello you
|
2019-07-09 17:02:50 +00:00
|
|
|
# CHECKERR: too many arguments test
|
|
|
|
# CHECKERR: setenv: Too many arguments
|
|
|
|
|
2017-04-05 06:26:06 +00:00
|
|
|
|
|
|
|
# Two args should set the named var to the second arg
|
|
|
|
setenv setenv3 'hello you'
|
|
|
|
setenv | grep '^setenv3=hello you'
|
2019-07-09 17:02:50 +00:00
|
|
|
# CHECK: setenv3=hello you
|