VirtualBox

source: kBuild/trunk/src/sed/testsuite/cmd-l.sh@ 3613

Last change on this file since 3613 was 3613, checked in by bird, 7 months ago

src/sed: Merged in changes between 4.1.5 and 4.9 from the vendor branch. (svn merge /vendor/sed/4.1.5 /vendor/sed/current .)

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/sh
2# Test 'l' command with different widths
3
4# Copyright (C) 2016-2022 Free Software Foundation, Inc.
5
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <https://www.gnu.org/licenses/>.
18. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed
19print_ver_ sed
20
21# 10 20 30 40 50 60 70 75
22cat <<\EOF >in1 || framework_failure_
230123456789012345678901234567890123456789012345678901234567890123456789012345
24EOF
25
26# default: 70 characters (including the \n)
27cat <<\EOF >exp-def || framework_failure_
28012345678901234567890123456789012345678901234567890123456789012345678\
299012345$
30EOF
31
32# 11 characters
33cat <<\EOF >exp-11 || framework_failure_
340123456789\
350123456789\
360123456789\
370123456789\
380123456789\
390123456789\
400123456789\
41012345$
42EOF
43
44# command 'l n' is a gnu extension, rejected in posix mode
45cat <<\EOF >exp-err-posix-ln || framework_failure_
46sed: -e expression #1, char 2: extra characters after command
47EOF
48
49# sed's default: 70 characters
50sed -n l in1 >out-def || fail=1
51compare_ exp-def out-def || fail=1
52
53# limit with COLS envvar, sed subtracts one to avoid ttys linewraps
54COLS=12 sed -n l in1 >out-cols12 || fail=1
55compare_ exp-11 out-cols12 || fail=1
56
57# invalid COLS envvar should be ignored (wrap at default=70)
58COLS=0 sed -n l in1 >out-cols0 || fail=1
59compare_ exp-def out-cols0 || fail=1
60COLS=foo sed -n l in1 >out-cols-foo || fail=1
61compare_ exp-def out-cols-foo || fail=1
62
63# limit with -l parameter
64sed -l 11 -n l in1 >out-l11 || fail=1
65compare_ exp-11 out-l11 || fail=1
66
67# limit with 'ln' command (gnu extension)
68sed -n l11 in1 >out-ln-11 || fail=1
69compare_ exp-11 out-ln-11 || fail=1
70
71# limit with 'ln' command (gnu extension)
72returns_ 1 sed --posix -n l11 in1 2>err-posix-ln || fail=1
73compare_ exp-err-posix-ln err-posix-ln || fail=1
74
75Exit $fail
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette