grep: improve test coverage
authorValentin Gatien-Baron <valentin.gatienbaron@gmail.com>
Sun, 17 May 2020 12:49:12 -0400
changeset 44907 7e7080ab8ba8
parent 44906 11592ce6a711
child 44908 f90957c947f4
grep: improve test coverage Differential Revision: https://phab.mercurial-scm.org/D8542
tests/test-grep.t
--- a/tests/test-grep.t	Thu Feb 27 09:54:34 2020 -0800
+++ b/tests/test-grep.t	Sun May 17 12:49:12 2020 -0400
@@ -645,18 +645,24 @@
   $ hg init sng
   $ cd sng
   $ echo "unmod" >> um
-  $ hg ci -A -m "adds unmod to um"
-  adding um
+  $ echo old > old
+  $ hg ci -q -A -m "adds unmod to um"
   $ echo "something else" >> new
   $ hg ci -A -m "second commit"
   adding new
   $ hg grep -r "." "unmod"
   um:1:unmod
 
-Working directory is searched by default
+Existing tracked files in the working directory are searched by default
 
   $ echo modified >> new
-  $ hg grep mod
+  $ echo 'added' > added; hg add added
+  $ echo 'added, missing' > added-missing; hg add added-missing; rm added-missing
+  $ echo 'untracked' > untracked
+  $ hg rm old
+  $ hg grep '[^Z]'
+  added:added
+  new:something else
   new:modified
   um:unmod
 
@@ -670,17 +676,6 @@
 
   $ cd ..
 
-Fix_Wdir(): test that passing wdir() t -r flag does greps on the
-files modified in the working directory
-
-  $ cd a
-  $ echo "abracadara" >> a
-  $ hg add a
-  $ hg grep -r "wdir()" "abra"
-  a:2147483647:abracadara
-
-  $ cd ..
-
 Change Default of grep by ui.tweakdefaults, that is, the files not in current
 working directory should not be grepp-ed on