mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 13:55:55 +03:00
Add a regression run to Travis that enables hard deferrables but omits optionals so that we can test to make sure that all the requirements are met for self-hosting in stepA. Cleanup up some of the soft/deferrable/optional markings. Deferrables are what will be needed eventually to self host but aren't needed for the immediate next steps. Optional aren't even needed for self-hosting but are nice things to have. Also: - Sync dart step9 and stepA with step8. Do not eval macroexpanded forms in macroexpand form. - Fix stepA of factor which was missing some fixes from step9. - Increase test timeouts in top-level Makefile for guile and io.
279 lines
3.1 KiB
Plaintext
279 lines
3.1 KiB
Plaintext
;; Testing read of numbers
|
|
1
|
|
;=>1
|
|
7
|
|
;=>7
|
|
7
|
|
;=>7
|
|
-123
|
|
;=>-123
|
|
|
|
|
|
;; Testing read of symbols
|
|
+
|
|
;=>+
|
|
abc
|
|
;=>abc
|
|
abc
|
|
;=>abc
|
|
abc5
|
|
;=>abc5
|
|
abc-def
|
|
;=>abc-def
|
|
|
|
;; Testing non-numbers starting with a dash.
|
|
-
|
|
;=>-
|
|
-abc
|
|
;=>-abc
|
|
->>
|
|
;=>->>
|
|
|
|
;; Testing read of lists
|
|
(+ 1 2)
|
|
;=>(+ 1 2)
|
|
()
|
|
;=>()
|
|
( )
|
|
;=>()
|
|
(nil)
|
|
;=>(nil)
|
|
((3 4))
|
|
;=>((3 4))
|
|
(+ 1 (+ 2 3))
|
|
;=>(+ 1 (+ 2 3))
|
|
( + 1 (+ 2 3 ) )
|
|
;=>(+ 1 (+ 2 3))
|
|
(* 1 2)
|
|
;=>(* 1 2)
|
|
(** 1 2)
|
|
;=>(** 1 2)
|
|
(* -3 6)
|
|
;=>(* -3 6)
|
|
(()())
|
|
;=>(() ())
|
|
|
|
;; Test commas as whitespace
|
|
(1 2, 3,,,,),,
|
|
;=>(1 2 3)
|
|
|
|
|
|
;>>> deferrable=True
|
|
|
|
;;
|
|
;; -------- Deferrable Functionality --------
|
|
|
|
;; Testing read of nil/true/false
|
|
nil
|
|
;=>nil
|
|
true
|
|
;=>true
|
|
false
|
|
;=>false
|
|
|
|
;; Testing read of strings
|
|
"abc"
|
|
;=>"abc"
|
|
"abc"
|
|
;=>"abc"
|
|
"abc (with parens)"
|
|
;=>"abc (with parens)"
|
|
"abc\"def"
|
|
;=>"abc\"def"
|
|
""
|
|
;=>""
|
|
"&"
|
|
;=>"&"
|
|
"'"
|
|
;=>"'"
|
|
"("
|
|
;=>"("
|
|
")"
|
|
;=>")"
|
|
"*"
|
|
;=>"*"
|
|
"+"
|
|
;=>"+"
|
|
","
|
|
;=>","
|
|
"-"
|
|
;=>"-"
|
|
"/"
|
|
;=>"/"
|
|
":"
|
|
;=>":"
|
|
";"
|
|
;=>";"
|
|
"<"
|
|
;=>"<"
|
|
"="
|
|
;=>"="
|
|
">"
|
|
;=>">"
|
|
"?"
|
|
;=>"?"
|
|
"@"
|
|
;=>"@"
|
|
"["
|
|
;=>"["
|
|
"]"
|
|
;=>"]"
|
|
"^"
|
|
;=>"^"
|
|
"_"
|
|
;=>"_"
|
|
"`"
|
|
;=>"`"
|
|
"{"
|
|
;=>"{"
|
|
"}"
|
|
;=>"}"
|
|
"~"
|
|
;=>"~"
|
|
|
|
;; Testing reader errors
|
|
(1 2
|
|
;/.*(EOF|end of input|unbalanced).*
|
|
[1 2
|
|
;/.*(EOF|end of input|unbalanced).*
|
|
|
|
;;; These should throw some error with no return value
|
|
"abc
|
|
;/.*(EOF|end of input|unbalanced).*
|
|
(1 "abc
|
|
;/.*(EOF|end of input|unbalanced).*
|
|
(1 "abc"
|
|
;/.*(EOF|end of input|unbalanced).*
|
|
|
|
;; Testing read of quoting
|
|
'1
|
|
;=>(quote 1)
|
|
'(1 2 3)
|
|
;=>(quote (1 2 3))
|
|
`1
|
|
;=>(quasiquote 1)
|
|
`(1 2 3)
|
|
;=>(quasiquote (1 2 3))
|
|
~1
|
|
;=>(unquote 1)
|
|
~(1 2 3)
|
|
;=>(unquote (1 2 3))
|
|
`(1 ~a 3)
|
|
;=>(quasiquote (1 (unquote a) 3))
|
|
~@(1 2 3)
|
|
;=>(splice-unquote (1 2 3))
|
|
|
|
|
|
;; Testing keywords
|
|
:kw
|
|
;=>:kw
|
|
(:kw1 :kw2 :kw3)
|
|
;=>(:kw1 :kw2 :kw3)
|
|
|
|
;; Testing read of vectors
|
|
[+ 1 2]
|
|
;=>[+ 1 2]
|
|
[]
|
|
;=>[]
|
|
[ ]
|
|
;=>[]
|
|
[[3 4]]
|
|
;=>[[3 4]]
|
|
[+ 1 [+ 2 3]]
|
|
;=>[+ 1 [+ 2 3]]
|
|
[ + 1 [+ 2 3 ] ]
|
|
;=>[+ 1 [+ 2 3]]
|
|
([])
|
|
;=>([])
|
|
|
|
;; Testing read of hash maps
|
|
{}
|
|
;=>{}
|
|
{ }
|
|
;=>{}
|
|
{"abc" 1}
|
|
;=>{"abc" 1}
|
|
{"a" {"b" 2}}
|
|
;=>{"a" {"b" 2}}
|
|
{"a" {"b" {"c" 3}}}
|
|
;=>{"a" {"b" {"c" 3}}}
|
|
{ "a" {"b" { "cde" 3 } }}
|
|
;=>{"a" {"b" {"cde" 3}}}
|
|
;;; The regexp sorcery here ensures that each key goes with the correct
|
|
;;; value and that each key appears only once.
|
|
{"a1" 1 "a2" 2 "a3" 3}
|
|
;/{"a([1-3])" \1 "a(?!\1)([1-3])" \2 "a(?!\1)(?!\2)([1-3])" \3}
|
|
{ :a {:b { :cde 3 } }}
|
|
;=>{:a {:b {:cde 3}}}
|
|
{"1" 1}
|
|
;=>{"1" 1}
|
|
({})
|
|
;=>({})
|
|
|
|
;; Testing read of comments
|
|
;; whole line comment (not an exception)
|
|
1 ; comment after expression
|
|
;=>1
|
|
1; comment after expression
|
|
;=>1
|
|
|
|
;; Testing read of @/deref
|
|
@a
|
|
;=>(deref a)
|
|
|
|
;>>> soft=True
|
|
;>>> optional=True
|
|
;;
|
|
;; -------- Optional Functionality --------
|
|
|
|
;; Testing read of ^/metadata
|
|
^{"a" 1} [1 2 3]
|
|
;=>(with-meta [1 2 3] {"a" 1})
|
|
|
|
|
|
;; Non alphanumerice characters in strings
|
|
;;; \t is not specified enough to be tested
|
|
"\n"
|
|
;=>"\n"
|
|
"#"
|
|
;=>"#"
|
|
"$"
|
|
;=>"$"
|
|
"%"
|
|
;=>"%"
|
|
"."
|
|
;=>"."
|
|
"\\"
|
|
;=>"\\"
|
|
"|"
|
|
;=>"|"
|
|
|
|
;; Non alphanumeric characters in comments
|
|
1;!
|
|
;=>1
|
|
1;"
|
|
;=>1
|
|
1;#
|
|
;=>1
|
|
1;$
|
|
;=>1
|
|
1;%
|
|
;=>1
|
|
1;'
|
|
;=>1
|
|
1;\
|
|
;=>1
|
|
1;\\
|
|
;=>1
|
|
1;\\\
|
|
;=>1
|
|
1;`
|
|
;=>1
|
|
;;; Hopefully less problematic characters
|
|
1; &()*+,-./:;<=>?@[]^_{|}~
|
|
|
|
;; FIXME: These tests have no reasons to be optional, but...
|
|
;; fantom fails this one
|
|
"!"
|
|
;=>"!"
|