summaryrefslogtreecommitdiff
path: root/testsuite/missing-filename.sh
blob: e9cc090c868af7677a157fee6a9959c4a71ab873 (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
#!/bin/sh
# Test r/R/w/W commands without a file name.

# Copyright (C) 2018-2023 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

# Same error message, different character position in the sed program.
for i in 1 7 ; do
  err="sed: -e expression #1, char $i: missing filename in r/R/w/W commands"
  echo "$err" > exp-err$i || framework_failure_
done

# r/R/w/W commands
for cmd in r R w W ; do
  returns_ 1 sed $cmd </dev/null >/dev/null 2>err1 || fail=1
  compare exp-err1 err1 || fail=1
done

returns_ 1 sed 's/1/2/w' </dev/null >/dev/null 2>err7 || fail=1
compare exp-err7 err7 || fail=1

Exit $fail