Skip to content

Commit

Permalink
Merge pull request #162 from NoahTheDuke/nb/gh-161/fix-ipending-ideref
Browse files Browse the repository at this point in the history
Check for IDeref, not IPending in isJvmPromise?
  • Loading branch information
l3nz authored Aug 11, 2023
2 parents d80e7db + d449ceb commit ddbcad0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/cli_matic/platform.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"
(:require [clojure.edn :as edn]
[cli-matic.optionals :as OPT])
(:import (clojure.lang IPending)))
(:import (clojure.lang IDeref)))

(defn read-env
"Reads an environment variable.
Expand Down Expand Up @@ -82,7 +82,7 @@
(defn- isJvmPromise?
"Checks whether the value is a JVM promise."
[x]
(instance? IPending x))
(instance? IDeref x))

(defn isDeferredValue?
"Is this a deferred value for this platform?"
Expand Down
11 changes: 9 additions & 2 deletions test/cli_matic/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -709,5 +709,12 @@
:type :int}]
:runs cmd_foo}]))



(deftest ipending-is-not-ideref-test
(let [cmd (fn [& _] (lazy-seq (cons 1 ())))
setup {:command "ipending-example"
:opts []
:subcommands [{:command "foo"
:opts []
:runs cmd}]}]
(is (= (->RV 0 :OK nil [] [])
(run-cmd* setup ["foo"])))))

0 comments on commit ddbcad0

Please sign in to comment.