Add syntax lens tests
This commit is contained in:
parent
888924b1f3
commit
9d6716c8fe
|
@ -1,6 +1,8 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
|
|
||||||
(require syntax/parse
|
(require syntax/parse
|
||||||
|
rackunit
|
||||||
|
"core.rkt"
|
||||||
(for-syntax racket/syntax
|
(for-syntax racket/syntax
|
||||||
syntax/stx
|
syntax/stx
|
||||||
syntax/parse))
|
syntax/parse))
|
||||||
|
@ -17,6 +19,13 @@
|
||||||
[parse-pattern
|
[parse-pattern
|
||||||
(values #'target rebuilder)]))]))
|
(values #'target rebuilder)]))]))
|
||||||
|
|
||||||
|
(module+ test
|
||||||
|
(define stx-lens (syntax-lens A (_ _ (_ _ A _ _) _ ...)))
|
||||||
|
(define stx #'(a b (1 2 3 4 5) c d e f))
|
||||||
|
(check-equal? (syntax->datum (lens-view stx-lens stx)) 3)
|
||||||
|
(define stx2 (lens-set stx-lens stx #'FOO))
|
||||||
|
(check-equal? (syntax->datum stx2) '(a b (1 2 FOO 4 5) c d e f)))
|
||||||
|
|
||||||
(begin-for-syntax
|
(begin-for-syntax
|
||||||
|
|
||||||
(define (target-stx target-id)
|
(define (target-stx target-id)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user