mirror of
https://github.com/teo3300/rust-mal.git
synced 2026-01-12 01:05:32 +01:00
Adding atom tests and makefile
This commit is contained in:
@ -4,3 +4,16 @@
|
||||
|
||||
; deref
|
||||
(assert-eq (deref (atom 1)) 1)
|
||||
|
||||
; @ macro
|
||||
(assert-eq @(atom 1) 1)
|
||||
|
||||
(def! ATOM (atom 1))
|
||||
|
||||
; reset!
|
||||
(reset! ATOM 2)
|
||||
(assert-eq @ATOM 2)
|
||||
|
||||
; swap!
|
||||
(swap! ATOM (fn* [x] (* x 2)))
|
||||
(assert-eq @ATOM 4)
|
||||
|
||||
Reference in New Issue
Block a user