Mercurial > hg
changeset 12312:83a310f2f14a
tests: unify test-hgignore
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Wed, 15 Sep 2010 22:18:46 +0200 |
parents | 8afbf44cfe86 |
children | 2912881c2a98 |
files | tests/test-hgignore tests/test-hgignore.out tests/test-hgignore.t |
diffstat | 3 files changed, 121 insertions(+), 130 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-hgignore Thu Sep 16 11:36:38 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -#!/bin/sh - -hg init - -# Test issue 562: .hgignore requires newline at end -touch foo -touch bar -touch baz -cat > makeignore.py <<EOF -f = open(".hgignore", "w") -f.write("ignore\n") -f.write("foo\n") -# No EOL here -f.write("bar") -f.close() -EOF - -python makeignore.py -echo % should display baz only -hg status -rm foo bar baz .hgignore makeignore.py - -touch a.o -touch a.c -touch syntax -mkdir dir -touch dir/a.o -touch dir/b.o -touch dir/c.o - -hg add dir/a.o -hg commit -m 0 -hg add dir/b.o - -echo "--" ; hg status - -echo "*.o" > .hgignore -echo "--" ; hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/' - -echo ".*\.o" > .hgignore -echo "--" ; hg status - -# Check it does not ignore the current directory '.' -echo "^\." > .hgignore -echo "--" ; hg status - -echo "glob:**.o" > .hgignore -echo "--" ; hg status - -echo "glob:*.o" > .hgignore -echo "--" ; hg status - -echo "syntax: glob" > .hgignore -echo "re:.*\.o" >> .hgignore -echo "--" ; hg status - -echo "syntax: invalid" > .hgignore -echo "--" ; hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/' - -echo "syntax: glob" > .hgignore -echo "*.o" >> .hgignore -echo "--" ; hg status - -echo "relglob:syntax*" > .hgignore -echo "--" ; hg status - -echo "relglob:*" > .hgignore -echo "--" ; hg status - -cd dir -echo "--" ; hg status .
--- a/tests/test-hgignore.out Thu Sep 16 11:36:38 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -% should display baz only -? baz --- -A dir/b.o -? a.c -? a.o -? dir/c.o -? syntax --- -abort: .hgignore: invalid pattern (relre): *.o --- -A dir/b.o -? .hgignore -? a.c -? syntax --- -A dir/b.o -? a.c -? a.o -? dir/c.o -? syntax --- -A dir/b.o -? .hgignore -? a.c -? syntax --- -A dir/b.o -? .hgignore -? a.c -? syntax --- -A dir/b.o -? .hgignore -? a.c -? syntax --- -.hgignore: ignoring invalid syntax 'invalid' -A dir/b.o -? .hgignore -? a.c -? a.o -? dir/c.o -? syntax --- -A dir/b.o -? .hgignore -? a.c -? syntax --- -A dir/b.o -? .hgignore -? a.c -? a.o -? dir/c.o --- -A dir/b.o --- -A b.o
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-hgignore.t Wed Sep 15 22:18:46 2010 +0200 @@ -0,0 +1,121 @@ + $ hg init + +Test issue 562: .hgignore requires newline at end: + + $ touch foo + $ touch bar + $ touch baz + $ cat > makeignore.py <<EOF + > f = open(".hgignore", "w") + > f.write("ignore\n") + > f.write("foo\n") + > # No EOL here + > f.write("bar") + > f.close() + > EOF + + $ python makeignore.py + +Should display baz only: + + $ hg status + ? baz + + $ rm foo bar baz .hgignore makeignore.py + + $ touch a.o + $ touch a.c + $ touch syntax + $ mkdir dir + $ touch dir/a.o + $ touch dir/b.o + $ touch dir/c.o + + $ hg add dir/a.o + $ hg commit -m 0 + $ hg add dir/b.o + + $ hg status + A dir/b.o + ? a.c + ? a.o + ? dir/c.o + ? syntax + + $ echo "*.o" > .hgignore + $ hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/' + abort: .hgignore: invalid pattern (relre): *.o + + $ echo ".*\.o" > .hgignore + $ hg status + A dir/b.o + ? .hgignore + ? a.c + ? syntax + +Check it does not ignore the current directory '.': + + $ echo "^\." > .hgignore + $ hg status + A dir/b.o + ? a.c + ? a.o + ? dir/c.o + ? syntax + + $ echo "glob:**.o" > .hgignore + $ hg status + A dir/b.o + ? .hgignore + ? a.c + ? syntax + + $ echo "glob:*.o" > .hgignore + $ hg status + A dir/b.o + ? .hgignore + ? a.c + ? syntax + + $ echo "syntax: glob" > .hgignore + $ echo "re:.*\.o" >> .hgignore + $ hg status + A dir/b.o + ? .hgignore + ? a.c + ? syntax + + $ echo "syntax: invalid" > .hgignore + $ hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/' + .hgignore: ignoring invalid syntax 'invalid' + A dir/b.o + ? .hgignore + ? a.c + ? a.o + ? dir/c.o + ? syntax + + $ echo "syntax: glob" > .hgignore + $ echo "*.o" >> .hgignore + $ hg status + A dir/b.o + ? .hgignore + ? a.c + ? syntax + + $ echo "relglob:syntax*" > .hgignore + $ hg status + A dir/b.o + ? .hgignore + ? a.c + ? a.o + ? dir/c.o + + $ echo "relglob:*" > .hgignore + $ hg status + A dir/b.o + + $ cd dir + $ hg status . + A b.o +