tests/test-check-help.t
author Siddharth Agarwal <sid0@fb.com>
Sun, 21 May 2017 13:44:26 -0700
changeset 32421 778dc37ce683
parent 31498 a248bbfa0bc7
child 32940 75be14993fda
permissions -rw-r--r--
check: check modules in hgdemandimport A few places only check modules in mercurial and hgext. Add hgdemandimport to the list in those places.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30880
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     1
#require test-repo
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     2
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     3
  $ . "$TESTDIR/helpers-testrepo.sh"
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     4
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     5
  $ cat <<'EOF' > scanhelptopics.py
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     6
  > from __future__ import absolute_import, print_function
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     7
  > import re
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     8
  > import sys
31498
a248bbfa0bc7 test-check-help: fix to work on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 30880
diff changeset
     9
  > if sys.platform == "win32":
a248bbfa0bc7 test-check-help: fix to work on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 30880
diff changeset
    10
  >     import os, msvcrt
a248bbfa0bc7 test-check-help: fix to work on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 30880
diff changeset
    11
  >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
30880
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    12
  > topics = set()
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    13
  > topicre = re.compile(r':hg:`help ([a-z0-9\-.]+)`')
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    14
  > for fname in sys.argv:
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    15
  >     with open(fname) as f:
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    16
  >         topics.update(m.group(1) for m in topicre.finditer(f.read()))
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    17
  > for s in sorted(topics):
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    18
  >     print(s)
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    19
  > EOF
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    20
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    21
  $ cd "$TESTDIR"/..
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    22
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    23
Check if ":hg:`help TOPIC`" is valid:
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    24
(use "xargs -n1 -t" to see which help commands are executed)
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    25
32421
778dc37ce683 check: check modules in hgdemandimport
Siddharth Agarwal <sid0@fb.com>
parents: 31498
diff changeset
    26
  $ hg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' | sed 's|\\|/|g' \
30880
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    27
  > | xargs python "$TESTTMP/scanhelptopics.py" \
b6c051cd1231 help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    28
  > | xargs -n1 hg help > /dev/null