2 # Copyright (C) 2021-2024 Free Software Foundation, Inc.
4 # This program 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 of the License, or
7 # (at your option) any later version.
9 # This program 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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
20 # \r followed by \n is displayed as ^M$
21 # Up to and including 8.32 the $ would have displayed at the start of the line
22 # overwriting the first character
23 printf 'a\rb\r\nc\n\r\nd\r' > 'in' || framework_failure_
24 printf 'a\rb^M$\nc$\n^M$\nd\r' > 'exp' || framework_failure_
25 cat -E 'in' > out || fail
=1
26 compare exp out || fail
=1
28 # Ensure \r\n spanning files (or buffers) is handled
29 printf '1\r' > in2 || framework_failure_
30 printf '\n2\r\n' > in2b || framework_failure_
31 printf '1^M$\n2^M$\n' > 'exp' || framework_failure_
32 cat -E 'in2' 'in2b' > out || fail
=1
33 compare exp out || fail
=1
35 # Ensure \r at end of buffer is handled
36 printf '1\r' > in2 || framework_failure_
37 printf '2\r\n' > in2b || framework_failure_
38 printf '1\r2^M$\n' > 'exp' || framework_failure_
39 cat -E 'in2' 'in2b' > out || fail
=1
40 compare exp out || fail
=1