aboutsummaryrefslogtreecommitdiff
path: root/tests/env.test
blob: 286fb36c1cb4d7f0d19366920d10ffbba4bbc33f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testcmd "name "args" "result" "infile" "stdin"
#testing "name" "command" "result" "infile" "stdin"

export WALRUS=42 BANANA=hello LETTERS=
FILTER="| egrep '^(WALRUS|BANANA|LETTERS)=' | sort"

testcmd "read" "$FILTER" "BANANA=hello\nLETTERS=\nWALRUS=42\n" "" ""
testcmd "-u" "-u BANANA $FILTER" "LETTERS=\nWALRUS=42\n" "" ""
testcmd "-uu" "-u LETTERS -u WALRUS $FILTER" "BANANA=hello\n" "" ""
testcmd "-i" "-i env" "" "" ""
testcmd "-i =" "-i one=two three=four env | sort" \
  "one=two\nthree=four\n" "" ""
testcmd "-0" "-i five=six seven=eight env -0 | sort -z" "five=six\0seven=eight\0" "" ""
unset WALRUS BANANA LETTERS FILTER

testcmd "early fail" '--oops 2> /dev/null ; echo $?' "125\n" "" ""