summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim@guixotic.coop>2026-08-03 09:32:07 +0900
committerMaxim Cournoyer <maxim@guixotic.coop>2026-08-27 10:59:22 +0900
commit85e4133e17892aa07b3b06871bd46451c1d32f0c (patch)
tree7050e0da881a913ce6faaa6a90cda8cae33abe63
parent728408c2b08defad444bfe50856b0f00399f2231 (diff)
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.
-rw-r--r--tests/json-utils.scm26
1 files changed, 26 insertions, 0 deletions
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 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2026 Nicolas Graves <ngraves@ngraves.fr> 2;;; Copyright © 2026 Nicolas Graves <ngraves@ngraves.fr>
3;;; Copyright © 2026 Maxim Cournoyer <maxim@guixotic.coop>
3;;; 4;;;
4;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
5;;; 6;;;
@@ -161,6 +162,31 @@ captures the written output as a string."
161 (equal? (assoc-ref result "name") "my-package"))) 162 (equal? (assoc-ref result "name") "my-package")))
162 163
163;;; 164;;;
165;;; add-json-fields
166;;;
167(test-equal "add-json-fields"
168 #("test")
169 (assoc-ref (modify-json*
170 (add-json-fields '(("exclude" . #("test")))))
171 "exclude"))
172
173(test-equal "add-json-fields, recursive"
174 "^25.9.2"
175 (assoc-ref (assoc-ref (modify-json*
176 (add-json-fields '(("devDependencies2.@types/node"
177 . "^25.9.2"))))
178 "devDependencies2")
179 "@types/node"))
180
181(test-equal "add-json-fields, recursive, partially preexisting"
182 "^9.9.9"
183 (assoc-ref (assoc-ref (modify-json*
184 (add-json-fields '(("devDependencies.@types/dummy"
185 . "^9.9.9"))))
186 "devDependencies")
187 "@types/dummy"))
188
189;;;
164;;; modify-json-fields 190;;; modify-json-fields
165;;; 191;;;
166 192