VirtualBox

source: kBuild/trunk/src/grep/tests/backref

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# Test for back-references and other things.
3#
4# Copyright (C) 2001, 2006, 2009-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
11
12failures=0
13
14# checking for a palindrome
15echo "radar" | grep -e '\(.\)\(.\).\2\1' > /dev/null 2>&1
16if test $? -ne 0 ; then
17 echo "Backref: palindrome, test #1 failed"
18 failures=1
19fi
20
21# hit hard with the 'Bond' tests
22# For now, remove the '?' in the last parentheses, so that new glibc can do it.
23# --Stepan
24echo "civic" \
25 | grep -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\9\8\7\6\5\4\3\2\1$' \
26 > /dev/null 2>&1
27if test $? -ne 0 ; then
28 echo "Options: Bond, test #2 failed"
29 failures=1
30fi
31
32# backref are local should be error
33echo "123" | grep -e 'a\(.\)' -e 'b\1' > /dev/null 2>&1
34if test $? -ne 2 ; then
35 echo "Backref: Backref not local, test #3 failed"
36 failures=1
37fi
38
39# Pattern should fail
40echo "123" | grep -e '[' -e ']' > /dev/null 2>&1
41if test $? -ne 2 ; then
42 echo "Backref: Compiled not local, test #4 failed"
43 failures=1
44fi
45
46Exit $failures
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