Skip to content

Commit

Permalink
Add method value tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmonettas committed Mar 20, 2024
1 parent 08f476a commit 16bf4f0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/clojure/test_clojure/storm_bodies.clj
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,25 @@
[:fn-return "ctor@@" ""]]
(u/capture)) "captured traces should match.")))

(deftest method-value-test
(let [r (b/method-value)]
(is (= r [4 2]) "function return should be right.")
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.bodies" "method-value" [] -277140200]
[:bind "parser" "#object[...]" "3"]
[:expr-exec "#object[...]" "3,2,1"]
[:fn-call "clojure.test-clojure.storm-test-code.bodies" "method-value/invoke--Integer-parseInt--GEN-ID" ["4"] -277140200]
[:bind "arg1" "4" ""]
[:expr-exec 4 "3,1,1"]
[:fn-return 4 "3,1,1"]
[:fn-call "clojure.test-clojure.storm-test-code.bodies" "method-value/invoke--Integer-parseInt--GEN-ID" ["2"] -277140200]
[:bind "arg1" "2" ""]
[:expr-exec 2 "3,1,1"]
[:fn-return 2 "3,1,1"]
[:expr-exec [4 2] "3,2"]
[:expr-exec [4 2] "3"]
[:fn-return [4 2] ""]]
(u/capture)) "captured traces should match.")))

;; (deftest interop-test
;; (let [r (b/interopter #js {:num 2 :f (fn f [x] x)})]
;; (is (= 42 r) "function return should be right.")
Expand Down
4 changes: 4 additions & 0 deletions test/clojure/test_clojure/storm_test_code/bodies.clj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
(str (String. "ctor")
(^[byte*] String/new (byte-array [64 64]))))

(defn method-value []
(let [parser ^[String] Integer/parseInt]
(mapv parser ["4" "2"])))

(defn interopter [o]
;; TODO
)

0 comments on commit 16bf4f0

Please sign in to comment.