source: trunk/grep/tests/backref.sh@ 2787

Last change on this file since 2787 was 2557, checked in by bird, 19 years ago

grep 2.5.1a

File size: 965 bytes
Line 
1#!/bin/sh
2# Test that backrefs are local to regex.
3#
4#
5
6: ${srcdir=.}
7
8failures=0
9
10# checking for a palindrome
11echo "radar" | ${GREP} -e '\(.\)\(.\).\2\1' > /dev/null 2>&1
12if test $? -ne 0 ; then
13 echo "backref: palindrome, test \#1 failed"
14 failures=1
15fi
16
17# hit hard with the `Bond' tests
18# For now, remove the ``?'' in the last parentheses, so that new glibc can do it. --Stepan
19echo "civic" | ${GREP} -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\9\8\7\6\5\4\3\2\1$' > /dev/null 2>&1
20if test $? -ne 0 ; then
21 echo "Options: Bond, test \#2 failed"
22 failures=1
23fi
24
25# backref are local should be error
26echo "123" | ${GREP} -e 'a\(.\)' -e 'b\1' > /dev/null 2>&1
27if test $? -ne 2 ; then
28 echo "Options: Backref not local, test \#3 failed"
29 failures=1
30fi
31
32# Pattern should faile
33echo "123" | ${GREP} -e '[' -e ']' > /dev/null 2>&1
34if test $? -ne 2 ; then
35 echo "Options: Compiled not local, test \#3 failed"
36 failures=1
37fi
38
39exit $failures
Note: See TracBrowser for help on using the repository browser.