[PATCH STABLE] test: add test for the issue introduced by e410be860393 (issue3669)

Matt Mackall mpm at selenic.com
Sun Oct 21 17:22:50 CDT 2012


On Sun, 2012-10-21 at 23:56 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1350831165 -32400
> # Branch stable
> # Node ID ca94ae8b7660f0bd73354834ce17144f29c63f00
> # Parent  b32e55e6c3c729c1eb0658a0c3bc109259bfdae6
> test: add test for the issue introduced by e410be860393 (issue3669)
> 
> e410be860393 (released as Mercurial 2.3) introduced the issue that the
> revset program started with 40 hexadecimal letters caused unexpected
> result at "hg log" execution.
> 
> This issue was already fixed by bde1185f406c (released as 2.3.1), but
> there is no test to examine whether this issue is certainly fixed or
> not: no test fails even if bde1185f406c is backed out.
> 
> This patch adds test for this issue.
> 
> Added test is confirmed to fail, when it is tested against:
> 
>   - Mercurial 2.3, or
>   - Mercurial 2.3.1 or later with backing bde1185f406c out
> 
> diff -r b32e55e6c3c7 -r ca94ae8b7660 tests/test-revset.t
> --- a/tests/test-revset.t	Fri Oct 19 14:47:55 2012 -0500
> +++ b/tests/test-revset.t	Sun Oct 21 23:52:45 2012 +0900
> @@ -825,3 +825,38 @@
>    3
>  
>    $ cd ..
> +
> +issue3669: test revsets started with 40 hexadecimal letters
> +
> +  $ hg init issue3669
> +  $ cd issue3669
> +
> +  $ echo a > a
> +  $ hg add a
> +  $ hg commit -m '#0'
> +  $ echo 1 >> a
> +  $ hg commit -m '#1'

Please, do not do this, tests are not free. There's already a dozen
perfectly good commits built by this test. Quote:

        The test suite is slow. And the test suite is slow because it is
        highly redundant. And it is highly redundant because for years
        we've been writing a completely new test for each issue that
        creates a new repo, adds a file, runs status, commits, does a
        merge, etc.
        
        http://mercurial.selenic.com/wiki/WritingTests#No_more_new_test_scripts.21

Do this instead:

--- a/tests/test-revset.t	Sat Oct 20 21:43:46 2012 -0400
+++ b/tests/test-revset.t	Sun Oct 21 17:12:57 2012 -0500
@@ -96,6 +96,17 @@
   $ echo "[paths]" >> .hg/hgrc
   $ echo "default = ../remote1" >> .hg/hgrc
 
+test 40-char hashes in revset:
+
+  $ hg log -r "24286f4ae13518d6b14fddd52e78f20be2155a9a^"
+  changeset:   9:24286f4ae135
+  branch:      \xc3\xa9 (esc)
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added tag 1.0 for changeset e0cc66ef77e8
+  
+

(queued)

And that's absolutely all the testing that's warranted for this issue.
There's only one hash to revision facility, deep beneath revsets.
Testing with a bunch of different revsets won't test any new paths.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list