You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
beautiful-racket/beautiful-racket-demo/jsonic-demo-2/parser-test.rkt

26 lines
666 B
Racket

#lang br
(require "parser.rkt" "tokenizer.rkt" brag/support rackunit)
(check-equal?
(parse-tree
(apply-tokenizer-maker make-tokenizer "// line commment\n"))
'(jsonic-program))
(check-equal?
(parse-tree
(apply-tokenizer-maker make-tokenizer "@$ 42 $@"))
'(jsonic-program (jsonic-sexp " 42 ")))
(check-equal?
(parse-tree
(apply-tokenizer-maker make-tokenizer "hi"))
'(jsonic-program
(jsonic-char "h")
(jsonic-char "i")))
(check-equal?
(parse-tree
(apply-tokenizer-maker make-tokenizer
"hi\n// comment\n@$ 42 $@"))
'(jsonic-program
(jsonic-char "h")
(jsonic-char "i")
(jsonic-char "\n")
(jsonic-sexp " 42 ")))