[PATCH 1 of 7] tests: use NO_CHECK_EOF as heredoc limit mark to omit checking code fragments

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Sun Feb 17 17:19:24 UTC 2019


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1550417245 -32400
#      Mon Feb 18 00:27:25 2019 +0900
# Node ID b618569414e7d2db2c1d31a17c15bda3b8830901
# Parent  6704696141b85f4a5b6b13171548085cae4dafe5
# Available At https://bitbucket.org/foozy/mercurial-wip
#              hg pull https://bitbucket.org/foozy/mercurial-wip -r b618569414e7
# EXP-Topic tests-fix-check-code-errors
tests: use NO_CHECK_EOF as heredoc limit mark to omit checking code fragments

This is a part of preparation to apply checking with check-code.py on
code fragments embedded in *.t test scripts.

"primes.py" embedded in test-highlight.t causes an error of
check-commit.py below:

    don't use .next(), use next(...)

But changing embedded primes.py is painful, because it is committed in
test script, and affects hash IDs. On the other hand, primes.py itself
is never executed in test script.

Therefore, this patch uses NO_CHECK_EOF as heredoc limit mark in order
to omit any checking on this code fragments.

diff --git a/tests/test-highlight.t b/tests/test-highlight.t
--- a/tests/test-highlight.t
+++ b/tests/test-highlight.t
@@ -19,7 +19,7 @@
 
 create random Python file to exercise Pygments
 
-  $ cat <<EOF > primes.py
+  $ cat <<NO_CHECK_EOF > primes.py
   > """Fun with generators. Corresponding Haskell implementation:
   > 
   > primes = 2 : sieve [3, 5..]
@@ -51,7 +51,7 @@ create random Python file to exercise Py
   >         n = 10
   >     p = primes()
   >     print("The first %d primes: %s" % (n, list(itertools.islice(p, n))))
-  > EOF
+  > NO_CHECK_EOF
   $ echo >> primes.py  # to test html markup with an empty line just before EOF
   $ hg ci -Ama
   adding primes.py


More information about the Mercurial-devel mailing list