forked from pixie-lang/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-docs.pxi
More file actions
24 lines (20 loc) · 769 Bytes
/
Copy pathtest-docs.pxi
File metadata and controls
24 lines (20 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(ns pixie.tests.test-docs
(require pixie.test :as t))
; validate the examples in the docs by checking whether the included
; results match the actual results you get by evaluating the examples.
(defn check-examples [ns]
(let [ns (the-ns ns)
syms (keys (ns-map ns))]
(doseq [sym syms]
(let [meta (meta @(resolve-in ns sym))
examples (get meta :examples)]
(doseq [example examples]
(if (contains? example 2)
(t/assert= (eval (read-string (first example)))
(third example))
(eval (read-string (first example)))))))))
(t/deftest test-stdlib-docs
(check-examples 'pixie.stdlib))
(t/deftest test-string-docs
(load-ns 'pixie.string)
(check-examples 'pixie.string))