Mercurial > hg-stable
changeset 49643:42baf12efd21 stable
tests: pygments 2.14+ highlight whitespace in python code
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Wed, 25 Jan 2023 19:25:42 +0400 |
parents | 37de1a154472 |
children | 5df6d4f06a8f |
files | tests/hghave.py tests/test-highlight.t |
diffstat | 2 files changed, 20 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Wed Jan 25 18:54:17 2023 +0400 +++ b/tests/hghave.py Wed Jan 25 19:25:42 2023 +0400 @@ -693,6 +693,22 @@ return (major, minor) >= (2, 11) +@check("pygments214", "Pygments version >= 2.14") +def pygments214(): + try: + import pygments + + v = pygments.__version__ + except ImportError: + return False + + parts = v.split(".") + major = int(parts[0]) + minor = int(parts[1]) + + return (major, minor) >= (2, 14) + + @check("outer-repo", "outer repo") def has_outer_repo(): # failing for other reasons than 'no repo' imply that there is a repo
--- a/tests/test-highlight.t Wed Jan 25 18:54:17 2023 +0400 +++ b/tests/test-highlight.t Wed Jan 25 19:25:42 2023 +0400 @@ -163,7 +163,8 @@ <span id="l7"><span class="kn">import</span> <span class="nn">itertools</span></span><a href="#l7"></a> <span id="l8"></span><a href="#l8"></a> <span id="l9"><span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></span><a href="#l9"></a> - <span id="l10"> <span class="sd">"""Generate all primes."""</span></span><a href="#l10"></a> + <span id="l10"><span class="w"> </span><span class="sd">"""Generate all primes."""</span></span><a href="#l10"></a> (pygments214 !) + <span id="l10"> <span class="sd">"""Generate all primes."""</span></span><a href="#l10"></a> (no-pygments214 !) <span id="l11"> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l11"></a> <span id="l12"> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></span><a href="#l12"></a> <span id="l13"> <span class="c"># It is important to yield *here* in order to stop the</span></span><a href="#l13"></a> @@ -489,7 +490,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l10"> 10</a> <span class="sd">"""Generate all primes."""</span></td> + <td class="source followlines-btn-parent"><a href="#l10"> 10</a> <span class="w"> </span><span class="sd">"""Generate all primes."""</span></td> (pygments214 !) + <td class="source followlines-btn-parent"><a href="#l10"> 10</a> <span class="sd">"""Generate all primes."""</span></td> (no-pygments214 !) </tr> <tr id="l11" class="thisrev"> <td class="annotate parity0">