diff --git a/README.md b/README.md index 1106358..06a691f 100644 --- a/README.md +++ b/README.md @@ -155,9 +155,9 @@ dev=> (mount/stop) dev=> (mount/start) ``` -This can be easily hooked up to [tools.namespace](https://github.com/clojure/tools.namespace), to make the whole -application reloadable with refreshing the app namespaces. Here is a [dev.clj](https://github.com/tolitius/mount/blob/master/dev/dev.clj) as -an example, that sums up to: +While it is not always necessary, mount lificycle can be easily hooked up to [tools.namespace](https://github.com/clojure/tools.namespace), +to make the whole application reloadable with refreshing the app namespaces. +Here is a [dev.clj](https://github.com/tolitius/mount/blob/master/dev/dev.clj) as an example, that sums up to: ```clojure (defn go [] diff --git a/src/mount/mount.clj b/src/mount/mount.clj index 57a4c06..1ab46f5 100644 --- a/src/mount/mount.clj +++ b/src/mount/mount.clj @@ -54,9 +54,9 @@ (when stop (try (stop) - (intern ns (symbol name) (NotStartedState. name)) (catch Throwable t (throw (RuntimeException. (str "could not stop [" name "] due to") t))))) + (intern ns (symbol name) (NotStartedState. name)) ;; (!) if a state does not have :stop when _should_ this might leak (alter-meta! var assoc :started? false))) ;;TODO args might need more thinking diff --git a/test/check/start_with_test.clj b/test/check/start_with_test.clj index 7fa8b85..a62846d 100644 --- a/test/check/start_with_test.clj +++ b/test/check/start_with_test.clj @@ -25,4 +25,16 @@ (is (map? app-config)) (is (instance? clojure.tools.nrepl.server.Server nrepl)) (is (instance? datomic.peer.LocalConnection conn)) + (is (= test-conn 42)) + (is (vector? test-nrepl)) + (mount/stop))) + + (testing "should start-without normally after start-with" + (let [_ (m/start-without #'check.start-with-test/test-conn + #'check.start-with-test/test-nrepl)] + (is (map? app-config)) + (is (instance? clojure.tools.nrepl.server.Server nrepl)) + (is (instance? datomic.peer.LocalConnection conn)) + (is (instance? mount.NotStartedState test-conn)) + (is (instance? mount.NotStartedState test-nrepl)) (mount/stop))))