racket/pkgs/racket-test/tests/stxparse/test-template-saved-props.rkt
Georges Dupéron bece3e13e2 Fixes several issues with syntax/parse, and adds some tests.
* byte-regexp? values should not be considered 3D syntax.
* hash? values are now allowed in serialized syntax properties with (template … #:properties (…))
* marshalling properties which were prefab structs called map on the result of struct->vector, changed it to struct->list as the struct "name" is always serializable.
2017-01-22 02:38:55 +01:00

24 lines
1.2 KiB
Racket

#lang racket
(require "test-template-save-props.rkt"
rackunit)
(define s (get-syntax-with-saved-props))
(check-equal? (syntax-property s 'null) '())
(check-equal? (syntax-property s 'string) "str")
(check-equal? (syntax-property s 'bytes) #"by")
(check-equal? (syntax-property s 'number) 123.4)
(check-equal? (syntax-property s 'boolean) #t)
(check-equal? (syntax-property s 'char) #\c)
(check-equal? (syntax-property s 'keyword) '#:kw)
(check-equal? (syntax-property s 'regexp) #rx".*")
(check-equal? (syntax-property s 'pregexp) #px".*")
(check-equal? (syntax-property s 'byte-regexp) #rx#".*")
(check-equal? (syntax-property s 'byte-pregexp) #px#".*")
(check-equal? (syntax-property s 'box) #&bx)
(check-equal? (syntax-property s 'symbol) 'sym)
(check-equal? (syntax-property s 'pair) '(a . b))
(check-equal? (syntax-property s 'vector) #(1 2 3))
(check-equal? (syntax-property s 'hash) #hash([a . 1] [b . 2]))
(check-equal? (syntax-property s 'hasheq) #hasheq([a . 1] [b . 2]))
(check-equal? (syntax-property s 'hasheqv) #hasheqv([a . 1] [b . 2]))
(check-equal? (syntax-property s 'prefab-st) #s(prefab-st x y z))
(check-equal? (syntax-property s 'st) #f) ; st is not serializable, should be #f