summary refs log tree commit diff
path: root/tests/monads.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-07-10 12:39:44 +0200
committerLudovic Courtès <ludo@gnu.org>2022-07-10 23:57:14 +0200
commit9fdc4b6c283c5aa5cf10205d87fb2c58b829b9d0 (patch)
tree9458f4783146777e11efb0de96aa6677fe5d73d0 /tests/monads.scm
parentbf0a646a5bcde489b602c58fbb63a93acb9d08f6 (diff)
downloadguix-9fdc4b6c283c5aa5cf10205d87fb2c58b829b9d0.tar.gz
monads: Add 'mparameterize'.
* etc/system-tests.scm (mparameterize): Move to...
* guix/monads.scm (mparameterize): ... here.
* tests/monads.scm ("mparameterize"): New test.
* .dir-locals.el (c-mode): Add it.
Diffstat (limited to 'tests/monads.scm')
-rw-r--r--tests/monads.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/monads.scm b/tests/monads.scm
index 18bf4119be..19b74f4fb9 100644
--- a/tests/monads.scm
+++ b/tests/monads.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2022 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -137,6 +137,19 @@
          %monads
          %monad-run))
 
+(test-assert "mparameterize"
+  (let ((parameter (make-parameter 'outside)))
+    (every (lambda (monad run)
+             (equal?
+              (run (mlet monad ((outer (return (parameter)))
+                                (inner
+                                 (mparameterize monad ((parameter 'inside))
+                                   (return (parameter)))))
+                     (return (list outer inner (parameter)))))
+              '(outside inside outside)))
+           %monads
+           %monad-run)))
+
 (test-assert "mlet* + text-file + package-file"
   (run-with-store %store
     (mlet* %store-monad ((guile (package-file %bootstrap-guile "bin/guile"))