VirtualBox

source: kBuild/trunk/src/sed/testsuite/nulldata.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 -z/--null-data option
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# Two lines, differ based on the EOL character.
22printf "AB\000CD\nEF\n\000" > in1 || framework_failure_
23
24# 's/^./x/' cmd processed with EOF=\n
25printf "xB\000CD\nxF\nx" > exp-s-nl || framework_failure_
26# 's/^./x/' cmd processed with EOF=\0
27printf "xB\000xD\nEF\n\000" > exp-s-z || framework_failure_
28
29# '=' cmd processed with EOF=\n
30printf "1\nAB\000CD\n2\nEF\n3\n\000" > exp-=-nl || framework_failure_
31
32# '=' cmd processed with EOF=\0
33printf "1\000AB\0002\000CD\nEF\n\000" > exp-=-z || framework_failure_
34
35
36# 'l' cmd processed with EOF=\n
37cat <<\EOF >exp-l-nl || framework_failure_
38AB\000CD$
39EF$
40\000$
41EOF
42
43# 'l' cmd processed with EOF=\0
44printf 'AB$\000CD\\nEF\\n$\000' >exp-l-z || framework_failure_
45
46# 'F' cmd with EOL=\n
47printf "in1\n" > exp-F-nl || framework_failure_
48
49# 'F' cmd with EOL=\0
50printf "in1\000" > exp-F-z || framework_failure_
51
52
53# Test substitution
54sed 's/^./x/' in1 > out-s-nl || fail=1
55compare_ exp-s-nl out-s-nl || fail=1
56
57sed -z 's/^./x/' in1 > out-s-z || fail=1
58compare_ exp-s-z out-s-z || fail=1
59
60
61
62# Test '=' command
63sed = in1 > out-=-nl || fail=1
64compare_ exp-=-nl out-=-nl || fail=1
65
66sed -z = in1 > out-=-z || fail=1
67compare_ exp-=-z out-=-z || fail=1
68
69
70
71# Test 'l' command
72sed -n l in1 > out-l-nl || fail=1
73compare_ exp-l-nl out-l-nl || fail=1
74
75sed -zn l in1 > out-l-z || fail=1
76compare_ exp-l-z out-l-z || fail=1
77
78
79# Test 'F' command
80sed -n 1F in1 > out-F-nl || fail=1
81compare_ exp-F-nl out-F-nl || fail=1
82
83sed -zn 1F in1 > out-F-z || fail=1
84compare_ exp-F-z out-F-z || fail=1
85
86
87Exit $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