Commit fe751453 authored by Erick's avatar Erick

Bug fix in nested quasiquotes

parent b2297766
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
;;;;
;;;; do-test.stk -- The pilot of all tests
;;;;
;;;; Copyright © 2005-2009 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
;;;;
;;;;
;;;;
;;;; Copyright © 2005-2010 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2 of the License, or
;;;; (at your option) any later version.
;;;;
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;;; GNU General Public License for more details.
;;;;
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program; if not, write to the Free Software
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;;; USA.
;;;;
;;;;
;;;; Author: Erick Gallesio [eg@essi.fr]
;;;; Creation date: 3-May-2005 12:28 (eg)
;;;; Last file update: 3-Oct-2009 21:57 (eg)
;;;; Last file update: 23-Dec-2010 20:17 (eg)
;;;;
(load-path (cons "../lib"
......@@ -42,9 +42,10 @@
(load "test-box.stk")
(load "test-regexp.stk")
(load "test-ffi.stk")
(load "test-r5.stk")
(load "test-r5rs-pitfall.stk"))
(define (main _)
(test-init "TEST.LOG")
(load-tests)
......
;;;;
;;;; test-r5.stk -- Test various exemaples of R5RS
;;;;
;;;; Copyright © 2010 Erick Gallesio - Polytech'Nice-Sophia <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program; if not, write to the Free Software
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;;; USA.
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 23-Dec-2010 18:47 (eg)
;;;; Last file update: 23-Dec-2010 20:17 (eg)
;;;;
(require "test")
(test-section "Some R5RS Report examples")
;;------------------------------------------------------------------
(test-subsection "4.2.6 Quasiquotation")
(test "Quasiquote.1" '(list 3 4) `(list ,(+ 1 2) 4))
(test "Quasiquote.2" '(list a (quote a))
(let ((name 'a)) `(list ,name ',name)))
(test "Quasiquote.3" '(a 3 4 5 6 b)
`(a ,(+ 1 2) ,@(map abs '(4 -5 6)) b))
(test "Quasiquote.4" '((foo 7) . cons)
`(( foo ,(- 10 3)) ,@(cdr '(c)) . ,(car '(cons))))
(test "Quasiquote.5" '#(10 5 2 4 3 8)
`#(10 5 ,(sqrt 4) ,@(map sqrt '(16 9)) 8))
(test "Quasiquote.6" '(a `(b ,(+ 1 2) ,(foo 4 d) e) f)
`(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f))
(test "Quasiquote.7" '(a `(b ,x ,'y d) e)
(let ((name1 'x)
(name2 'y))
`(a `(b ,,name1 ,',name2 d) e)))
;;---- tests added for STklos
(test "Quasiquote.stklos.1"
'(quasiquote ((unquote-splicing (append (list 2 3) (list 5 7)))))
``(,@(append ,@'((list 2 3) (list 5 7)))))
;;------------------------------------------------------------------
(test-section-end)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment