summaryrefslogtreecommitdiff
path: root/tests/warn-char-classes
Commit message (Collapse)AuthorAgeFilesLines
* tests: use "returns_ N env VAR=val ..."Jim Meyering2016-11-281-1/+1
| | | | | | | | | | | | | | | | rather than "VAR=val returns_ N ..." Some shells do not propagate envvar settings through our use of the "returns_" function, so set any envvar via use of "env". This was an issue at least on Ubuntu and Debian-based systems, presumably due to their common use of "dash" as /bin/sh. Reported by Assaf Gordon. * tests/char-class-multibyte: As above. * tests/euc-mb: Likewise. * tests/false-match-mb-non-utf8: Likewise. * tests/pcre-infloop: Likewise. * tests/pcre-jitstack: Likewise. * tests/sjis-mb: Likewise. * tests/warn-char-classes: Likewise.
* tests: use "returns_" rather than explicit comparison with "$?"Jim Meyering2016-11-141-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/sjis-mb (encode): Rearrange to emit desired input into a file, rather than piping directly into grep. That permits the use of returns_ 1 to verify timeout's exit status. * tests/euc-mb: Use "returns_ 1" rather than testing $? = 1 * tests/char-class-multibyte: Likewise. * tests/dfa-heap-overrun: Likewise. * tests/encoding-error: Likewise. * tests/fedora: Likewise. * tests/grep-dev-null: Likewise. * tests/init.cfg (envvar_check_fail): Likewise. * tests/kwset-abuse: Likewise. * tests/mb-non-UTF8-overrun: Likewise. * tests/multibyte-white-space: Likewise. * tests/pcre-infloop: Likewise. * tests/surrogate-pair: Likewise. * tests/warn-char-classes: Likewise. Do the same for other values: * tests/backref-multibyte-slow: Likewise. * tests/euc-mb: Likewise. * tests/pcre-abort: Likewise. * tests/pcre-jitstack: Likewise. * tests/repetition-overflow: Likewise. * tests/reversed-range-endpoints: Likewise. * tests/warn-char-classes: Likewise.
* Fix the test suite for MS-Windows.Eli Zaretskii2011-12-281-0/+1
| | | | | | | | * tests/include-exclude: Use --directories=skip, to avoid gratuitous failures on systems that cannot grep directories. * tests/reversed-range-endpoints: Don't reject program names with leading directories and drive letters. * tests/warn-char-classes: Likewise.
* tests: use "compare exp out", not "compare out exp"Jim Meyering2011-11-291-1/+1
| | | | | | | | | | | | | | Likewise, when an empty file is expected, use "compare /dev/null out", not "compare out /dev/null". I.e., specify the expected/desired contents via the first file name. Prompted by a suggestion from Bruno Haible in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154 Run these commands: git grep -l -E 'compare [^ ]+ exp' \ |xargs perl -pi -e 's/(compare) (\S+) (exp\S*)/$1 $3 $2/' git grep -l -E 'compare [^ ]+ /dev/null' \ |xargs perl -pi -e 's/(compare) (\S+) (\/dev\/null)/$1 $3 $2/'
* tests: ensure that each test script is executableJim Meyering2011-06-211-0/+0
| | | | | | | | | | | | | | This adds a rule run at "make check" time to ensure that test scripts are consistently executable. This change is not required for "make check", but makes it easier for people to run scripts manually, but that is discouraged because doing so makes it easy to omit important variable settings that are normally provided via TESTS_ENVIRONMENT. This change also makes each of the existing TESTS executable. * tests/Makefile.am (check_executable_TESTS): New rule. (check): Depend on it. * tests/{all_scripts}: chmod 755. Prompted by a report from Eric Blake.
* tests/portability: avoid spurious failure with OpenBSD's /bin/shJim Meyering2010-09-081-2/+0
| | | | | | | | * tests/warn-char-classes: Don't use "set -x" here. It causes a spurious test failure on openbsd 4.7 when using its /bin/sh, since the command, /bin/sh -xc 'P=1 : 2> err' emits "P=1" into err. To enable set -x, run the test with "VERBOSE=yes", e.g., make check -C tests TESTS=warn-char-classes VERBOSE=yes
* grep: diagnose and exit-2 for bogus REs like [:space:], [:digit:], etc.Jim Meyering2010-09-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When I make a mistake like this: grep '[:lower:]' ... be it in a script or on the command line, I want to know about it as soon as possible. I don't want grep to print a mere warning that it is interpreting this suspicious and almost guaranteed-wrong regular expression as a set of just 6 bytes. And I certainly don't want grep to silently do the wrong thing, even if that would be officially standards-conforming. It's obvious that I intended [[:lower:]], and I want my error to be diagnosed in a way that is most likely to get my attention. Thus, with this change, grep now prints a diagnostic and exits with status 2 the moment it encounters an offending [:char_class:] construct. This changes the way grep works by default, rather than putting this new behavior on an option. A new option would seldom be used in scripts (not portable), and would probably be used only rarely by those who need it the most. This new functionality provides a valuable safety measure and incurs truly negligible risk. For strict POSIX compliance, set POSIXLY_CORRECT in your environment. That disables this new feature. Revert the changes from commit 2cd3bcea, "grep: add --warnings={always,never,auto}.", and then do the following: * src/dfasearch.c (dfawarn): Call getenv("POSIXLY_CORRECT") here; Remove "warning: " from the diagnostic, now that it's more than a warning, and exit with status 2. * NEWS (New features): Describe the new semantics. * tests/warn-char-classes: Adjust one test to accommodate this change. * doc/grep.texi (Character Classes and Bracket Expressions): Document. (Environment Variables): Cross-reference it. Remove reference to obsolete getopt illegal vs. invalid difference. Thanks to Paul Eggert for suggestions and an initial prod.
* tests: add test for warningsPaolo Bonzini2010-08-271-0/+46
* tests/Makefile.am (TESTS): Add warn-char-class. * tests/warn-char-class: New.