Debian Codegraph @

tests/pcre-utf8-w

raw
1 #!/bin/sh
2 # Ensure non-ASCII UTF-8 characters are correctly identified as
3 # word-constituents
4 #
5 # Copyright (C) 2023-2025 Free Software Foundation, Inc.
6 #
7 # Copying and distribution of this file, with or without modification,
8 # are permitted in any medium without royalty provided the copyright
9 # notice and this notice are preserved.
10
11 . "${srcdir=.}/init.sh"; path_prepend_ ../src
12 require_en_utf8_locale_
13 LC_ALL=en_US.UTF-8
14 export LC_ALL
15 require_pcre_
16
17 echo . | grep -qP '(*UTF).' 2>/dev/null \
18 || skip_ 'PCRE unicode support is compiled out'
19 echo 0 | grep -qP '(?aD)\d' \
20 || skip_ 'PCRE 10.42 and older lack PCRE2_EXTRA_ASCII_BSD'
21
22 fail=0
23
24 echo 'Perú' > in || framework_failure_
25
26 echo 'ú' > exp || framework_failure_
27 grep -Po '.\b' in > out || fail=1
28 compare exp out || fail=1
29
30 echo 'rú' > exp || framework_failure_
31 grep -Po 'r\w' in > out || fail=1
32 compare exp out || fail=1
33
34 Exit $fail