From bc274979ca86856192ba12caac573d9588190430 Mon Sep 17 00:00:00 2001 From: Antonin Hildebrand Date: Fri, 11 May 2018 11:49:16 +0200 Subject: [PATCH] allow symbolic arguments with oapply (close #18) --- src/lib/oops/core.clj | 2 +- test/src/tests/oops/main.cljs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/oops/core.clj b/src/lib/oops/core.clj index 312fa60..28c4f19 100644 --- a/src/lib/oops/core.clj +++ b/src/lib/oops/core.clj @@ -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)) diff --git a/test/src/tests/oops/main.cljs b/test/src/tests/oops/main.cljs index b4fa581..7e10231 100644 --- a/test/src/tests/oops/main.cljs +++ b/test/src/tests/oops/main.cljs @@ -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})