1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00
mal/impls/common-lisp/tests/stepA_mal.mal
Joel Martin 8a19f60386 Move implementations into impls/ dir
- Reorder README to have implementation list after "learning tool"
  bullet.

- This also moves tests/ and libs/ into impls. It would be preferrable
  to have these directories at the top level.  However, this causes
  difficulties with the wasm implementations which need pre-open
  directories and have trouble with paths starting with "../../". So
  in lieu of that, symlink those directories to the top-level.

- Move the run_argv_test.sh script into the tests directory for
  general hygiene.
2020-02-10 23:50:16 -06:00

62 lines
989 B
Plaintext

;; Testing clisp interop
(cl-eval "42")
;=>42
(cl-eval "(+ 1 1)")
;=>2
(cl-eval "(setq foo 1 bar 2 baz 3)")
(cl-eval "(list foo bar baz)")
;=>(1 2 3)
(cl-eval "7")
;=>7
;;
;; Testing boolean flag
(cl-eval "(= 123 123)" true)
;=>true
(cl-eval "(= 123 456)")
;=>nil
(cl-eval "(= 123 456)" true)
;=>false
;;
;; Testing list flag
(cl-eval "(last nil)" false true)
;=>()
(cl-eval "nil" false true)
;=>()
(cl-eval "nil")
;=>nil
;;
;; Testing creation of Common Lisp Objects
(cl-eval "#(1 2)")
;=>[1 2]
;;; Not testing with elements since order in hashtable cannot be guaranteed
(cl-eval "(make-hash-table)")
;=>{}
(cl-eval "(defun redundant-identity (x) x)"))
;=>REDUNDANT-IDENTITY
(cl-eval "(redundant-identity 2)"))
;=>2
(cl-eval "(defun range (max &key (min 0) (step 1)) (loop for n from min below max by step collect n))")
;=>RANGE
(cl-eval "(range 10 :min 0 :step 1)")
;=>(0 1 2 3 4 5 6 7 8 9)
(cl-eval "(mapcar #'1+ (range 10 :min 0 :step 1))")
;=>(1 2 3 4 5 6 7 8 9 10)