~subsetpark/fugue

82cfd207b35012d308e8fc89af9e29e95344438e — Zach Smith 13 days ago 3cf67c4
extend-multi namespaces test
3 files changed, 11 insertions(+), 0 deletions(-)

M test-support/a.janet
M test-support/b.janet
M test/namespaces.janet
M test-support/a.janet => test-support/a.janet +4 -0
@@ 5,3 5,7 @@
(defproto A nil base-attr {:allocation :prototype})

(defmulti g [:string] [s] (string s "!"))

(declare-open-multi h)
(extend-multi h [:number] [n] (inc n))
(extend-multi h [_] [v] v)

M test-support/b.janet => test-support/b.janet +2 -0
@@ 6,3 6,5 @@
(defproto B a/A child-attr {:allocation :prototype})

(defmulti g [:number] [n] (+ n 2))

(extend-multi a/h [B] [b] (b :name))

M test/namespaces.janet => test/namespaces.janet +5 -0
@@ 22,4 22,9 @@
  (is (thrown? (b/g "ok")))
  (is (= 12 (b/g 10))))

(deftest declare-open-with-fallback-in-first-module
  (is (= 2 (a/h 1)))
  (is (= :ok (a/h :ok)))
  (is (= "myname" (a/h (b/new-B :name "myname")))))

(run-tests!)