summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-05-28 09:43:42 +0900
committerSharlatan Hellseher <sharlatanus@gmail.com>2025-06-24 10:20:41 +0100
commit847b3dacd3a8ea2fd7da0f4ece5c7e1d82716aa5 (patch)
treee73a8894964f7ae24261119fdeea488ad5785509
parent2b179d6a864e291d1b4ccf3ea3bd80a0e4859f5e (diff)
gnu: Add go-github-com-jiu2015-gotestspace.
* gnu/packages/golang-check.scm (go-github-com-jiu2015-gotestspace): New variable. Change-Id: I4a7c627f14eb5d392c66a04e8e2c2aef7ca8921f Modified-by: Sharlatan Hellseher <sharlatanus@gmail.com> Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
-rw-r--r--gnu/packages/golang-check.scm71
1 files changed, 70 insertions, 1 deletions
diff --git a/gnu/packages/golang-check.scm b/gnu/packages/golang-check.scm
index 51af496b64..9c355d5e4e 100644
--- a/gnu/packages/golang-check.scm
+++ b/gnu/packages/golang-check.scm
@@ -25,6 +25,7 @@
;;; Copyright © 2024 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2024 Troy Figiel <troy@troyfigiel.com>
;;; Copyright © 2024 Roman Scherer <roman@burningswell.com>
+;;; Copyright © 2025 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -49,8 +50,10 @@
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (gnu packages)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages golang-build)
- #:use-module (gnu packages golang-xyz))
+ #:use-module (gnu packages golang-xyz)
+ #:use-module (gnu packages version-control))
;;; Commentary:
;;;
@@ -1258,6 +1261,72 @@ Many times certain facilities are not available, or tests must run
differently.")
(license license:expat)))
+(define-public go-github-com-jiu2015-gotestspace
+ (package
+ (name "go-github-com-jiu2015-gotestspace")
+ (version "1.1.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/Jiu2015/gotestspace")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1wcvdp1wjqj3lh2vdhb2vph528vncjs3vixjriwkxrn979b59y4s"))))
+ (build-system go-build-system)
+ (arguments
+ (list
+ #:import-path "github.com/Jiu2015/gotestspace"
+ ;; Our patching causes some discrepancies in the expected
+ ;; output/values.
+ ;;
+ ;; expected: "goshelltest2=222"
+ ;; actual : "goshelltest1=111"
+ #:test-flags
+ #~(list "-skip" (string-join
+ (list "TestNewShellSpace/path_and_env_parameter"
+ "TestNewShellSpace/path_and_env_and_tem.*r$")
+ "|"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'remove-example
+ (lambda* (#:key import-path #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ (delete-file-recursively "example"))))
+ (add-after 'unpack 'preserve-PATH-from-environment
+ ;; Unlike FHS systems, Guix needs to look its commands fom PATH.
+ ;; Expose it by default in the test environments.
+ (lambda* (#:key tests? import-path #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ (substitute* "options.go"
+ (("\"GIT_COMMITTER_NAME='C O Mitter'\"," all)
+ (string-append
+ all "\n\t\t\t\"PATH=\" + os.Getenv(\"PATH\"),"))))))
+ (add-after 'unpack 'patch-commands
+ (lambda* (#:key import-path inputs #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ ;; Runtime modules.
+ (substitute* "testspace.go"
+ (("/bin/bash")
+ (search-input-file inputs "bin/bash"))
+ (("\"git\"")
+ (format #f "~s" (search-input-file inputs "bin/git"))))))))))
+ (native-inputs
+ (list git-minimal
+ go-github-com-stretchr-testify))
+ (inputs
+ (list bash-minimal
+ git-minimal))
+ (home-page "https://github.com/Jiu2015/gotestspace")
+ (synopsis "Create Go workspaces that can quickly run shell commands")
+ (description
+ "@code{gotestspace} is used to quickly create a working directory for
+shell execution using Go, as well as a tool for customizing the execution of
+the shell. It can help you quickly create an independent workspace for unit
+testing and improve the efficiency of unit test writing.")
+ (license license:gpl3+)))
+
(define-public go-github-com-jmhodges-clock
(package
(name "go-github-com-jmhodges-clock")