Skip to content

Commit

Permalink
allow symbolic arguments with oapply (close #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed May 11, 2018
1 parent 5114888 commit bc27497
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/oops/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
(def ocall-api (o-api ocall-args))
(def gcall-api (g-api ocall-args))

(def oapply-args [:selector (s/+ anything?) :args sequential?])
(def oapply-args [:selector (s/+ anything?) :args anything?])
(def oapply-api (o-api oapply-args))
(def gapply-api (g-api oapply-args))

Expand Down
4 changes: 4 additions & 0 deletions test/src/tests/oops/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@
(is (= (oapply obj (identity "f") []) "ROOT!"))
(is (= (oapply obj (identity "a.f") []) "A!"))
(is (= (oapply obj (identity "b.a.f") []) "BA!"))))
(testing "test oapply with symbolic args (issue 18)"
(let [obj #js {"f" str}
args [1 2 3]]
(is (= (oapply obj "f" args) "123"))))
(testing "test errors when oapplying to non-functions"
(when-not-advanced-mode
(presume-compiler-config {:runtime-expected-function-value :error})
Expand Down

0 comments on commit bc27497

Please sign in to comment.