| 1 | #!/bin/sh
|
|---|
| 2 | # Test slash following an incomplete multibyte character
|
|---|
| 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
|
|---|
| 19 | print_ver_ sed
|
|---|
| 20 |
|
|---|
| 21 | require_en_utf8_locale_
|
|---|
| 22 |
|
|---|
| 23 | # before sed-4.3, a slash following an incomplete multibyte character
|
|---|
| 24 | # would be ignored during program compilation, leading to an error.
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | # Test 1: match_slash in 's' command.
|
|---|
| 28 | # Before sed-4.3, this would fail with "unterminated `s' command".
|
|---|
| 29 | printf 's/\316/X/' > p1 || framework_failure_
|
|---|
| 30 | LC_ALL=en_US.UTF-8 sed -f p1 </dev/null >out1 || fail=1
|
|---|
| 31 | compare_ /dev/null out1 || fail=1
|
|---|
| 32 |
|
|---|
| 33 | # Test 2: match_slash in address regex.
|
|---|
| 34 | # Before sed-4.3, this would fail with "unterminated address regex".
|
|---|
| 35 | printf '/\316/p' >p2 || framework_failure_
|
|---|
| 36 | LC_ALL=en_US.UTF-8 sed -f p2 </dev/null >out2 || fail=1
|
|---|
| 37 | compare_ /dev/null out2 || fail=1
|
|---|
| 38 |
|
|---|
| 39 | # Test 3: match_slash in 'y' command..
|
|---|
| 40 | # Before sed-4.3, this would fail with "unterminated `y' command".
|
|---|
| 41 | printf 'y/\316/X/' >p3 || framework_failure_
|
|---|
| 42 | LC_ALL=en_US.UTF-8 sed -f p3 </dev/null >out3 || fail=1
|
|---|
| 43 | compare_ /dev/null out3 || fail=1
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | Exit $fail
|
|---|