guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 87a97de047d301f6a2eb994d16a0eda9f5d7f386
Author: Maxim Cournoyer <[email protected]>
AuthorDate: Mon Aug 3 09:32:07 2026 +0900
tests: Add new json-utils tests.
* tests/json-utils.scm ("add-json-fields", "add-json-fields, recursive")
("add-json-fields, recursive, partially preexisting"): New tests.
---
tests/json-utils.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/json-utils.scm b/tests/json-utils.scm
index 30f63774345..3e33d182d3a 100644
--- a/tests/json-utils.scm
+++ b/tests/json-utils.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2026 Nicolas Graves <[email protected]>
+;;; Copyright © 2026 Maxim Cournoyer <[email protected]>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -160,6 +161,31 @@ captures the written output as a string."
(fresh-sample-json))))
(equal? (assoc-ref result "name") "my-package")))
+;;;
+;;; add-json-fields
+;;;
+(test-equal "add-json-fields"
+ #("test")
+ (assoc-ref (modify-json*
+ (add-json-fields '(("exclude" . #("test")))))
+ "exclude"))
+
+(test-equal "add-json-fields, recursive"
+ "^25.9.2"
+ (assoc-ref (assoc-ref (modify-json*
+ (add-json-fields '(("devDependencies2.@types/node"
+ . "^25.9.2"))))
+ "devDependencies2")
+ "@types/node"))
+
+(test-equal "add-json-fields, recursive, partially preexisting"
+ "^9.9.9"
+ (assoc-ref (assoc-ref (modify-json*
+ (add-json-fields '(("devDependencies.@types/dummy"
+ . "^9.9.9"))))
+ "devDependencies")
+ "@types/dummy"))
+
;;;
;;; modify-json-fields
;;;