changeset 12206:844d25bf65a3

tests: unify test-locate
author Adrian Buehlmann <adrian@cadifra.com>
date Fri, 10 Sep 2010 19:41:45 +0200
parents b4d0d646b3f7
children 97e37994a6c3
files tests/test-locate tests/test-locate.out tests/test-locate.t
diffstat 3 files changed, 117 insertions(+), 158 deletions(-) [+]
line wrap: on
line diff
--- 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$'
--- 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
-
--- /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
+