~subsetpark/fugue

ref: 55567281ae3786cb21665af0b586b998374f7cea fugue/test/namespaces.janet -rw-r--r-- 905 bytes
55567281 — Zach Smith fix #14 - eval symbol when processing match a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(use testament)
(import /fugue)

(import /test-support/a)
(import /test-support/b)

(deftest multiple-file-multi-extend
  (is (= 11 (a/f 10))))

(deftest namespaced-allocations
  (let [a-b (:new b/B)]
    (fugue/allocate a-b :base-attr "base")
    (fugue/allocate a-b :child-attr "child")
    (is (= (a/A :base-attr) "base"))
    (is (= (a-b :base-attr) "base"))

    (is (= (b/B :child-attr) "child"))
    (is (= (a-b :child-attr) "child"))))

(deftest overlapping-defmultis
  (is (= "ok!" (a/g "ok")))
  # g was defined for strings in a, but not b.
  (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")))))

(deftest match-with-prefix
  (let [an-a (:new a/A)]
    (is (= true (fugue/match an-a
                             (@ a/A {}) true)))))

(run-tests!)