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([EOF corner cases])
18AT_CHECK([echo '$' | tr -d '\n' | xenv], [0], [$])
19AT_CHECK([echo '$$' | tr -d '\n' | xenv], [0], [$$])
20AT_CHECK([echo '$$a' | tr -d '\n' | xenv], [0], [$$a],
21[<stdin>:1: unrecognized double-sigil statement ($$a)
22])
23
24AT_CHECK([
25AT_DATA([input],
26[Duis aute irure
27dolor in ${* reprehenderit in voluptate velit esse
28])
29xenv input
30],
31[0],
32[Duis aute irure
33dolor in ],
34[input:2: end of file in comment
35])
36
37AT_CHECK([
38AT_DATA([input],
39[Duis aute irure
40dolor in $[(]reprehenderit in voluptate velit esse
41])
42xenv input
43],
44[0],
45[Duis aute irure
46dolor in reprehenderit in voluptate velit esse
47],
48[input:2: end of file in inline verbatim text
49])
50
51AT_CHECK([
52AT_DATA([input],
53[Duis aute irure
54$$ifset X
55dolor in reprehenderit in voluptate velit esse
56])
57unset X
58xenv input
59],
60[0],
61[Duis aute irure
62],
63[input:2: end of file in conditional
64])
65
66AT_CHECK([
67AT_DATA([input],
68[Duis aute irure
69$$ifset X
70dolor in reprehenderit in voluptate velit esse
71$$else
72cupidatat non proident, sunt in culpa qui officia deserunt mollit
73])
74unset X
75xenv input
76],
77[0],
78[Duis aute irure
79cupidatat non proident, sunt in culpa qui officia deserunt mollit
80],
81[input:4: end of file in conditional
82])
83
84AT_CHECK([
85AT_DATA([input],
86[Duis aute irure
87dolor in reprehenderit in voluptate velit esse
88$$verbatim
89cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
90cupidatat non proident, sunt in culpa qui officia deserunt mollit
91])
92xenv input
93],
94[0],
95[Duis aute irure
96dolor in reprehenderit in voluptate velit esse
97cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
98cupidatat non proident, sunt in culpa qui officia deserunt mollit
99],
100[input:3: end of file in verbatim block
101])
102AT_CLEANUP
103
104