From fc1a3952d755c49bb286775d0cdd0c104e6db8a9 Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Tue, 23 Jan 2024 22:00:24 +0100 Subject: [PATCH] update README + unit tests --- README.md | 3 ++- templates/README.md | 1 + tests/syntax.scm | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index af990698d..51ac70dde 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.18.1-blue.svg)](https://www.npmjs.com/package/@jcubic/lips) ![1.0.0 Complete](https://img.shields.io/github/milestones/progress-percent/jcubic/lips/1?label=1.0.0%20Complete) [![Build and test](https://github.com/jcubic/lips/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/lips/actions/workflows/build.yaml) -[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&4fdf5f77a5a79d8e12bad669d961d6ad)](https://coveralls.io/github/jcubic/lips?branch=devel) +[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&3df4b3c6d80e6b8ee8ccabd287057791)](https://coveralls.io/github/jcubic/lips?branch=devel) [![Join Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jcubic/lips) ![NPM Download Count](https://img.shields.io/npm/dm/@jcubic/lips) ![JSDelivr Download count](https://img.shields.io/jsdelivr/npm/hm/@jcubic/lips) @@ -246,6 +246,7 @@ The issue with performance is tracked in [#197](https://github.com/jcubic/lips/i | Running Scheme Scripts on Unix | [SRFI-22](https://srfi.schemers.org/srfi-22/) | | Error reporting mechanism | [SRFI-23](https://srfi.schemers.org/srfi-23/) | | Basic Syntax-rules Extensions | [SRFI-46](https://srfi.schemers.org/srfi-46/) | +| Custom macro transformers | [SRFI-147](https://srfi.schemers.org/srfi-147/)) | | Version flag | [SRFI-176](https://srfi.schemers.org/srfi-176/) | ### require `(load "./lib/srfi/.scm")` diff --git a/templates/README.md b/templates/README.md index bf4199109..a46e7e103 100644 --- a/templates/README.md +++ b/templates/README.md @@ -246,6 +246,7 @@ The issue with performance is tracked in [#197](https://github.com/jcubic/lips/i | Running Scheme Scripts on Unix | [SRFI-22](https://srfi.schemers.org/srfi-22/) | | Error reporting mechanism | [SRFI-23](https://srfi.schemers.org/srfi-23/) | | Basic Syntax-rules Extensions | [SRFI-46](https://srfi.schemers.org/srfi-46/) | +| Custom macro transformers | [SRFI-147](https://srfi.schemers.org/srfi-147/)) | | Version flag | [SRFI-176](https://srfi.schemers.org/srfi-176/) | ### require `(load "./lib/srfi/.scm")` diff --git a/tests/syntax.scm b/tests/syntax.scm index 6cd949950..03c2764ff 100644 --- a/tests/syntax.scm +++ b/tests/syntax.scm @@ -428,7 +428,7 @@ (t.is (join_2 (1 2 3) 4) '(1 2 3 4)) (t.is (to.throw (join_2 (1 2 3) 4 5)) #t))) -(test "syntax: double ellipsis" +(test "syntax: double ellipsis (SRFI-149)" (lambda (t) (define result (let-syntax @@ -439,7 +439,7 @@ (t.is result '(1 2 3 4 5 6)))) -(test.failing "syntax: lifted ellipsis" +(test.failing "syntax: lifted ellipsis (SRFI-149)" (lambda (t) (define result (let-syntax @@ -1170,3 +1170,20 @@ (t.is (call/mv string (values #\a #\b) (values #\c #\d)) (#\a #\b #\c #\d)))) + +(test "syntax: SRFI-147" + (lambda (t) + (define-syntax syntax-rules* + (syntax-rules () + ((syntax-rules* (literal ...) (pattern . templates) ...) + (syntax-rules (literal ...) (pattern (begin . templates)) ...)) + ((syntax-rules* ellipsis (literal ...) (pattern . templates) ...) + (syntax-rules ellipsis (literal ...) (pattern (begin . templates)) ...)))) + + (let-syntax ((foo + (syntax-rules* () + ((foo a b) + (define a 1) + (define b 2))))) + (foo x y) + (t.is (list x y) '(1 2)))))