mirror of
https://github.com/kanaka/mal.git
synced 2024-08-16 17:20:23 +03:00
tests: non alphanumeric characters in input
Make: remove part of EVAL breaking # and $ step0: no MAL character must break the interpreter (soft) no printable ASCII character either step1: no MAL character must break strings (soft) no printable ASCII character should break strings (soft) no character should break comments step6: redo step1 tests for comments inside read-string, as new problem may occur with line breaks and escape characters of the host language.
This commit is contained in:
parent
520c71f752
commit
3b797cd5ec
@ -11,8 +11,7 @@ $(call READLINE)
|
||||
endef
|
||||
|
||||
define EVAL
|
||||
$(if $(READLINE_EOF),,\
|
||||
$(if $(findstring =,$(1)),$(eval $(1))$($(word 1,$(1))),$(eval __return := $(1))$(__return)))
|
||||
$(if $(READLINE_EOF),,$(1))
|
||||
endef
|
||||
|
||||
define PRINT
|
||||
|
@ -15,3 +15,52 @@ hello mal world
|
||||
hello world abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 (;:() []{}"'* ;:() []{}"'* ;:() []{}"'*)
|
||||
;=>hello world abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 (;:() []{}"'* ;:() []{}"'* ;:() []{}"'*)
|
||||
|
||||
;; Non alphanumeric characters
|
||||
!
|
||||
;=>!
|
||||
&
|
||||
;=>&
|
||||
+
|
||||
;=>+
|
||||
,
|
||||
;=>,
|
||||
-
|
||||
;=>-
|
||||
/
|
||||
;=>/
|
||||
<
|
||||
;=><
|
||||
=
|
||||
;=>=
|
||||
>
|
||||
;=>>
|
||||
?
|
||||
;=>?
|
||||
@
|
||||
;=>@
|
||||
;;; Behaviour of backslash is not specified enough to test anything in step0.
|
||||
^
|
||||
;=>^
|
||||
_
|
||||
;=>_
|
||||
`
|
||||
;=>`
|
||||
~
|
||||
;=>~
|
||||
|
||||
;>>> soft=True
|
||||
;>>> optional=True
|
||||
;; ------- Optional Functionality --------------
|
||||
;; ------- (Not needed for self-hosting) -------
|
||||
|
||||
;; Non alphanumeric characters
|
||||
#
|
||||
;=>#
|
||||
$
|
||||
;=>$
|
||||
%
|
||||
;=>%
|
||||
.
|
||||
;=>.
|
||||
|
|
||||
;=>|
|
||||
|
@ -80,10 +80,54 @@ false
|
||||
;=>"abc (with parens)"
|
||||
"abc\"def"
|
||||
;=>"abc\"def"
|
||||
;;;"abc\ndef"
|
||||
;;;;=>"abc\ndef"
|
||||
""
|
||||
;=>""
|
||||
"&"
|
||||
;=>"&"
|
||||
"'"
|
||||
;=>"'"
|
||||
"("
|
||||
;=>"("
|
||||
")"
|
||||
;=>")"
|
||||
"*"
|
||||
;=>"*"
|
||||
"+"
|
||||
;=>"+"
|
||||
","
|
||||
;=>","
|
||||
"-"
|
||||
;=>"-"
|
||||
":"
|
||||
;=>":"
|
||||
";"
|
||||
;=>";"
|
||||
"<"
|
||||
;=>"<"
|
||||
"="
|
||||
;=>"="
|
||||
">"
|
||||
;=>">"
|
||||
"?"
|
||||
;=>"?"
|
||||
"@"
|
||||
;=>"@"
|
||||
"["
|
||||
;=>"["
|
||||
"]"
|
||||
;=>"]"
|
||||
"^"
|
||||
;=>"^"
|
||||
"_"
|
||||
;=>"_"
|
||||
"`"
|
||||
;=>"`"
|
||||
"{"
|
||||
;=>"{"
|
||||
"}"
|
||||
;=>"}"
|
||||
"~"
|
||||
;=>"~"
|
||||
|
||||
;; Testing reader errors
|
||||
(1 2
|
||||
@ -183,3 +227,54 @@ false
|
||||
;; Testing read of @/deref
|
||||
@a
|
||||
;=>(deref a)
|
||||
|
||||
;>>> soft=True
|
||||
|
||||
;; 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
|
||||
"!"
|
||||
;=>"!"
|
||||
;; io fails this one
|
||||
"/"
|
||||
;=>"/"
|
||||
|
@ -145,3 +145,30 @@ mymap
|
||||
;=>true
|
||||
*ARGV*
|
||||
;=>()
|
||||
|
||||
;>>> soft=True
|
||||
|
||||
;; Non alphanumeric characters in comments in read-string
|
||||
(read-string "1;!")
|
||||
;=>1
|
||||
(read-string "1;\"")
|
||||
;=>1
|
||||
(read-string "1;#")
|
||||
;=>1
|
||||
(read-string "1;$")
|
||||
;=>1
|
||||
(read-string "1;%")
|
||||
;=>1
|
||||
(read-string "1;'")
|
||||
;=>1
|
||||
(read-string "1;\\")
|
||||
;=>1
|
||||
(read-string "1;\\\\")
|
||||
;=>1
|
||||
(read-string "1;\\\\\\")
|
||||
;=>1
|
||||
(read-string "1;`")
|
||||
;=>1
|
||||
;;; Hopefully less problematic characters can be checked together
|
||||
(read-string "1; &()*+,-./:;<=>?@[]^_{|}~")
|
||||
;=>1
|
||||
|
Loading…
Reference in New Issue
Block a user