summaryrefslogtreecommitdiff
path: root/testsuite/8to7.sh
blob: be1d4637bcb4c52ee71fc323c0703fa66ba58fff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh

# Runner for old '8to7' test

# Copyright (C) 2017-2020 Free Software Foundation, Inc.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed
print_ver_ sed

# Generate the input file, containing non-ascii 8-bit octets.
# printf with octal escape sequences is the most portable way
# to produce these.
{
  printf '\344\306\244\342\244\350 \244\337\344\306\273\375\244\301\n' ;
  printf '\267\241\266\372\244\342\244\350 ' ;
  printf '\244\337\267\241\266\372\273\375\244\301\n' ;
  printf '\244\263\244\316\265\326\244\313 ' ;
  printf '\272\332\305\246\244\336\244\271\273\371\n' ;
  printf '\262\310\264\326\244\253\244\312 \271\360\244\351\244\265\244\315\n' ;
  printf '\244\275\244\351\244\337\244\304 ';
  printf '\302\347\317\302\244\316\271\361\244\317\n' ;
  printf '\244\252\244\267\244\343\244\312\244\331\244\306 ' ;
  printf '\244\357\244\354\244\263\244\275\265\357\244\354\n' ;
  printf '\244\267\244\255\244\312\244\331\244\306 ' ;
  printf '\244\357\244\354\244\263\244\275 ' ;
  printf '\272\302\244\273\n';
  printf '\244\357\244\313\244\263\244\275\244\317 ' ;
  printf '\271\360\244\351\244\341\n' ;
  printf '\262\310\244\362\244\342\314\276\244\362\244\342\n';
} > 8to7-inp || framework_failure_


# The expected output.
# NOTE:
# shell-escaping is OFF with here-doc preceded by a backslash
# i.e. the first 4 octets in the output will be the characters
# '\', '3', '4', '4'.
cat <<\EOF > 8to7-exp || framework_failure_
\344\306\244\342\244\350 \244\337\344\306\273\375\244\301$
\267\241\266\372\244\342\244\350 \244\337\267\241\266\372\273\375\244\
\301$
\244\263\244\316\265\326\244\313 \272\332\305\246\244\336\244\271\273\
\371$
\262\310\264\326\244\253\244\312 \271\360\244\351\244\265\244\315$
\244\275\244\351\244\337\244\304 \302\347\317\302\244\316\271\361\244\
\317$
\244\252\244\267\244\343\244\312\244\331\244\306 \244\357\244\354\244\
\263\244\275\265\357\244\354$
\244\267\244\255\244\312\244\331\244\306 \244\357\244\354\244\263\244\
\275 \272\302\244\273$
\244\357\244\313\244\263\244\275\244\317 \271\360\244\351\244\341$
\262\310\244\362\244\342\314\276\244\362\244\342$
EOF

sed -e 'l;d' 8to7-inp > 8to7-out || fail=1
remove_cr_inplace 8to7-out
compare 8to7-exp 8to7-out || fail=1


Exit $fail