Patchwork [7,of,7] tests: add test-help-verbose.t

login
register
mail settings
Submitter timeless@mozdev.org
Date April 4, 2016, 9:31 a.m.
Message ID <03c0e3768ce68c793942.1459762293@waste.org>
Download mbox | patch
Permalink /patch/14341/
State Changes Requested
Headers show

Comments

timeless@mozdev.org - April 4, 2016, 9:31 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1453445322 0
#      Fri Jan 22 06:48:42 2016 +0000
# Node ID 03c0e3768ce68c7939429684d1f3b8b277ef8f97
# Parent  3b0f25d82ea78c185b5b67a098d8adf58e3da2ba
tests: add test-help-verbose.t

Check help for each command
via Mercurial-devel - April 6, 2016, 11:11 p.m.
On Mon, Apr 4, 2016 at 2:31 AM, timeless <timeless@mozdev.org> wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1453445322 0
> #      Fri Jan 22 06:48:42 2016 +0000
> # Node ID 03c0e3768ce68c7939429684d1f3b8b277ef8f97
> # Parent  3b0f25d82ea78c185b5b67a098d8adf58e3da2ba
> tests: add test-help-verbose.t
>
> Check help for each command
>
> diff --git a/tests/test-help-verbose.t b/tests/test-help-verbose.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-help-verbose.t
> @@ -0,0 +1,27 @@
> +#require slow
> +
> +look for outliers in command help
> +collect all extensions
> +
> +  $ HGE=`hg help extensions | \
> +  > perl -ne 'chomp; next unless s/^     ([a-z]\S*).*/ --config extensions.$1=/; print'`

Can we use perl? I don't see any existing uses of it in our tests.
test-convert-clonebranches.t has a line that says "Miss perl...
sometimes".

> +  $ HGE="$HGE --config extensions.show=/home/timeless/hg/hg-experimental/show.py "

I don't have /home/timeless/ on my machine :-) What's the extension about even?

> +
> +collect all commands
> +
> +  $ HGC=`hg $HGE debugcomplete 2>/dev/null`
> +
> +  $ FIRST='first line description of commands should not be Sentence cased'
> +  $ FLAGS='help for flags should not be Sentence cased'
> +  $ BADHG='improper :hg: escape'
> +  $ PUNCT='paragraph should end with punctuation'
> +
> +  $ for c in $HGC;
> +  > do hg $HGE help -c $c 2>/dev/null > help;
> +  > cat help | head -3 | tail -1 | egrep '/^[A-Z]/;' && echo $c: $FIRST
> +  > cat help | egrep '^ -'| egrep '[ +]. [A-Z]' && echo $c: $FLAGS
> +  > cat help | grep ":hg'" && echo $c: $BADHG
> +  > cat help | perl -ne 'if ($a==undef) {next unless /^ /; $a=1; $/="\n\n"; next }'\
> +  > ' last if /(?:^|\n)options.*:/; print ">$_<" if /\n    [a-zA-Z].*[a-zA-Z]\s*$/;' |\
> +  > egrep '.' && echo $c: $PUNCT

consider indenting these two continued lines (and the perl line ~10
lines up, if you're keeping it)

> +  > done; true
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
timeless - April 7, 2016, 1:06 a.m.
Martin von Zweigbergk wrote:
> Can we use perl? I don't see any existing uses of it in our tests.

I need to add a test reminding me that we can't.

> I don't have /home/timeless/ on my machine :-) What's the extension about even?

https://bitbucket.org/facebook/hg-experimental

It happened to be buggy which was why I was playing with it. But yeah,
that obviously shouldn't be in what I submit.

One problem I have: the test environment intentionally forgets about
the user's environment, which means it won't test third party
extensions (like this buggy one).

Patch

diff --git a/tests/test-help-verbose.t b/tests/test-help-verbose.t
new file mode 100644
--- /dev/null
+++ b/tests/test-help-verbose.t
@@ -0,0 +1,27 @@ 
+#require slow
+
+look for outliers in command help
+collect all extensions
+
+  $ HGE=`hg help extensions | \
+  > perl -ne 'chomp; next unless s/^     ([a-z]\S*).*/ --config extensions.$1=/; print'`
+  $ HGE="$HGE --config extensions.show=/home/timeless/hg/hg-experimental/show.py "
+
+collect all commands
+
+  $ HGC=`hg $HGE debugcomplete 2>/dev/null`
+
+  $ FIRST='first line description of commands should not be Sentence cased'
+  $ FLAGS='help for flags should not be Sentence cased'
+  $ BADHG='improper :hg: escape'
+  $ PUNCT='paragraph should end with punctuation'
+
+  $ for c in $HGC;
+  > do hg $HGE help -c $c 2>/dev/null > help;
+  > cat help | head -3 | tail -1 | egrep '/^[A-Z]/;' && echo $c: $FIRST
+  > cat help | egrep '^ -'| egrep '[ +]. [A-Z]' && echo $c: $FLAGS
+  > cat help | grep ":hg'" && echo $c: $BADHG
+  > cat help | perl -ne 'if ($a==undef) {next unless /^ /; $a=1; $/="\n\n"; next }'\
+  > ' last if /(?:^|\n)options.*:/; print ">$_<" if /\n    [a-zA-Z].*[a-zA-Z]\s*$/;' |\
+  > egrep '.' && echo $c: $PUNCT
+  > done; true