summaryrefslogtreecommitdiff
path: root/tests/include-exclude
Commit message (Collapse)AuthorAgeFilesLines
* grep: --exclude matches trailing parts of argsPaul Eggert2015-12-281-1/+3
| | | | | | | | | | | | Problem reported by Vincent Lefevre in: http://bugs.gnu.org/22144 * NEWS: * doc/grep.texi (File and Directory Selection): Document this. * src/grep.c (excluded_patterns, excluded_directory_patterns): Now 2-element arrays, with one element for subfiles and another for command-line args. All uses changed. This implements the change. (exclude_options): New function. * tests/include-exclude: Test the change.
* tests: fix mis-applied patch.Jim Meyering2015-07-171-2/+2
| | | | | * tests/include-exclude: I applied "|sort" to the wrong creation of "out", and didn't push the same patch that I'd tested.
* tests: avoid FS-dependent false-positive failureJim Meyering2015-07-171-2/+2
| | | | | | | * tests/include-exclude: Sort file name list, so that this test is not sensitive to the order in which those names are returned via readdir. I noticed the failure on a Fedora 21 system using ext4. Also fix a typo: s/framework_failure+/framework_failure_/
* grep: fix bug with --exclude-dir and command linePaul Eggert2015-07-131-1/+11
| | | | | | | | | | Reported by Aron Griffis in: http://bugs.gnu.org/21027 * NEWS: Document this. * src/grep.c (grepdirent): Don't check whether the file is skipped when on the command line, as that's the caller's responsibility. (main): Anchor the exclude patterns. * tests/include-exclude: Adjust test case to match fixed behavior. Add some more test cases.
* maint: split long lines, and enforce the 80-column limitJim Meyering2014-06-271-1/+2
| | | | | | | | | | | | | | * cfg.mk (sc_long_lines): New rule, from coreutils; exempt tests/* * src/grep.c (usage): Tweak -F wording to shorten a line. Correct grammar in a comment. Split the --exclude-file=... description to fit within 80 columns. Use emit_bug_reporting_address, eliminating another long line. * src/dfa.c: Split long lines. No semantic change. * doc/grep.texi: Likewise. * tests/include-exclude: Split a long line. * tests/backref: Split long lines. * tests/empty: Likewise. * tests/fmbtest: Likewise.
* grep: --exclude-dir=FOO/ now ignores the trailing slashPaul Eggert2014-05-241-0/+4
| | | | | | | Problem reported by Khaled Ziyaeen; see: http://bugs.gnu.org/17481 * NEWS, doc/grep.texi (File and Directory Selection): Document this. * src/grep.c (main): Implement this. * tests/include-exclude: Test this.
* exclude: process exclude and include directives in orderPaul Eggert2012-05-061-0/+5
| | | | | | | | | | | | | | | | | | | Also, change exclude and include directives so that they apply to command-line arguments too. This restores the pre-2.6 behavior, and fixes a bug reported by Quentin Arce in <http://lists.gnu.org/archive/html/bug-grep/2012-04/msg00056.html>. * NEWS: Document this. * src/main.c (included_patterns): Remove. All uses removed. (skipped_file): New function. (grepdirent): New arg command_line; all callers changed. This is needed because non-command-line files can invoke fts_open, and their directory entries need to be distinguished from top-level directory entries. Move code into the new skipped_file function. (grepdesc): Check whether a command-line argument should be skipped. (main): --include and --exclude options now share excluded_patterns rather than having separate variables included_patterns and excluded_patterns. * tests/include-exclude: Add a test to detect the fixed bug.
* tests: test for bug with -r --exclude-dir and no file operandPaul Eggert2012-03-121-0/+4
| | | | * tests/include-exclude: Test for the bug and fix.
* Fix the test suite for MS-Windows.Eli Zaretskii2011-12-281-1/+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.
* --include etc. now work on command-line args more consistentlyPaul Eggert2011-12-241-1/+5
| | | | | | | | | | --include and --exclude apply only to non-directories and --exclude-dir applies only to directories. "-" (standard input) is never excluded, since it is not a file name. This bug was discovered while fixing a read-directory bug (Bug#10355). * NEWS: Document this. * src/main.c (main): Implement this. * tests/include-exclude: Test for it.
* tests: use "compare exp out", not "compare out exp"Jim Meyering2011-11-291-7/+7
| | | | | | | | | | | | | | 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: include-exclude: avoid false positive failure on FreeBSDJim Meyering2011-06-211-9/+9
| | | | | | | * tests/include-exclude: Avoid false-positive failure due to matching "a" in a directory on FreeBSD, when searching a directory without "-r". Search for '^aaa$' rather than just 'a'. Adjust test inputs and expected output files accordingly.
* make --include=FILE work once againJim Meyering2010-08-131-0/+4
| | | | | | | | | | The semantics of excluded_file_name changed (when operating on an "included" file name list). * src/main.c (main): Adjust for changed semantics of excluded_file_name simply by removing a negation. * NEWS (Bug fixes): Mention this fix. * tests/include-exclude: Add a test for this. Reported by Joe Perches in http://savannah.gnu.org/bugs/?29876.
* tests: normalize init.sh-sourcing codeJim Meyering2010-05-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/backref-multibyte-slow: Use one-line idiom. * tests/backref-word: Likewise. * tests/case-fold-backref: Likewise. * tests/case-fold-backslash-w: Likewise. * tests/case-fold-char-class: Likewise. * tests/case-fold-char-range: Likewise. * tests/case-fold-char-type: Likewise. * tests/char-class-multibyte: Likewise. * tests/dfaexec-multibyte: Likewise. * tests/empty: Likewise. * tests/euc-mb: Likewise. * tests/fedora: Likewise. * tests/fgrep-infloop: Likewise. * tests/fmbtest: Likewise. * tests/foad1: Likewise. * tests/ignore-mmap: Likewise. * tests/include-exclude: Likewise. * tests/max-count-vs-context: Likewise. * tests/pcre-z: Likewise. * tests/prefix-of-multibyte: Likewise. * tests/reversed-range-endpoints: Likewise. * tests/sjis-mb: Likewise. * tests/spencer1-locale: Likewise. * tests/word-delim-multibyte: Likewise. * tests/word-multi-file: Likewise.
* tests: also exercise the --include + glob pathJim Meyering2010-03-281-0/+6
| | | | * tests/include-exclude: Exercise Javier's fix.
* grep -r: fix --include with non-globsJim Meyering2010-03-281-0/+5
| | | | | | | | * lib/savedir.c (savedir): Fix logic error. Introduced by commit bf3bd92c, "build: adapt to the newer exclude API we now get from gnulib" * tests/include-exclude: Test for this bug by exercising --include, too. * NEWS (Bug fixes): Mention it. Reported by Philipp Kohlbecher in http://savannah.gnu.org/bugs/?29358
* grep: don't segfault upon use of --include or --exclude* optionsJim Meyering2010-03-271-0/+32
* lib/savedir.c (isdir1): Fix fatal typo: deref "dir" argument, not the global (initially-NULL) "path". Reported by Standish Parsley. * tests/include-exclude: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it.