summaryrefslogtreecommitdiff
path: root/guix/tests.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-04-04 21:59:25 +0200
committerLudovic Courtès <ludo@gnu.org>2018-11-12 23:37:13 +0100
commit9ed86fe175c15c819d6d86681c8136ff6bc927c0 (patch)
tree15403c26a4048013764c36f40d7e97d5d0066b7d /guix/tests.scm
parente740a902281bb3bde369cc04f26656de608d3614 (diff)
downloadgnu-guix-9ed86fe175c15c819d6d86681c8136ff6bc927c0.tar
gnu-guix-9ed86fe175c15c819d6d86681c8136ff6bc927c0.tar.gz
tests: Add 'test-assertm' to (guix tests).
* guix/tests.scm (test-assertm): New macro. * tests/gexp.scm (test-assertm): Remove. * tests/profiles.scm (test-assertm): Remove. * tests/challenge.scm (%store, test-assertm): Remove. * tests/debug-link.scm (%store, test-assertm): Remove. * tests/size.scm (%store, test-assertm): Remove.
Diffstat (limited to 'guix/tests.scm')
-rw-r--r--guix/tests.scm25
1 files changed, 25 insertions, 0 deletions
diff --git a/guix/tests.scm b/guix/tests.scm
index bcf9b990e5..66524ddc2f 100644
--- a/guix/tests.scm
+++ b/guix/tests.scm
@@ -27,6 +27,7 @@
#:use-module (guix build-system gnu)
#:use-module (gnu packages bootstrap)
#:use-module (srfi srfi-34)
+ #:use-module (srfi srfi-64)
#:use-module (rnrs bytevectors)
#:use-module (ice-9 binary-ports)
#:use-module (web uri)
@@ -39,6 +40,8 @@
shebang-too-long?
mock
%test-substitute-urls
+ test-assertm
+ test-equalm
%substitute-directory
with-derivation-narinfo
with-derivation-substitute
@@ -161,6 +164,28 @@ given by REPLACEMENT."
(lambda () body ...)
(lambda () (module-set! m 'proc original)))))
+(define-syntax-rule (test-assertm name exp)
+ "Like 'test-assert', but EXP is a monadic value. A new connection to the
+store is opened."
+ (test-assert name
+ (let ((store (open-connection-for-tests)))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ (run-with-store store exp
+ #:guile-for-build (%guile-for-build)))
+ (lambda ()
+ (close-connection store))))))
+
+(define-syntax-rule (test-equalm name value exp)
+ "Like 'test-equal', but EXP is a monadic value. A new connection to the
+store is opened."
+ (test-equal name
+ value
+ (with-store store
+ (run-with-store store exp
+ #:guile-for-build (%guile-for-build)))))
+
;;;
;;; Narinfo files, as used by the substituter.