# HG changeset patch # User Adrian Buehlmann # Date 1284140505 -7200 # Node ID 844d25bf65a33f80d8c6884126e81ed178b40fdd # Parent b4d0d646b3f77349ecd2105b4a5bd694c2a1e368 tests: unify test-locate diff -r b4d0d646b3f7 -r 844d25bf65a3 tests/test-locate --- a/tests/test-locate Fri Sep 10 19:05:49 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -#!/bin/sh - -hglocate() -{ - echo "hg locate $@" - hg locate "$@" - ret=$? - echo - return $ret -} - -mkdir t -cd t -hg init -echo 0 > a -echo 0 > b -echo 0 > t.h -mkdir t -echo 0 > t/x -echo 0 > t/b -echo 0 > t/e.h -mkdir dir.h -echo 0 > dir.h/foo -hg ci -A -m m -touch nottracked -hglocate a && echo locate succeeded || echo locate failed -hglocate NONEXISTENT && echo locate succeeded || echo locate failed -hglocate -hg rm a -hg ci -m m -hglocate a -hglocate NONEXISTENT -hglocate relpath:NONEXISTENT -hglocate -hglocate -r 0 a -hglocate -r 0 NONEXISTENT -hglocate -r 0 relpath:NONEXISTENT -hglocate -r 0 -echo % -I/-X with relative path should work -cd t -hglocate -hglocate -I ../t -# test issue294 -cd .. -rm -r t -hglocate 't/**' -mkdir otherdir -cd otherdir -hglocate b -hglocate '*.h' -hglocate path:t/x -hglocate 're:.*\.h$' -hglocate -r 0 b -hglocate -r 0 '*.h' -hglocate -r 0 path:t/x -hglocate -r 0 're:.*\.h$' diff -r b4d0d646b3f7 -r 844d25bf65a3 tests/test-locate.out --- a/tests/test-locate.out Fri Sep 10 19:05:49 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -adding a -adding b -adding dir.h/foo -adding t.h -adding t/b -adding t/e.h -adding t/x -hg locate a -a - -locate succeeded -hg locate NONEXISTENT - -locate failed -hg locate -a -b -dir.h/foo -t.h -t/b -t/e.h -t/x - -hg locate a - -hg locate NONEXISTENT - -hg locate relpath:NONEXISTENT - -hg locate -b -dir.h/foo -t.h -t/b -t/e.h -t/x - -hg locate -r 0 a -a - -hg locate -r 0 NONEXISTENT - -hg locate -r 0 relpath:NONEXISTENT - -hg locate -r 0 -a -b -dir.h/foo -t.h -t/b -t/e.h -t/x - -% -I/-X with relative path should work -hg locate -b -dir.h/foo -t.h -t/b -t/e.h -t/x - -hg locate -I ../t -t/b -t/e.h -t/x - -hg locate t/** -t/b -t/e.h -t/x - -hg locate b -../b -../t/b - -hg locate *.h -../t.h -../t/e.h - -hg locate path:t/x -../t/x - -hg locate re:.*\.h$ -../t.h -../t/e.h - -hg locate -r 0 b -../b -../t/b - -hg locate -r 0 *.h -../t.h -../t/e.h - -hg locate -r 0 path:t/x -../t/x - -hg locate -r 0 re:.*\.h$ -../t.h -../t/e.h - diff -r b4d0d646b3f7 -r 844d25bf65a3 tests/test-locate.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-locate.t Fri Sep 10 19:41:45 2010 +0200 @@ -0,0 +1,117 @@ + $ mkdir t + $ cd t + $ hg init + $ echo 0 > a + $ echo 0 > b + $ echo 0 > t.h + $ mkdir t + $ echo 0 > t/x + $ echo 0 > t/b + $ echo 0 > t/e.h + $ mkdir dir.h + $ echo 0 > dir.h/foo + + $ hg ci -A -m m + adding a + adding b + adding dir.h/foo + adding t.h + adding t/b + adding t/e.h + adding t/x + + $ touch nottracked + + $ hg locate a && echo locate succeeded || echo locate failed + a + locate succeeded + + $ hg locate NONEXISTENT && echo locate succeeded || echo locate failed + locate failed + + $ hg locate + a + b + dir.h/foo + t.h + t/b + t/e.h + t/x + + $ hg rm a + $ hg ci -m m + + $ hg locate a + $ hg locate NONEXISTENT + $ hg locate relpath:NONEXISTENT + $ hg locate + b + dir.h/foo + t.h + t/b + t/e.h + t/x + $ hg locate -r 0 a + a + $ hg locate -r 0 NONEXISTENT + $ hg locate -r 0 relpath:NONEXISTENT + $ hg locate -r 0 + a + b + dir.h/foo + t.h + t/b + t/e.h + t/x + +-I/-X with relative path should work: + + $ cd t + $ hg locate + b + dir.h/foo + t.h + t/b + t/e.h + t/x + $ hg locate -I ../t + t/b + t/e.h + t/x + +Test issue294: + + $ cd .. + $ rm -r t + + $ hg locate 't/**' + t/b + t/e.h + t/x + + $ mkdir otherdir + $ cd otherdir + + $ hg locate b + ../b + ../t/b + $ hg locate '*.h' + ../t.h + ../t/e.h + $ hg locate path:t/x + ../t/x + $ hg locate 're:.*\.h$' + ../t.h + ../t/e.h + $ hg locate -r 0 b + ../b + ../t/b + $ hg locate -r 0 '*.h' + ../t.h + ../t/e.h + $ hg locate -r 0 path:t/x + ../t/x + $ hg locate -r 0 're:.*\.h$' + ../t.h + ../t/e.h +