Merging test scripts and output demo
Jesse Glick
jesse.glick at oracle.com
Thu Jun 17 16:27:43 CDT 2010
On 06/13/2010 02:11 PM, Martin Geisler wrote:
> % hg pull
> pulling from ssh://hg@hg.intevation.org/mercurial/crew/
> searching for changes
> no changes found
>
> ....
> We can even do away with the (IMO) silly sed syntax and invent a better:
>
> % hg pull | replace 'ssh://.*' '<somewhere>'
Or even do away with the pipe. Since it is extremely common for the same command to produce slightly different output depending on date, etc., just build some syntax into
the output to ignore some sections:
$ hg pull
pulling from ssh://...
searching for changes
no changes found
$ hg tip
changeset: 3:...
tag: tip
user: ...
date: ...
summary: test
Or if you needed to constrain things a bit more tightly, to avoid accidentally matching too much with the ellipsis operator (such as unexpected error messages), give
regexps with some delimiter which otherwise occurs rarely, such as a tilde:
$ hg pull
pulling from ssh://~\S+~
searching for changes
no changes found
$ hg tip
changeset: 3:~[a-f0-9]{12}~
tag: tip
user: ~.+~
date: ~.+~
summary: test
This would help avoid cryptic test directives like my own (f8a86ea7521b):
[test]
hg -q help help 2>&1 | python -c \
"import sys; sys.stdout.write(sys.stdin.read().replace('$abspath', '.../badext.py'))"
[test.out]
*** failed to import extension badext from .../badext.py: bit bucket overflow
which could be replaced with:
[test]
$ hg -q help help
*** failed to import extension badext from .../badext.py: bit bucket overflow
^^^
now a metasyntactic var
More information about the Mercurial-devel
mailing list