Author: yamakenz
Date: Sun Apr  6 09:08:30 2008
New Revision: 5378

Added:
  sigscheme-trunk/test/test-fail.scm
Modified:
  sigscheme-trunk/lib/unittest.scm
  sigscheme-trunk/test/Makefile.am
  sigscheme-trunk/test/test-sscm-ext.scm

Log:
* This commit fix the bogus result of 'make check' which passes everytime even
 if some tests are failed

* lib/unittest.scm
 - (test-display-result): New procedure which binds to the identical
   code of previous test-report-result implementation
- (test-report-result): Add explicit exit which returns EX_SOFTWARE on a
   failure, to fix the bogus result of 'make check'
* test/test-fail.scm
 - New file
* test/Makefile.am
 - (sscm_tests, sscm_xfail_tests): Add test-fail.scm

* test/test-sscm-ext.scm
 - Fix expected sscm-version


Modified: sigscheme-trunk/lib/unittest.scm
==============================================================================
--- sigscheme-trunk/lib/unittest.scm    (original)
+++ sigscheme-trunk/lib/unittest.scm    Sun Apr  6 09:08:30 2008
@@ -53,7 +53,7 @@
(define *total-errors* 0) ;; TODO: recover unintended error and increment this
(define test-filename "unspecified")

-(define test-report-result
+(define test-display-result
  (lambda ()
    (let ((header (if (zero? *total-failures*)
                      "OK: "
@@ -68,6 +68,15 @@
                 *total-failures*   " failures, "
                 *total-errors*     " errors"))
      (newline))))
+
+(define test-report-result
+  (lambda ()
+    (test-display-result)
+    (let ((EX_OK       0)
+          (EX_SOFTWARE 70))
+      (exit (if (positive? *total-failures*)
+                EX_SOFTWARE
+                EX_OK)))))

;; Backward compatibility
(define total-report test-report-result)

Modified: sigscheme-trunk/test/Makefile.am
==============================================================================
--- sigscheme-trunk/test/Makefile.am    (original)
+++ sigscheme-trunk/test/Makefile.am    Sun Apr  6 09:08:30 2008
@@ -2,7 +2,7 @@
EXTRA_DIST = unittest-bigloo.scm unittest-gauche.scm \
             run-singletest.sh.in

-sscm_xfail_tests =
+sscm_xfail_tests = test-fail.scm
sscm_optional_tests =
# Native tests of SigScheme
sscm_tests = \
@@ -21,6 +21,7 @@
        test-eqv.scm \
        test-equal.scm \
        test-eval.scm \
+        test-fail.scm \
        test-formal-syntax.scm \
        test-formatplus.scm \
        test-lambda.scm \

Added: sigscheme-trunk/test/test-fail.scm
==============================================================================
--- (empty file)
+++ sigscheme-trunk/test/test-fail.scm  Sun Apr  6 09:08:30 2008
@@ -0,0 +1,39 @@
+;;  Filename : test-fail.scm
+;;  About    : unit tests for unconditional failure
+;;
+;;  Copyright (c) 2008 SigScheme Project <uim-en AT googlegroups.com>
+;;
+;;  All rights reserved.
+;;
+;;  Redistribution and use in source and binary forms, with or without
+;;  modification, are permitted provided that the following conditions
+;;  are met:
+;;
+;;  1. Redistributions of source code must retain the above copyright
+;;     notice, this list of conditions and the following disclaimer.
+;;  2. Redistributions in binary form must reproduce the above copyright
+;;     notice, this list of conditions and the following disclaimer in the
+;;     documentation and/or other materials provided with the distribution.
+;;  3. Neither the name of authors nor the names of its contributors
+;;     may be used to endorse or promote products derived from this software
+;;     without specific prior written permission.
+;;
+;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS +;; IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+;;  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+;;  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+;;  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+;;  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+;;  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+;;  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+(require-extension (unittest))
+
+(test-begin "unconditional failure")
+(test-true #f)
+(test-end)
+
+(test-report-result)

Modified: sigscheme-trunk/test/test-sscm-ext.scm
==============================================================================
--- sigscheme-trunk/test/test-sscm-ext.scm      (original)
+++ sigscheme-trunk/test/test-sscm-ext.scm      Sun Apr  6 09:08:30 2008
@@ -43,7 +43,7 @@
(define ud (undef))

(tn "sscm-version")
-(assert-equal? (tn) "0.8.0"      (sscm-version))
+(assert-equal? (tn) "0.8.1"      (sscm-version))

(tn "%%current-char-codec")
(assert-equal? (tn) "UTF-8"      (%%current-char-codec))

Reply via email to