1# This file is part of xenv                         -*- autotest -*-
2# Copyright (C) 2021 Sergey Poznyakoff
3#
4# Xenv is free software; you can redistribute it and/or modify it
5# under the terms of the GNU General Public License as published by the
6# Free Software Foundation; either version 3 of the License, or (at your
7# option) any later version.
8#
9# Xenv 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 along
15# with xenv. If not, see <http://www.gnu.org/licenses/>. */
16
17AT_SETUP([Display Error if Null or Unset])
18
19AT_DATA([input],
20[Ut enim ad minim ${V1?}, quis nostrud exercitation ullamco
21${V2:?} nisi ut aliquip ex ea commodo consequat.
22])
23
24AT_CHECK([
25V1=veniam
26V2=laboris
27export V1 V2
28xenv input
29],
30[0],
31[Ut enim ad minim veniam, quis nostrud exercitation ullamco
32laboris nisi ut aliquip ex ea commodo consequat.
33])
34
35AT_CHECK([
36V1=
37V2=laboris
38export V1 V2
39xenv input
40],
41[0],
42[Ut enim ad minim , quis nostrud exercitation ullamco
43laboris nisi ut aliquip ex ea commodo consequat.
44])
45
46AT_CHECK([
47unset V1
48V2=laboris
49export V2
50xenv input
51],
52[0],
53[Ut enim ad minim , quis nostrud exercitation ullamco
54laboris nisi ut aliquip ex ea commodo consequat.
55],
56[input:1: variable V1 not set
57])
58
59AT_CHECK([
60unset V1 V2
61xenv input
62],
63[0],
64[Ut enim ad minim , quis nostrud exercitation ullamco
65 nisi ut aliquip ex ea commodo consequat.
66],
67[input:1: variable V1 not set
68input:2: variable V2 null or not set
69])
70
71AT_CHECK([
72unset V1
73V2=
74export V2
75xenv input
76],
77[0],
78[Ut enim ad minim , quis nostrud exercitation ullamco
79 nisi ut aliquip ex ea commodo consequat.
80],
81[input:1: variable V1 not set
82input:2: variable V2 null or not set
83])
84
85AT_CLEANUP
86
87