aboutsummaryrefslogtreecommitdiff
path: root/tests/test.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test.scm')
-rwxr-xr-xtests/test.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test.scm b/tests/test.scm
index 6ce798e..562c736 100755
--- a/tests/test.scm
+++ b/tests/test.scm
@@ -51,3 +51,29 @@
(test-end "state-test")
+
+(test-begin "writer-test")
+
+(use-modules (monad writer))
+
+(test-equal '(10 "HelloWorld")
+ (run-writer
+ (do (w "Hello")
+ (w "World")
+ (return-writer 10))))
+
+(test-equal '(10 "HelloWorld")
+ (run-writer
+ (do "Hello" "World"
+ (return-writer 10))))
+
+(test-equal '(3 "Applied + to (1 2) ⇒ 3\n")
+ (run-writer (with-writer + 1 2)))
+
+(test-equal '(10 "Hello, World")
+ (run-writer
+ (do (string-append "Hello" ", ")
+ "World"
+ (return-writer 10))))
+
+(test-end "writer-test")