summaryrefslogtreecommitdiff
path: root/testsuite/mb-match-slash.sh
blob: 787b5d6167aab9ed4acb21f138e0401269159361 (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
#!/bin/sh
# Test slash following an incomplete multibyte character

# Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed
print_ver_ sed

require_en_utf8_locale_

fail=0

# before sed-4.3, a slash following an incomplete multibyte character
# would be ignored during program compilation, leading to an error.


# Test 1: match_slash in 's' command.
# Before sed-4.3, this would fail with "unterminated `s' command".
printf 's/\316/X/' > p1 || framework_failure_
LC_ALL=en_US.UTF-8 sed -f p1 </dev/null >out1 || fail=1
compare_ /dev/null out1 || fail=1

# Test 2: match_slash in address regex.
# Before sed-4.3, this would fail with "unterminated address regex".
printf '/\316/p' >p2 || framework_failure_
LC_ALL=en_US.UTF-8 sed -f p2 </dev/null >out2 || fail=1
compare_ /dev/null out2 || fail=1

# Test 3: match_slash in 'y' command..
# Before sed-4.3, this would fail with "unterminated `y' command".
printf 'y/\316/X/' >p3 || framework_failure_
LC_ALL=en_US.UTF-8 sed -f p3 </dev/null >out3 || fail=1
compare_ /dev/null out3 || fail=1


Exit $fail