tests: pygments 2.14+ highlight whitespace in python code stable
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 25 Jan 2023 19:25:42 +0400
branchstable
changeset 49951 42baf12efd21
parent 49950 37de1a154472
child 49952 5df6d4f06a8f
tests: pygments 2.14+ highlight whitespace in python code
tests/hghave.py
tests/test-highlight.t
--- 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">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></span><a href="#l10"></a>
+  <span id="l10"><span class="w">    </span><span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></span><a href="#l10"></a> (pygments214 !)
+  <span id="l10">    <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</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">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td>
+  <td class="source followlines-btn-parent"><a href="#l10">    10</a> <span class="w">    </span><span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td> (pygments214 !)
+  <td class="source followlines-btn-parent"><a href="#l10">    10</a>     <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td> (no-pygments214 !)
   </tr>
   <tr id="l11" class="thisrev">
   <td class="annotate parity0">