1# This file is part of GNU Rush.
2# Copyright (C) 2016-2019 Sergey Poznyakoff
3#
4# GNU Rush is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# GNU Rush is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with GNU Rush.  If not, see <http://www.gnu.org/licenses/>.
16
17AT_SETUP([unsetenv])
18AT_KEYWORDS([unsetenv])
19
20m4_pushdef([RUSH_ENVIRON],[-i HOME=$PWD USER=$MY_USER LOGIN=$MY_USER])
21AT_RUSH_TEST([
22rush 2.0
23rule
24    unsetenv LOGIN
25],
26[environ],
27[command],
28[0],
29[{
30    "environ":[[
31        "HOME=$TESTDIR",
32        "USER=$MY_USER"
33    ]]
34}
35],
36[])
37
38AT_RUSH_TEST([
39rush 2.0
40rule
41    unsetenv LOGIN=$MY_USER
42],
43[environ],
44[command],
45[0],
46[{
47    "environ":[[
48        "HOME=$TESTDIR",
49        "USER=$MY_USER"
50    ]]
51}
52],
53[])
54m4_popdef([RUSH_ENVIRON])
55
56m4_pushdef([RUSH_ENVIRON],[-i HOME=$PWD USER=$MY_USER LOGIN=NO_$MY_USER])
57AT_RUSH_TEST([
58rush 2.0
59rule
60    unsetenv LOGIN=$MY_USER
61],
62[environ],
63[command],
64[0],
65[{
66    "environ":[[
67        "HOME=$TESTDIR",
68        "LOGIN=NO_$MY_USER",
69        "USER=$MY_USER"
70    ]]
71}
72],
73[])
74m4_popdef([RUSH_ENVIRON])
75
76m4_pushdef([RUSH_ENVIRON],[-i HOME=$PWD USER=$MY_USER TEST_FOO=foo TEST_BAR=bar])
77AT_RUSH_TEST([
78rush 2.0
79rule
80    unsetenv "TEST_*"
81],
82[environ],
83[command],
84[0],
85[{
86    "environ":[[
87        "HOME=$TESTDIR",
88        "USER=$MY_USER"
89    ]]
90}
91],
92[])
93m4_popdef([RUSH_ENVIRON])
94
95AT_CLEANUP
96