2 ;;; See IMPL/tests/stepA_mal.mal for implementation specific
9 (readline "mal-user> ")
14 ;; Testing *host-language*
15 ;;; each impl is different, but this should return false
16 ;;; rather than throwing an exception
17 (= "something bogus" *host-language*)
22 ;; ------- Optional Functionality ----------
23 ;; ------- (Needed for self-hosting) -------
26 ;; Testing metadata on functions
29 ;; Testing metadata on mal functions
34 (meta (with-meta (fn* (a) a) {"b" 1}))
37 (meta (with-meta (fn* (a) a) "abc"))
40 (def! l-wm (with-meta (fn* (a) a) {"b" 2}))
44 (meta (with-meta l-wm {"new_meta" 123}))
49 (def! f-wm (with-meta (fn* [a] (+ 1 a)) {"abc" 1}))
53 (meta (with-meta f-wm {"new_meta" 123}))
58 (def! f-wm2 ^{"abc" 1} (fn* [a] (+ 1 a)))
62 ;; Meta of native functions should return nil (not fail)
68 ;; Make sure closures and metadata co-exist
69 (def! gen-plusX (fn* (x) (with-meta (fn* (b) (+ x b)) {"meta" 1})))
70 (def! plus7 (gen-plusX 7))
71 (def! plus8 (gen-plusX 8))
78 (meta (with-meta plus7 {"meta" 2}))
84 ;; Testing hash-map evaluation and atoms (i.e. an env)
85 (def! e (atom {"+" +}))
91 (swap! e assoc "foo" (list))
94 (swap! e assoc "bar" '(1 2 3))
100 ;; ------- Optional Functionality --------------
101 ;; ------- (Not needed for self-hosting) -------
105 ;; Testing string? function
114 (string? (keyword "abc"))
123 ;; Testing conj function
130 (conj (list 2 3) 4 5 6)
132 (conj (list 1) (list 2 3))
147 ;; Testing seq function
150 (apply str (seq "this is a test"))
167 ;; Testing metadata on collections
172 (with-meta [1 2 3] {"a" 1})
175 (meta (with-meta [1 2 3] {"a" 1}))
178 (vector? (with-meta [1 2 3] {"a" 1}))
181 (meta (with-meta [1 2 3] "abc"))
184 (meta (with-meta (list 1 2 3) {"a" 1}))
187 (list? (with-meta (list 1 2 3) {"a" 1}))
190 (meta (with-meta {"abc" 123} {"a" 1}))
193 (map? (with-meta {"abc" 123} {"a" 1}))
196 ;;; Not actually supported by Clojure
197 ;;;(meta (with-meta (atom 7) {"a" 1}))
200 (def! l-wm (with-meta [4 5 6] {"b" 2}))
205 (meta (with-meta l-wm {"new_meta" 123}))
211 ;; Testing metadata on builtin functions
214 (def! f-wm3 ^{"def" 2} +)
221 ;; Testing gensym and clean or macro
222 (= (gensym) (gensym))
224 (let* [or_FIXME 23] (or false (+ or_FIXME 100)))