emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/d-mode 5da089b 332/346: tests: Replace #min-version with a


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode 5da089b 332/346: tests: Replace #min-version with a more generic #condition
Date: Sun, 29 Aug 2021 11:00:55 -0400 (EDT)

branch: elpa/d-mode
commit 5da089b07389a9901f33795b8ba7d87cd6d95f26
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>

    tests: Replace #min-version with a more generic #condition
    
    This allows us to define more complex conditions, such as excluding a
    specific Emacs version range.
---
 d-mode-test.el              | 8 +++-----
 tests/I0019.d               | 2 +-
 tests/I0067.d               | 2 +-
 tests/I0082.d               | 2 +-
 tests/I0082.d.html          | 2 +-
 tests/I0093_35907724.d      | 2 +-
 tests/I0093_35907724.d.html | 2 +-
 tests/fonts_params.d        | 2 +-
 tests/fonts_params.d.html   | 2 +-
 tests/imenu2.d              | 2 +-
 10 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/d-mode-test.el b/d-mode-test.el
index 222485a..529cba7 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -310,11 +310,9 @@ the reference file, raise an error."
 (defun d-test-get-expected-result (filename)
   (with-temp-buffer
     (insert-file-contents filename)
-    (let* ((min-ver
-            (if (re-search-forward "^// #min-version: \\(.+\\)$" nil t)
-                (match-string 1)
-              "0")))
-      (version<= min-ver emacs-version))))
+    (if (re-search-forward "^// #condition: \\(.+\\)$" nil t)
+        (eval (car (read-from-string (format "(progn %s)" (match-string 1)))))
+      t)))
 
 (defmacro d-test-dir (dir)
   "Register all test files from DIR with ert."
diff --git a/tests/I0019.d b/tests/I0019.d
index 37c058a..488ba1b 100644
--- a/tests/I0019.d
+++ b/tests/I0019.d
@@ -1,4 +1,4 @@
-// #min-version: 25.1
+// #condition: (version<= "25.1" emacs-version)
 // #run: (d-test-indent)
 
 enum OtherValues2 : uint {
diff --git a/tests/I0067.d b/tests/I0067.d
index 159ac92..2e7957b 100644
--- a/tests/I0067.d
+++ b/tests/I0067.d
@@ -1,4 +1,4 @@
-// #min-version: 26.1
+// #condition: (version<= "26.1" emacs-version)
 // #run: (d-test-indent)
 
 void foo(T)(T stuff)
diff --git a/tests/I0082.d b/tests/I0082.d
index b3d81eb..e19fe75 100644
--- a/tests/I0082.d
+++ b/tests/I0082.d
@@ -1,4 +1,4 @@
-// #min-version: 26.1
+// #condition: (version<= "26.1" emacs-version)
 // #run: (d-test-fontification)
 
 struct S
diff --git a/tests/I0082.d.html b/tests/I0082.d.html
index e2084b5..1d29328 100644
--- a/tests/I0082.d.html
+++ b/tests/I0082.d.html
@@ -1,4 +1,4 @@
-<span class="comment-delimiter">// </span><span class="comment">#min-version: 
26.1
+<span class="comment-delimiter">// </span><span class="comment">#condition: 
(version&lt;= &quot;26.1&quot; emacs-version)
 </span><span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
 </span>
 <span class="keyword">struct</span> <span class="type">S</span>
diff --git a/tests/I0093_35907724.d b/tests/I0093_35907724.d
index 96b1de3..72db0f2 100644
--- a/tests/I0093_35907724.d
+++ b/tests/I0093_35907724.d
@@ -1,4 +1,4 @@
-// #min-version: 26.1
+// #condition: (version<= "26.1" emacs-version)
 // #run: (d-test-fontification)
 
 foreach (const offset, const ref element; haystack) fun();
diff --git a/tests/I0093_35907724.d.html b/tests/I0093_35907724.d.html
index 7e5965a..8a76413 100644
--- a/tests/I0093_35907724.d.html
+++ b/tests/I0093_35907724.d.html
@@ -1,4 +1,4 @@
-<span class="comment-delimiter">// </span><span class="comment">#min-version: 
26.1
+<span class="comment-delimiter">// </span><span class="comment">#condition: 
(version&lt;= &quot;26.1&quot; emacs-version)
 </span><span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
 </span>
 <span class="keyword">foreach</span> (<span class="keyword">const</span> <span 
class="variable-name">offset</span>, <span class="keyword">const ref</span> 
<span class="variable-name">element</span>; haystack) fun();
diff --git a/tests/fonts_params.d b/tests/fonts_params.d
index 578ce38..34de32b 100644
--- a/tests/fonts_params.d
+++ b/tests/fonts_params.d
@@ -1,4 +1,4 @@
-// #min-version: 26.1
+// #condition: (version<= "26.1" emacs-version)
 // #run: (d-test-fontification)
 
 auto dg = (Object a, Object b) {};
diff --git a/tests/fonts_params.d.html b/tests/fonts_params.d.html
index 447f8e1..d0ed92d 100644
--- a/tests/fonts_params.d.html
+++ b/tests/fonts_params.d.html
@@ -1,4 +1,4 @@
-<span class="comment-delimiter">// </span><span class="comment">#min-version: 
26.1
+<span class="comment-delimiter">// </span><span class="comment">#condition: 
(version&lt;= &quot;26.1&quot; emacs-version)
 </span><span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
 </span>
 <span class="keyword">auto</span> <span class="variable-name">dg</span> = 
(<span class="type">Object</span> <span class="variable-name">a</span>, <span 
class="type">Object</span> <span class="variable-name">b</span>) {};
diff --git a/tests/imenu2.d b/tests/imenu2.d
index 7607d68..a0421b6 100644
--- a/tests/imenu2.d
+++ b/tests/imenu2.d
@@ -1,4 +1,4 @@
-// #min-version: 26.1
+// #condition: (version<= "26.1" emacs-version)
 // #run: (d-test-get-imenu-lines)
 // #out: (5 6 13 18 20 24 28 33 37 40 42 46 49 50 51 52 54 56)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]