Patchwork tests: add test-help-verbose.t

login
register
mail settings
Submitter timeless@mozdev.org
Date April 7, 2016, 4:36 a.m.
Message ID <a35384e303fe4e097303.1460003799@waste.org>
Download mbox | patch
Permalink /patch/14420/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

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

Check help for each command
Yuya Nishihara - April 9, 2016, 10:53 a.m.
On Wed, 06 Apr 2016 23:36:39 -0500, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1453445322 0
> #      Fri Jan 22 06:48:42 2016 +0000
> # Node ID a35384e303fe4e09730377b216dae353f95a10e3
> # Parent  ea86cdcd9b50bf38c6b9dd7bbaa04b9c8cc0aefb
> tests: add test-help-verbose.t
> 
> Check help for each command

Can you provide more detailed commit message and comments? It's hard to guess
what kind of errors this test is intended to catch, and how.

> --- /dev/null
> +++ b/tests/test-help-verbose.t
> @@ -0,0 +1,28 @@
> +#require slow
> +
> +look for outliers in command help
> +collect all extensions
> +
> +  $ HGE=`hg help extensions | \
> +  > sed -n 's/^     \([a-z][^ ]*\).*/ --config extensions.\1=/p'`
> +
> +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 | head `grep -n '^options' help |sed -e 's/:.*//;s/^/-n /'` | \
> +  >   egrep '^ |^$' | \
> +  >   awk -v RS="\n\n" \
> +  >     '/^    [a-zA-Z].*[a-zA-Z]\s*$/ { print }' | \
> +  >   egrep '.' && echo $c: $PUNCT

This is the first user of awk. Perhaps we would try to not depend on awk.
timeless - April 10, 2016, 2:03 a.m.
Yuya Nishihara wrote:
> This is the first user of awk. Perhaps we would try to not depend on awk.


This was my attempt at avoiding Perl. It's possible to write this in
Python, but definitely not as easy...
Yuya Nishihara - April 10, 2016, 11:06 a.m.
On Sat, 9 Apr 2016 22:03:21 -0400, timeless wrote:
> Yuya Nishihara wrote:
> > This is the first user of awk. Perhaps we would try to not depend on awk.  
> 
> This was my attempt at avoiding Perl. It's possible to write this in
> Python, but definitely not as easy...

But we have to learn Python to hack on Mercurial anyway (unless we rewrite
Mercurial in Rust.) Using Python is the way to go, which might make the code
a bit verbose, but it can be maintained by Mercurial hackers.
Pierre-Yves David - April 11, 2016, 5:54 a.m.
On 04/10/2016 04:06 AM, Yuya Nishihara wrote:
> On Sat, 9 Apr 2016 22:03:21 -0400, timeless wrote:
>> Yuya Nishihara wrote:
>>> This is the first user of awk. Perhaps we would try to not depend on awk.
>> This was my attempt at avoiding Perl. It's possible to write this in
>> Python, but definitely not as easy...
> But we have to learn Python to hack on Mercurial anyway (unless we rewrite
> Mercurial in Rust.) Using Python is the way to go, which might make the code
> a bit verbose, but it can be maintained by Mercurial hackers.

Rust? I though we were going for nodejs?

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,28 @@ 
+#require slow
+
+look for outliers in command help
+collect all extensions
+
+  $ HGE=`hg help extensions | \
+  > sed -n 's/^     \([a-z][^ ]*\).*/ --config extensions.\1=/p'`
+
+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 | head `grep -n '^options' help |sed -e 's/:.*//;s/^/-n /'` | \
+  >   egrep '^ |^$' | \
+  >   awk -v RS="\n\n" \
+  >     '/^    [a-zA-Z].*[a-zA-Z]\s*$/ { print }' | \
+  >   egrep '.' && echo $c: $PUNCT
+  > done; true