From c8d4b3633a2de972bb59e0e866b4b676481865ed Mon Sep 17 00:00:00 2001 From: David Chelimsky Date: Thu, 16 Jan 2020 14:59:16 -0600 Subject: [PATCH 1/2] make `return` constructable/def'able - aligns with other primitives --- src/state_flow/state.clj | 2 +- test/state_flow/state_test.clj | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/state_flow/state.clj b/src/state_flow/state.clj index 1410ba8..012017a 100644 --- a/src/state_flow/state.clj +++ b/src/state_flow/state.clj @@ -81,7 +81,7 @@ (defn return "Returns the equivalent of (fn [state] [v, state])" [v] - (m/return v)) + (m/return error-context v)) (defn ^:deprecated swap "DEPRECATED: use modify" diff --git a/test/state_flow/state_test.clj b/test/state_flow/state_test.clj index 1899e8d..ba0fbb3 100644 --- a/test/state_flow/state_test.clj +++ b/test/state_flow/state_test.clj @@ -6,6 +6,12 @@ [state-flow.state :as state])) (deftest state + (testing "primitives are constructable outside monad context" + (state/get) + (state/gets inc) + (state/modify inc) + (state/return 37) + (state/put {:count 0})) (let [increment-state (m/mlet [x (state/get) _ (state/put (inc x))] (m/return x)) From 205c824e1ca6dbec395c81b098e7e144b443d844 Mon Sep 17 00:00:00 2001 From: David Chelimsky Date: Mon, 20 Jan 2020 13:30:17 -0600 Subject: [PATCH 2/2] bump version and amend changelog --- CHANGELOG.md | 4 +++- project.clj | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06f0a22..78bf985 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog -## [DEV] +## [2.1.5] + +- Make `state-flow.state/return` constructable/def'able outside monadic context. ## [2.1.4] diff --git a/project.clj b/project.clj index 6de1fea..c82226e 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject nubank/state-flow "2.1.4" +(defproject nubank/state-flow "2.1.5" :description "Postman-like integration testing with composable flows" :url "https://github.com/nubank/state-flow" :license {:name "MIT"}