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

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

[elpa] externals/org e4ab416fcc 1/5: Only run Bash tests when relevant f


From: ELPA Syncer
Subject: [elpa] externals/org e4ab416fcc 1/5: Only run Bash tests when relevant features are supported
Date: Fri, 26 Apr 2024 10:05:32 -0400 (EDT)

branch: externals/org
commit e4ab416fcc2821c105fd4173af0648ff0947b88e
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    Only run Bash tests when relevant features are supported
    
    * testing/lisp/test-ob-shell.el (test-ob-shell/bash-uses-arrays): Do
    not run when Bash is not available.
    (test-ob-shell/bash-uses-assoc-arrays):
    (test-ob-shell/bash-uses-assoc-arrays-with-lists): Do not run when
    Bash is not available or has <4.0 version without associative array
    support.
    
    Reported-by: Max Nikulin <manikulin@gmail.com>
    Link: 
https://orgmode.org/list/ef03d3ca-a184-4398-8edb-35f84b48e850@gmail.com
---
 testing/lisp/test-ob-shell.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index 8cebd8467a..f58e858150 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -183,6 +183,7 @@ that will return all elements of the array as a single 
string."
 echo ${array}
 <point>
 #+end_src"
+    (skip-unless (executable-find "bash"))
     (should (equal "one" (org-trim (org-babel-execute-src-block))))))
 
 (ert-deftest test-ob-shell/generic-uses-no-assoc-arrays-simple-map ()
@@ -239,6 +240,13 @@ value. "
 echo ${table[second]}
 <point>
 #+end_src "
+    (skip-unless (executable-find "bash"))
+    (skip-unless
+     (let* ((version-string (shell-command-to-string "bash -c 'echo 
$BASH_VERSION'"))
+            (major-version (and (string-match "^\\([0-9]+\\)\\." 
version-string)
+                               (string-to-number (match-string 1 
version-string)))))
+       ;; Bash 4.0 introduced associative arrays support.
+       (>= major-version 4)))
     (should
      (equal "two"
             (org-trim (org-babel-execute-src-block))))))
@@ -248,6 +256,13 @@ echo ${table[second]}
 
 Bash will see an associative array that contains each row as a single
 string. Bash cannot handle lists in associative arrays."
+  (skip-unless (executable-find "bash"))
+  (skip-unless
+   (let* ((version-string (shell-command-to-string "bash -c 'echo 
$BASH_VERSION'"))
+          (major-version (and (string-match "^\\([0-9]+\\)\\." version-string)
+                             (string-to-number (match-string 1 
version-string)))))
+     ;; Bash 4.0 introduced associative arrays support.
+     (>= major-version 4)))
   (org-test-with-temp-text
       "#+NAME: sample_big_table
 | bread     |  2 | kg |



reply via email to

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