;;; TODO: really a step5 test
|
|
;;
|
|
;; Testing that (do (do)) not broken by TCO
|
|
(do (do 1 2))
|
|
;=>2
|
|
|
|
;;
|
|
;; Testing read-string, eval and slurp
|
|
(read-string "(1 2 (3 4) nil)")
|
|
;=>(1 2 (3 4) nil)
|
|
|
|
(read-string "(+ 2 3)")
|
|
;=>(+ 2 3)
|
|
|
|
(read-string "7 ;; comment")
|
|
;=>7
|
|
|
|
;;; Differing output, but make sure no fatal error
|
|
(read-string ";; comment")
|
|
|
|
|
|
(eval (read-string "(+ 2 3)"))
|
|
;=>5
|
|
|
|
;;; TODO: fix newline matching so that this works
|
|
;;;(slurp "../tests/test.txt")
|
|
;;;;=>"A line of text\n"
|
|
|
|
|
|
;; Testing load-file
|
|
|
|
(load-file "../tests/inc.mal")
|
|
(inc1 7)
|
|
;=>8
|
|
(inc2 7)
|
|
;=>9
|
|
(inc3 9)
|
|
;=>12
|
|
|
|
;;
|
|
;; Testing that *ARGV* exists and is an empty list
|
|
(list? *ARGV*)
|
|
;=>true
|
|
*ARGV*
|
|
;=>()
|
|
|
|
;;
|
|
;; -------- Optional Functionality --------
|
|
|
|
;; Testing comments in a file
|
|
(load-file "../tests/incB.mal")
|
|
; "incB.mal finished"
|
|
;=>"incB.mal return string"
|
|
(inc4 7)
|
|
;=>11
|
|
(inc5 7)
|
|
;=>12
|
|
|
|
;; Testing map literal across multiple lines in a file
|
|
(load-file "../tests/incC.mal")
|
|
mymap
|
|
;=>{"a" 1}
|
|
|
|
;;; TODO: really a step5 test
|
|
;; Testing that vector params not broken by TCO
|
|
(def! g (fn* [] 78))
|
|
(g)
|
|
;=>78
|
|
(def! g (fn* [a] (+ a 78)))
|
|
(g 3)
|
|
;=>81
|
|
|