Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwparas committed Dec 29, 2024
1 parent 880fc6c commit e43ca92
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
19 changes: 14 additions & 5 deletions crates/steel-core/src/scheme/stdlib.scm
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,25 @@

[(quasisyntax #%internal-crunch (#%unsyntax x)) x]

[(quasisyntax #%internal-crunch ((#%unsyntax-splicing x))) (append x '())]
[(quasisyntax #%internal-crunch ((#%unsyntax-splicing x)))
(#%syntax/raw (quote x) (append (syntax-e x) '()) (#%syntax-span x))]

[(quasisyntax #%internal-crunch ((#%unsyntax-splicing x) xs ...))
(append x (quasisyntax #%internal-crunch (xs ...)))]
(#%syntax/raw (quote (xs ...))
(append (syntax-e x) (syntax-e (quasisyntax #%internal-crunch (xs ...))))
(#%syntax-span (xs ...)))]

;; TODO: Do unquote-splicing as well, follow the same rules as unquote
[(quasisyntax #%internal-crunch ((unsyntax-splicing x)))
(append (list (list 'unsyntax-splicing (quasisyntax #%internal-crunch x))) '())]
(#%syntax/raw (quote '())
(append (list (list 'unsyntax-splicing (quasisyntax #%internal-crunch x))) '())
(#%syntax-span x))]

[(quasisyntax #%internal-crunch ((unsyntax-splicing x) xs ...))
(append (list (list 'unsyntax-splicing (quasisyntax #%internal-crunch x)))
(quasisyntax #%internal-crunch (xs ...)))]
(#%syntax/raw (quote xs ...)
(append (list (list 'unsyntax-splicing (quasisyntax #%internal-crunch x)))
(syntax-e (quasisyntax #%internal-crunch (xs ...))))
(#%syntax-span (xs ...)))]

[(quasisyntax #%internal-crunch ()) (#%syntax/raw '() '() '(0 0 0))]
[(quasisyntax #%internal-crunch (x xs ...))
Expand Down
5 changes: 5 additions & 0 deletions crates/steel-core/src/tests/success/syntax_case.scm
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@
#`(list name place #,foo #,bar baz)))]))

(assert! (equal? (hello 500 1000) '(500 1000 10 20 10)))

(define test #`(40 50 60))
(define res #`(list 10 20 30 #,@test))

(assert! (equal? (map syntax-e (syntax-e res)) '(list 10 20 30 40 50 60)))

0 comments on commit e43ca92

Please sign in to comment.