Add unit tests for walk code.
authorBryan O'Sullivan <bos@serpentine.com>
Fri, 12 Aug 2005 16:10:09 -0800
changeset 889 0a06d9d373c3
parent 888 e7a943e8c52b
child 890 391de0bcc722
child 891 a9b843b114f9
Add unit tests for walk code.
tests/test-walk
tests/test-walk.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-walk	Fri Aug 12 16:10:09 2005 -0800
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+mkdir t
+cd t
+hg init
+mkdir -p beans
+for b in kidney navy turtle borlotti black pinto; do
+    echo $b > beans/$b
+done
+mkdir -p mammals/Procyonidae
+for m in cacomistle coatimundi raccoon; do
+    echo $m > mammals/Procyonidae/$m
+done
+echo skunk > mammals/skunk
+echo fennel > fennel
+echo fenugreek > fenugreek
+echo fiddlehead > fiddlehead
+echo glob:glob > glob:glob
+hg addremove
+hg commit -m "commit #0" -d "0 0"
+hg debugwalk
+cd mammals
+hg debugwalk
+hg debugwalk Procyonidae
+cd Procyonidae
+hg debugwalk
+hg debugwalk ..
+cd ..
+hg debugwalk ../beans
+hg debugwalk
+cd ..
+hg debugwalk -Ibeans
+hg debugwalk 'mammals/../beans/b*'
+hg debugwalk '-X*/Procyonidae' mammals
+hg debugwalk path:mammals
+hg debugwalk ..
+hg debugwalk beans/../..
+hg debugwalk `pwd`/beans
+hg debugwalk `pwd`/..
+hg debugwalk glob:\*
+hg debugwalk 're:.*[kb]$'
+hg debugwalk path:beans/black
+hg debugwalk beans 'beans/*'
+hg debugwalk 'j*'
+hg debugwalk NOEXIST
+mkfifo fifo
+hg debugwalk fifo
+rm fenugreek
+hg debugwalk fenugreek
+hg rm fenugreek
+hg debugwalk fenugreek
+touch new
+hg debugwalk new
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-walk.out	Fri Aug 12 16:10:09 2005 -0800
@@ -0,0 +1,123 @@
++ hg init
++ hg addremove
+adding fennel
+adding fenugreek
+adding fiddlehead
+adding glob:glob
+adding beans/black
+adding beans/borlotti
+adding beans/kidney
+adding beans/navy
+adding beans/pinto
+adding beans/turtle
+adding mammals/skunk
+adding mammals/Procyonidae/cacomistle
+adding mammals/Procyonidae/coatimundi
+adding mammals/Procyonidae/raccoon
++ hg commit -m commit #0 -d 0 0
++ hg debugwalk
+f  fennel                          fennel
+f  fenugreek                       fenugreek
+f  fiddlehead                      fiddlehead
+f  glob:glob                       glob:glob
+f  beans/black                     beans/black
+f  beans/borlotti                  beans/borlotti
+f  beans/kidney                    beans/kidney
+f  beans/navy                      beans/navy
+f  beans/pinto                     beans/pinto
+f  beans/turtle                    beans/turtle
+f  mammals/skunk                   mammals/skunk
+f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
+f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
+f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
++ hg debugwalk
+f  mammals/skunk                   skunk
+f  mammals/Procyonidae/cacomistle  Procyonidae/cacomistle
+f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
+f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
++ hg debugwalk Procyonidae
+f  mammals/Procyonidae/cacomistle  Procyonidae/cacomistle
+f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
+f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
++ hg debugwalk
+f  mammals/Procyonidae/cacomistle  cacomistle
+f  mammals/Procyonidae/coatimundi  coatimundi
+f  mammals/Procyonidae/raccoon     raccoon
++ hg debugwalk ..
+f  mammals/skunk                   ../skunk
+f  mammals/Procyonidae/cacomistle  cacomistle
+f  mammals/Procyonidae/coatimundi  coatimundi
+f  mammals/Procyonidae/raccoon     raccoon
++ hg debugwalk ../beans
+f  beans/black     ../beans/black
+f  beans/borlotti  ../beans/borlotti
+f  beans/kidney    ../beans/kidney
+f  beans/navy      ../beans/navy
+f  beans/pinto     ../beans/pinto
+f  beans/turtle    ../beans/turtle
++ hg debugwalk
+f  mammals/skunk                   skunk
+f  mammals/Procyonidae/cacomistle  Procyonidae/cacomistle
+f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
+f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
++ hg debugwalk -Ibeans
+f  beans/black     beans/black
+f  beans/borlotti  beans/borlotti
+f  beans/kidney    beans/kidney
+f  beans/navy      beans/navy
+f  beans/pinto     beans/pinto
+f  beans/turtle    beans/turtle
++ hg debugwalk mammals/../beans/b*
+f  beans/black     beans/black
+f  beans/borlotti  beans/borlotti
++ hg debugwalk -X*/Procyonidae mammals
+f  mammals/skunk  mammals/skunk
++ hg debugwalk path:mammals
+f  mammals/skunk                   mammals/skunk
+f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
+f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
+f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
++ hg debugwalk ..
+abort: .. not under repository root
++ hg debugwalk beans/../..
+abort: beans/../.. not under repository root
++ hg debugwalk /tmp/hgtests.15784.14760.4713.20670/test-walk/t/beans
+f  beans/black     beans/black
+f  beans/borlotti  beans/borlotti
+f  beans/kidney    beans/kidney
+f  beans/navy      beans/navy
+f  beans/pinto     beans/pinto
+f  beans/turtle    beans/turtle
++ hg debugwalk /tmp/hgtests.15784.14760.4713.20670/test-walk/t/..
+abort: /tmp/hgtests.15784.14760.4713.20670/test-walk/t/.. not under repository root
++ hg debugwalk glob:*
+f  fennel      fennel
+f  fenugreek   fenugreek
+f  fiddlehead  fiddlehead
+f  glob:glob   glob:glob
++ hg debugwalk re:.*[kb]$
+f  fenugreek      fenugreek
+f  glob:glob      glob:glob
+f  beans/black    beans/black
+f  mammals/skunk  mammals/skunk
++ hg debugwalk path:beans/black
+f  beans/black  beans/black
++ hg debugwalk beans beans/*
+f  beans/black     beans/black
+f  beans/borlotti  beans/borlotti
+f  beans/kidney    beans/kidney
+f  beans/navy      beans/navy
+f  beans/pinto     beans/pinto
+f  beans/turtle    beans/turtle
++ hg debugwalk j*
++ hg debugwalk NOEXIST
+NOEXIST: No such file or directory
++ hg debugwalk fifo
+fifo: unsupported file type (type is fifo)
++ hg debugwalk fenugreek
+m  fenugreek  fenugreek
++ hg rm fenugreek
++ hg debugwalk fenugreek
+m  fenugreek  fenugreek
++ hg debugwalk new
+f  new  new