/[grep]/grep/tests/foad1.sh
ViewVC logotype

Diff of /grep/tests/foad1.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by julianfoad, Thu Apr 28 20:27:11 2005 UTC revision 1.7 by charles_levert, Fri Apr 29 11:30:09 2005 UTC
# Line 19  grep_test () Line 19  grep_test ()
19    OUTPUT=`echo -n "$INPUT" | tr "/" "\n" | "$GREP" "$@" | tr "\n" "/"`    OUTPUT=`echo -n "$INPUT" | tr "/" "\n" | "$GREP" "$@" | tr "\n" "/"`
20    if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "1"; then    if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "1"; then
21      echo "Testing:  $GREP $@"      echo "Testing:  $GREP $@"
22        test "$LC_ALL" != C && test "$LC_ALL" != "" && echo "  LC_ALL: \"$LC_ALL\""
23      echo "  input:  \"$INPUT\""      echo "  input:  \"$INPUT\""
24      echo "  output: \"$OUTPUT\""      echo "  output: \"$OUTPUT\""
25    fi    fi
# Line 37  grep_test "WordA/wordB/WORDC/" "Word/wor Line 38  grep_test "WordA/wordB/WORDC/" "Word/wor
38  grep_test "WordA/wordB/WORDC/" "Word/word/WORD/" "word" -o -i  grep_test "WordA/wordB/WORDC/" "Word/word/WORD/" "word" -o -i
39  grep_test "WordA/wordB/WORDC/" "Word/word/WORD/" "WORD" -o -i  grep_test "WordA/wordB/WORDC/" "Word/word/WORD/" "WORD" -o -i
40    
41  # Should display the line number (-n) or file name (-H) of every match,  # Should display the line number (-n), octet offset (-b), or file name
42  # not just of the first match on each input line.  # (-H) of every match, not just of the first match on each input line.
43  grep_test "wA wB/wC/" "1:wA/1:wB/2:wC/" "w." -o -n  grep_test "wA wB/wC/" "1:wA/1:wB/2:wC/" "w." -o -n
44    grep_test "XwA YwB/ZwC/" "1:wA/5:wB/9:wC/" "w." -o -b
45  grep_test "wA wB/" "(standard input):wA/(standard input):wB/" "w." -o -H  grep_test "wA wB/" "(standard input):wA/(standard input):wB/" "w." -o -H
46    
47  # End of a previous match should not match a "start of ..." expression.  # End of a previous match should not match a "start of ..." expression.
# Line 80  grep_test "A/CX/B/C/" "A/B/C/" -wF -e A Line 82  grep_test "A/CX/B/C/" "A/B/C/" -wF -e A
82  grep_test "LIN7C 55327/" "" -wF -e 5327 -e 5532  grep_test "LIN7C 55327/" "" -wF -e 5327 -e 5532
83    
84    
85  # Test character class erroneously matching a '[' character.  u=cs_CZ.UTF-8
86  # If the UTF-8 locale doesn't work, skip this test silently.  # If the UTF-8 locale doesn't work, skip these tests silently.
87  if LC_ALL=cs_CZ.UTF-8 locale -k LC_CTYPE 2>/dev/null |  if LC_ALL="$u" locale -k LC_CTYPE 2>/dev/null |
88    "${GREP}" -q "charmap.*UTF-8"    "${GREP}" -q "charmap.*UTF-8"
89  then  then
90    LC_ALL=cs_CZ.UTF-8 grep_test "[/" "" "[[:alpha:]]" -E    # Test character class erroneously matching a '[' character.
91      LC_ALL="$u" grep_test "[/" "" "[[:alpha:]]" -E
92    
93      for mode in F G E; do
94        # Hint:  pipe the output of these tests in
95        #        "| LESS= LESSCHARSET=ascii less".
96        # LETTER N WITH TILDE is U+00F1 and U+00D1.
97        # LETTER Y WITH DIAERESIS is U+00FF and U+0178.
98        LC_ALL="$u" grep_test 'añÿb/AÑŸB/' 'ñÿ/ÑŸ/' 'ñÿ' -o -i -$mode
99        LC_ALL="$u" grep_test 'añÿb/AÑŸB/' 'ñÿ/ÑŸ/' 'ÑŸ' -o -i -$mode
100        LC_ALL="$u" grep_test 'añÿb/AÑŸB/' "a${CB}ñÿ${CE}b/A${CB}ÑŸ${CE}B/" 'ñÿ' --color=always -i -$mode
101        LC_ALL="$u" grep_test 'añÿb/AÑŸB/' "a${CB}ñÿ${CE}b/A${CB}ÑŸ${CE}B/" 'ÑŸ' --color=always -i -$mode
102    
103        # POSIX (about -i):  ... each character in the string is matched
104        # against the pattern, not only the character, but also its case
105        # counterpart (if any), shall be matched.
106        # The following were chosen because of their trickiness due to the
107        # differing UTF-8 octet length of their counterpart and to the
108        # non-reflexivity of their mapping.
109        # Beware of homographs!  Look carefully at the actual octets.
110    
111        # lc(U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE) = U+0069 LATIN SMALL LETTER I
112        LC_ALL="$u" grep_test 'aİb/' "a${CB}İ${CE}b/" 'i' --color=always -i -$mode
113        LC_ALL="$u" grep_test 'aib/' ''               'İ' --color=always -i -$mode
114        LC_ALL="$u" grep_test 'aİb/' ''               'I' --color=always -i -$mode
115        # uc(U+0131 LATIN SMALL LETTER DOTLESS I)          = U+0049 LATIN CAPITAL LETTER I
116        LC_ALL="$u" grep_test 'aıb/' "a${CB}ı${CE}b/" 'I' --color=always -i -$mode
117        LC_ALL="$u" grep_test 'aIb/' ''               'ı' --color=always -i -$mode
118        LC_ALL="$u" grep_test 'aıb/' ''               'i' --color=always -i -$mode
119        # uc(U+017F LATIN SMALL LETTER LONG S)             = U+0053 LATIN CAPITAL LETTER S
120        LC_ALL="$u" grep_test 'aſb/' "a${CB}ſ${CE}b/" 'S' --color=always -i -$mode
121        LC_ALL="$u" grep_test 'aSb/' ''               'ſ' --color=always -i -$mode
122        LC_ALL="$u" grep_test 'aſb/' ''               's' --color=always -i -$mode
123        # uc(U+1FBE GREEK PROSGEGRAMMENI)                  = U+0399 GREEK CAPITAL LETTER IOTA
124        LC_ALL="$u" grep_test 'aιb/' "a${CB}ι${CE}b/" 'Ι' --color=always -i -$mode
125        LC_ALL="$u" grep_test 'aΙb/' ''               'ι' --color=always -i -$mode
126        LC_ALL="$u" grep_test 'aιb/' ''               'ι' --color=always -i -$mode
127        # lc(U+2126 OHM SIGN)                              = U+03C9 GREEK SMALL LETTER OMEGA
128        LC_ALL="$u" grep_test 'aΩb/' "a${CB}Ω${CE}b/" 'ω' --color=always -i -$mode
129        LC_ALL="$u" grep_test 'aωb/' ''               'Ω' --color=always -i -$mode
130        LC_ALL="$u" grep_test 'aΩb/' ''               'Ω' --color=always -i -$mode
131        # lc(U+212A KELVIN SIGN)                           = U+006B LATIN SMALL LETTER K
132        LC_ALL="$u" grep_test 'aKb/' "a${CB}K${CE}b/" 'k' --color=always -i -$mode
133        LC_ALL="$u" grep_test 'akb/' ''               'K' --color=always -i -$mode
134        LC_ALL="$u" grep_test 'aKb/' ''               'K' --color=always -i -$mode
135        # lc(U+212B ANGSTROM SIGN)                         = U+00E5 LATIN SMALL LETTER A WITH RING ABOVE
136        LC_ALL="$u" grep_test 'aÅb/' "a${CB}Å${CE}b/" 'å' --color=always -i -$mode
137        LC_ALL="$u" grep_test 'aåb/' ''               'Å' --color=always -i -$mode
138        LC_ALL="$u" grep_test 'aÅb/' ''               'Å' --color=always -i -$mode
139      done
140  fi  fi
141    
142    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26