factor/extra/lisp/parser/parser-tests.factor

38 lines
910 B
Factor
Raw Normal View History

2008-04-27 23:12:18 -04:00
! Copyright (C) 2008 James Cash
! See http://factorcode.org/license.txt for BSD license.
2008-04-29 23:10:47 -04:00
USING: lisp.parser tools.test peg peg.ebnf ;
2008-04-27 23:12:18 -04:00
IN: lisp.parser.tests
{ 1234 } [
"1234" "atom" \ lisp-expr rule parse parse-result-ast
] unit-test
{ 123.98 } [
"123.98" "atom" \ lisp-expr rule parse parse-result-ast
] unit-test
2008-04-29 23:10:47 -04:00
{ "" } [
"\"\"" "atom" \ lisp-expr rule parse parse-result-ast
] unit-test
2008-04-27 23:12:18 -04:00
{ "aoeu" } [
"\"aoeu\"" "atom" \ lisp-expr rule parse parse-result-ast
] unit-test
{ "aoeu\"de" } [
"\"aoeu\\\"de\"" "atom" \ lisp-expr rule parse parse-result-ast
] unit-test
{ T{ lisp-symbol f "foobar" } } [
"foobar" "atom" \ lisp-expr rule parse parse-result-ast
] unit-test
{ T{ lisp-symbol f "+" } } [
"+" "atom" \ lisp-expr rule parse parse-result-ast
] unit-test
{ T{ s-exp f
V{ T{ lisp-symbol f "foo" } 1 2 "aoeu" } } } [
2008-04-29 23:10:47 -04:00
"(foo 1 2 \"aoeu\")" lisp-expr parse-result-ast
2008-04-27 23:12:18 -04:00
] unit-test