X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=extra%2Fmonads%2Fmonads-tests.factor;h=ca02097401434e528b8b63a0f2713d3cee1cefaa;hp=a7b925ca2fc0cf09619c6ae20b0a43f4b957e933;hb=HEAD;hpb=892c62e1dc227e9e4c94788094e00955680c18d0 diff --git a/extra/monads/monads-tests.factor b/extra/monads/monads-tests.factor index a7b925ca2f..ca02097401 100644 --- a/extra/monads/monads-tests.factor +++ b/extra/monads/monads-tests.factor @@ -1,4 +1,5 @@ -USING: tools.test math kernel sequences lists promises monads ; +USING: tools.test math math.functions kernel sequences lists +promises monads ; FROM: monads => do ; IN: monads.tests @@ -113,6 +114,22 @@ LAZY: nats-from ( n -- list ) run-writer ] unit-test +{ + T{ writer + { value 1.618033988749895 } + { log + "Started with five, took square root, added one, divided by two." + } + } +} [ + { + [ 5 "Started with five, " ] + [ sqrt "took square root, " ] + [ 1 + "added one, " ] + [ 2 / "divided by two." ] + } do +] unit-test + { T{ identity f 7 } } [ 4 identity-monad return