Skip to content

Test fns not special forms #713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions impls/tests/step6_file.mal
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,23 @@
(let* (b 12) (do (eval (read-string "(def! aa 7)")) aa ))
;=>7

;;
;; Testing for core fns instead of special forms
(let* [x read-string] (x "(+ 2 3)"))
;=>(+ 2 3)
(let* [x slurp] (x "../tests/test.txt"))
;=>"A line of text\n"
(let* [x atom] (x 7))
;=>(atom 7)
(let* [x atom?] (x (atom 1)))
;=>true
(let* [x deref] (x (atom 7)))
;=>7
(let* [x reset!] (x (atom 7) 8))
;=>8
(let* [x swap!] (x (atom 6) (fn* (y) (+ y 1))))
;=>7

;>>> soft=True
;>>> optional=True
;;
Expand Down
10 changes: 10 additions & 0 deletions impls/tests/step7_quote.mal
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ b
(concat [1 2])
;=>(1 2)

;; Testing for core fns instead of special forms
(let* [x cons] (x 1 '(2 3)))
;=>(1 2 3)
(let* [x concat] (x '(1) '(2)))
;=>(1 2)

;>>> optional=True
;;
;; -------- Optional Functionality --------
Expand Down Expand Up @@ -294,3 +300,7 @@ a
;/EVAL: \(cons 1 \(concat c \(cons 3 \(\)\)\)\).*\n\(1 1 "b" "d" 3\)
(let* (DEBUG-EVAL true) `[])
;/EVAL: \(vec \(\)\).*\n\[\]

;; Testing for core fn instead of special-form
(let* [a vec] (a '(1 2 3)))
;=>[1 2 3]
Loading