1131554Stjr#!/bin/sh 2131554Stjr# Test that backrefs are local to regex. 3131554Stjr# 4131554Stjr# 5131554Stjr 6131554Stjr: ${srcdir=.} 7131554Stjr 8131554Stjrfailures=0 9131554Stjr 10131554Stjr# checking for a palindrome 11131554Stjrecho "radar" | ${GREP} -e '\(.\)\(.\).\2\1' > /dev/null 2>&1 12131554Stjrif test $? -ne 0 ; then 13131554Stjr echo "backref: palindrome, test \#1 failed" 14131554Stjr failures=1 15131554Stjrfi 16131554Stjr 17131554Stjr# hit hard with the `Bond' tests 18131554Stjrecho "civic" | ${GREP} -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$' > /dev/null 2>&1 19131554Stjrif test $? -ne 0 ; then 20131554Stjr echo "Options: Bond, test \#2 failed" 21131554Stjr failures=1 22131554Stjrfi 23131554Stjr 24131554Stjr# backref are local should be error 25131554Stjrecho "123" | ${GREP} -e 'a\(.\)' -e 'b\1' > /dev/null 2>&1 26131554Stjrif test $? -ne 2 ; then 27131554Stjr echo "Options: Backref not local, test \#3 failed" 28131554Stjr failures=1 29131554Stjrfi 30131554Stjr 31131554Stjr# Pattern should faile 32131554Stjrecho "123" | ${GREP} -e '[' -e ']' > /dev/null 2>&1 33131554Stjrif test $? -ne 2 ; then 34131554Stjr echo "Options: Compiled not local, test \#3 failed" 35131554Stjr failures=1 36131554Stjrfi 37131554Stjr 38131554Stjrexit $failures 39