| Line | |
|---|
| 1 | #!/bin/sh
|
|---|
| 2 | # Test that backrefs are local to regex.
|
|---|
| 3 | #
|
|---|
| 4 | #
|
|---|
| 5 |
|
|---|
| 6 | : ${srcdir=.}
|
|---|
| 7 |
|
|---|
| 8 | failures=0
|
|---|
| 9 |
|
|---|
| 10 | # checking for a palindrome
|
|---|
| 11 | echo "radar" | ${GREP} -e '\(.\)\(.\).\2\1' > /dev/null 2>&1
|
|---|
| 12 | if test $? -ne 0 ; then
|
|---|
| 13 | echo "backref: palindrome, test \#1 failed"
|
|---|
| 14 | failures=1
|
|---|
| 15 | fi
|
|---|
| 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
|
|---|
| 19 | echo "civic" | ${GREP} -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\9\8\7\6\5\4\3\2\1$' > /dev/null 2>&1
|
|---|
| 20 | if test $? -ne 0 ; then
|
|---|
| 21 | echo "Options: Bond, test \#2 failed"
|
|---|
| 22 | failures=1
|
|---|
| 23 | fi
|
|---|
| 24 |
|
|---|
| 25 | # backref are local should be error
|
|---|
| 26 | echo "123" | ${GREP} -e 'a\(.\)' -e 'b\1' > /dev/null 2>&1
|
|---|
| 27 | if test $? -ne 2 ; then
|
|---|
| 28 | echo "Options: Backref not local, test \#3 failed"
|
|---|
| 29 | failures=1
|
|---|
| 30 | fi
|
|---|
| 31 |
|
|---|
| 32 | # Pattern should faile
|
|---|
| 33 | echo "123" | ${GREP} -e '[' -e ']' > /dev/null 2>&1
|
|---|
| 34 | if test $? -ne 2 ; then
|
|---|
| 35 | echo "Options: Compiled not local, test \#3 failed"
|
|---|
| 36 | failures=1
|
|---|
| 37 | fi
|
|---|
| 38 |
|
|---|
| 39 | exit $failures
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.