Subject: [bug#69975] [PATCH] gnu: Add bash-unit.

From: chris <[email-masked]>
Date: Fri, 12 Jul 2024 00:23:12 -0700

* gnu/packages/bash.scm (bash-unit): New variable.

Change-Id: Ic4185a2364922b03efe7f528e474ac9e71cbf66c
---
 gnu/packages/bash.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 9ecec0a484..a497c77b67 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2020 Zhu Zihao <[email-masked]>
 ;;; Copyright © 2021 Marius Bakke <[email-masked]>
 ;;; Copyright © 2024 Oleg Pykhalov <[email-masked]>
+;;; Copyright © 2024 chris <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -48,6 +49,7 @@ (define-module (gnu packages bash)
   #:use-module (guix monads)
   #:use-module (guix store)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system trivial)
   #:autoload   (guix gnupg) (gnupg-verify*)
   #:autoload   (guix base32) (bytevector->nix-base32-string)
@@ -487,3 +489,33 @@ (define-public blesh
 which replaces the default GNU Readline.  It adds syntax highlighting, auto
 suggestions, vim modes, and more to Bash interactive sessions.")
     (license license:bsd-3)))
+
+(define-public bash-unit
+  (package
+    (name "bash-unit")
+    (version "2.3.1")
+    (home-page "https://github.com/pgrange/bash_unit")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url home-page)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "16vaw9lc7g43g9va1kxbzxqs6b1mawsj4gqi8izz9km3dkbn3pli"))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:install-plan '(("bash_unit" "bin/"))
+       #:phases (modify-phases %standard-phases
+                  (add-before 'install 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (invoke "./bash_unit" "tests/test_core.sh")) #t)))))
+    (inputs (list bash-minimal))
+    (synopsis "Bash unit testing framework")
+    (description
+     "@command{bash_unit} allows you to write unit tests, run them and, in case of
+ failure, display the stack trace with source file and line number indications
+ to locate the problem.")
+    (license license:gpl3+)))

base-commit: 2d6a3799fcda5c017f653c6e96b91964b07a7ee0
-- 
2.45.2