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:
13
Makefile
Normal file
13
Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
default: build-release
|
||||
|
||||
build-release:
|
||||
cargo build --release
|
||||
|
||||
test:
|
||||
cargo test --release
|
||||
|
||||
install: build-release
|
||||
mkdir -p ${HOME}/.config/mal
|
||||
cp -f core/core.mal ${HOME}/.config/mal/
|
||||
sudo cp target/release/rust-mal /usr/local/bin/mal
|
||||
sudo chown ${USER} /usr/local/bin/mal
|
||||
@ -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