test-suite: Add a nameless form of `pass-if-equal'.
authorLudovic Courtès <ludo@gnu.org>
Fri, 2 Nov 2012 22:29:43 +0000 (23:29 +0100)
committerLudovic Courtès <ludo@gnu.org>
Fri, 2 Nov 2012 22:43:45 +0000 (23:43 +0100)
* test-suite/test-suite/lib.scm (pass-if-equal): Add a nameless pattern.
* test-suite/tests/arrays.test ("array->list"): Use `pass-if-equal'.

test-suite/test-suite/lib.scm
test-suite/tests/arrays.test

index 756d97e..7517b4e 100644 (file)
 (define-syntax pass-if-equal
   (syntax-rules ()
     "Succeed if and only if BODY's return value is equal? to EXPECTED."
+    ((_ expected body)
+     (pass-if-equal 'body expected body))
     ((_ name expected body ...)
-     (run-test 'name #t
+     (run-test name #t
                (lambda ()
                  (let ((result (begin body ...)))
                    (or (equal? expected result)
index b6eee7c..cf09832 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; unif.test --- tests guile's uniform arrays     -*- scheme -*-
 ;;;;
-;;;; Copyright 2004, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
+;;;; Copyright 2004, 2006, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
 ;;;
 
 (with-test-prefix "array->list"
-  (pass-if (equal? (array->list #s16(1 2 3)) '(1 2 3)))
-  (pass-if (equal? (array->list #(1 2 3)) '(1 2 3)))
-  (pass-if (equal? (array->list #2((1 2) (3 4) (5 6))) '((1 2) (3 4) (5 6))))
-  (pass-if (equal? (array->list #()) '())))
+  (pass-if-equal '(1 2 3) (array->list #s16(1 2 3)))
+  (pass-if-equal '(1 2 3) (array->list #(1 2 3)))
+  (pass-if-equal '((1 2) (3 4) (5 6)) (array->list #2((1 2) (3 4) (5 6))))
+  (pass-if-equal '()  (array->list #())))
 
 
 ;;;