mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 13:55:55 +03:00
tests/step8: remove and
macro tests, add ->> macro tests
1. `gensym` isn't yet available in step8 2. `and` tests are very slow in some implementations 3. ->> macro is more complex 4. moved core.mal to the end so it won't override the builtin `or` macro
This commit is contained in:
parent
542e1d3c22
commit
a193b2c470
@ -92,39 +92,6 @@ x
|
||||
(cond false 7 false 8 false 9)
|
||||
;=>nil
|
||||
|
||||
;;
|
||||
;; Loading core.mal
|
||||
(load-file "../core.mal")
|
||||
|
||||
;; Testing and macro
|
||||
(and)
|
||||
;=>true
|
||||
(and 1)
|
||||
;=>1
|
||||
(and 1 2)
|
||||
;=>2
|
||||
(and 1 2 3)
|
||||
;=>3
|
||||
(and 1 2 3 4)
|
||||
;=>4
|
||||
(and 1 2 3 4 false)
|
||||
;=>false
|
||||
(and 1 2 3 4 false 5)
|
||||
;=>false
|
||||
|
||||
;; Testing -> macro
|
||||
|
||||
(-> 7)
|
||||
;=>7
|
||||
(-> (list 7 8 9) first)
|
||||
;=>7
|
||||
(-> (list 7 8 9) (first))
|
||||
;=>7
|
||||
(-> (list 7 8 9) first (+ 7))
|
||||
;=>14
|
||||
(-> (list 7 8 9) rest (rest) first (+ 7))
|
||||
;=>16
|
||||
|
||||
;; Testing EVAL in let*
|
||||
|
||||
(let* (x (or nil "yes")) x)
|
||||
@ -162,6 +129,30 @@ x
|
||||
(let* [x (or nil "yes")] x)
|
||||
;=>"yes"
|
||||
|
||||
;;
|
||||
;; Loading core.mal
|
||||
(load-file "../core.mal")
|
||||
|
||||
;; Testing -> macro
|
||||
(-> 7)
|
||||
;=>7
|
||||
(-> (list 7 8 9) first)
|
||||
;=>7
|
||||
(-> (list 7 8 9) (first))
|
||||
;=>7
|
||||
(-> (list 7 8 9) first (+ 7))
|
||||
;=>14
|
||||
(-> (list 7 8 9) rest (rest) first (+ 7))
|
||||
;=>16
|
||||
|
||||
;; Testing ->> macro
|
||||
(->> "L")
|
||||
;=>"L"
|
||||
(->> "L" (str "A") (str "M"))
|
||||
;=>"MAL"
|
||||
(->> [4] (concat [3]) (concat [2]) rest (concat [1]))
|
||||
;=>(1 3 4)
|
||||
|
||||
;;
|
||||
;; ------- Mostly broken (move up when fixed) --------------
|
||||
;>>> soft=True
|
||||
|
Loading…
Reference in New Issue
Block a user