Mercurial > gnulib
diff tests/test-exclude7.sh @ 11811:451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
* lib/exclude.c: Include hash.h and mbuiter.h
(struct exclude_pattern, exclude_segment): New data types.
(struct exclude): Rewrite.
(fnmatch_pattern_has_wildcards): New function.
(new_exclude_segment, free_exclude_segment): New functions.
(excluded_file_pattern_p, excluded_file_name_p): New functions.
(excluded_file_name, add_exclude): Rewrite using new struct exclude.
* lib/exclude.h (is_fnmatch_pattern): New prototype.
* modules/exclude: Depend on hash and mbuiter.
* modules/exclude-tests: New file.
* tests/test-exclude.c: New file.
* tests/test-exclude1.sh: New file.
* tests/test-exclude2.sh: New file.
* tests/test-exclude3.sh: New file.
* tests/test-exclude4.sh: New file.
* tests/test-exclude5.sh: New file.
* tests/test-exclude6.sh: New file.
* tests/test-exclude7.sh: New file.
author | Sergey Poznyakoff <gray@gnu.org.ua> |
---|---|
date | Wed, 12 Aug 2009 19:03:07 +0300 |
parents | |
children | e53ecd6bb7d0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-exclude7.sh Wed Aug 12 19:03:07 2009 +0300 @@ -0,0 +1,42 @@ +#! /bin/sh +# Test suite for exclude. +# Copyright (C) 2009 Free Software Foundation, Inc. +# This file is part of the GNUlib Library. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +TMP=excltmp.$$ +LIST=flist.$$ +ERR=0 + +# Test exclude precedence + +cat > $LIST <<EOT +foo* +bar +Baz +EOT + +cat > $TMP <<EOT +bar: 1 +bar: 0 +EOT + +./test-exclude$EXEEXT $LIST -include $LIST -- bar >$TMP.1 +./test-exclude$EXEEXT -include $LIST -no-include $LIST -- bar >>$TMP.1 + +diff -c $TMP $TMP.1 || ERR=1 + +rm -f $TMP $TMP.1 $LIST +exit $ERR