[PATCH] tests: unify test-locate

Adrian Buehlmann adrian at cadifra.com
Fri Sep 10 12:45:50 CDT 2010


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1284140505 -7200
# Node ID e4db39f9598a3f5f7e9918b53621a2bd494083ae
# Parent  2b3c2996a2961b518556f8b631dc84852f2b7159
tests: unify test-locate

diff --git a/tests/test-locate.out b/tests/test-locate.out
deleted file mode 100644
--- a/tests/test-locate.out
+++ /dev/null
@@ -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 --git a/tests/test-locate b/tests/test-locate.t
old mode 100755
new mode 100644
rename from tests/test-locate
rename to tests/test-locate.t
--- a/tests/test-locate
+++ b/tests/test-locate.t
@@ -1,56 +1,117 @@
-#!/bin/sh
+  $ 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
 
-hglocate()
-{
-    echo "hg locate $@"
-    hg locate "$@"
-    ret=$?
-    echo
-    return $ret
-}
+  $ 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
 
-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$'
+  $ 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
+


More information about the Mercurial-devel mailing list