From 542a8c2106dd8a7e05a1aefe7fc2149bc6b165c3 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 1 Apr 2017 15:06:07 +0200 Subject: [PATCH] test: Add nyacc cpp match tests; two fail. * tests/match.test ("match nyacc 0", "match nyacc 1"): New tests. ("match nyacc simple", "match nyacc tkl0"): New tests; FAIL with Mes. (report): Set failure expectation to 2 for Mes. * HACKING: Add to bugs. --- HACKING | 1 + tests/match.test | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/HACKING b/HACKING index 6cd6b1cb..8b7e0f29 100644 --- a/HACKING +++ b/HACKING @@ -73,6 +73,7 @@ syntax-case]] with R7RS ellipsis, [[http://www.nongnu.org/nyacc/][Nyacc]] and [[ time to start doing something useful. * Bugs +** test/match.test ("nyacc-simple"): hygiene problem in match ** The Scheme reader is very slow. ** Fluids are a hack for Nyacc. ** Prototype mes.c depends on a C compiler. diff --git a/tests/match.test b/tests/match.test index 8250ed03..d1b7c872 100755 --- a/tests/match.test +++ b/tests/match.test @@ -88,5 +88,30 @@ exit $? (_ "no match: (1 2)")) '(1 2))) -(result 'report) +(pass-if-equal "match nyacc 0" + '(rest) + (match '(first rest) + ((first . rest) + rest))) +(pass-if-equal "match nyacc 1" + '(#\. rest) + (match '(first #\. rest) + (('first . rest) + rest))) + +(let ((tkl0-simple '((ident . type) rest))) + (pass-if-equal "match nyacc simple" + (cons (cdar tkl0-simple) (cdr tkl0-simple)) + (match tkl0-simple + ((('ident . val) . rest) + (cons val rest))))) + +(let ((tkl0 '((ident . "type") #\. #\] (arg . "0") #\[ (ident . "g_cells")))) + (pass-if-equal "match nyacc tkl0" + (cdr tkl0) + (match tkl0 + ((('ident . val) . rest) + rest)))) + +(result 'report (if mes? 2 0))