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
682 B
Racket

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