VirtualBox

source: kBuild/vendor/grep/3.7/tests/pcre-utf8

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#! /bin/sh
2# Ensure that, with -P, Unicode \p{} symbols are correctly matched.
3#
4# Copyright (C) 2012-2021 Free Software Foundation, Inc.
5#
6# Copying and distribution of this file, with or without modification,
7# are permitted in any medium without royalty provided the copyright
8# notice and this notice are preserved.
9
10. "${srcdir=.}/init.sh"; path_prepend_ ../src
11require_en_utf8_locale_
12LC_ALL=en_US.UTF-8 require_pcre_
13
14fail=0
15
16echo '$' | LC_ALL=en_US.UTF-8 grep -qP '\p{S}' \
17 || skip_ 'PCRE support is compiled out, or it does not support properties'
18
19euro='\342\202\254 euro'
20printf "$euro\\n" > in || framework_failure_
21
22# The euro sign has the unicode "Symbol" property, so this must match:
23LC_ALL=en_US.UTF-8 grep -P '^\p{S}' in > out || fail=1
24compare in out || fail=1
25
26# This RE must *not* match in the C locale, because the first
27# byte is not a "Symbol".
28LC_ALL=C grep -P '^\p{S}' in > out && fail=1
29compare /dev/null out || fail=1
30
31LC_ALL=en_US.UTF-8 grep -P '^. euro$' in > out2 || fail=1
32compare in out2 || fail=1
33
34LC_ALL=en_US.UTF-8 grep -oP '. euro' in > out3 || fail=1
35compare in out3 || fail=1
36
37LC_ALL=en_US.UTF-8 grep -P '^\P{S}' in > out4
38compare /dev/null out4 || fail=1
39
40Exit $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