make, swift3: fix parsing empty literal sequences.
[jackhill/mal.git] / common-lisp / tests / stepA_mal.mal
1 ;; Testing clisp interop
2
3 (cl-eval "42")
4 ;=>42
5
6 (cl-eval "(+ 1 1)")
7 ;=>2
8
9 (cl-eval "(setq foo 1 bar 2 baz 3)")
10
11 (cl-eval "(list foo bar baz)")
12 ;=>(1 2 3)
13
14 (cl-eval "7")
15 ;=>7
16
17 ;;
18 ;; Testing boolean flag
19 (cl-eval "(= 123 123)" true)
20 ;=>true
21
22 (cl-eval "(= 123 456)")
23 ;=>nil
24
25 (cl-eval "(= 123 456)" true)
26 ;=>false
27
28 ;;
29 ;; Testing list flag
30 (cl-eval "(last nil)" false true)
31 ;=>()
32
33 (cl-eval "nil" false true)
34 ;=>()
35
36 (cl-eval "nil")
37 ;=>nil
38
39 ;;
40 ;; Testing creation of Common Lisp Objects
41 (cl-eval "#(1 2)")
42 ;=>[1 2]
43
44 ;;; Not testing with elements since order in hashtable cannot be guaranteed
45 (cl-eval "(make-hash-table)")
46 ;=>{}
47
48 (cl-eval "(defun redundant-identity (x) x)"))
49 ;=>REDUNDANT-IDENTITY
50
51 (cl-eval "(redundant-identity 2)"))
52 ;=>2
53
54 (cl-eval "(defun range (max &key (min 0) (step 1)) (loop for n from min below max by step collect n))")
55 ;=>RANGE
56
57 (cl-eval "(range 10 :min 0 :step 1)")
58 ;=>(0 1 2 3 4 5 6 7 8 9)
59
60 (cl-eval "(mapcar #'1+ (range 10 :min 0 :step 1))")
61 ;=>(1 2 3 4 5 6 7 8 9 10)