From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?ISO-8859-1?Q?J=E9r=E9my?= Korwin-Zmijowski Newsgroups: gmane.lisp.guile.user,gmane.lisp.scheme.srfi.srfi-64 Subject: test-equal: actual returned value is #f when tested expression raises execption Date: Sat, 20 Feb 2021 12:03:21 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36553"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 To: srfi-64@srfi.schemers.org, Mailing list Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Feb 20 12:03:41 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lDQ33-0009Nm-5c for guile-user@m.gmane-mx.org; Sat, 20 Feb 2021 12:03:41 +0100 Original-Received: from localhost ([::1]:59106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lDQ32-00080g-82 for guile-user@m.gmane-mx.org; Sat, 20 Feb 2021 06:03:40 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lDQ2q-00080Z-Va for guile-user@gnu.org; Sat, 20 Feb 2021 06:03:28 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:48913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lDQ2o-0004e8-RT for guile-user@gnu.org; Sat, 20 Feb 2021 06:03:28 -0500 Original-Received: from [192.168.1.3] (91-169-127-99.subs.proxad.net [91.169.127.99]) (Authenticated sender: jeremy@korwin-zmijowski.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 41F3F240002; Sat, 20 Feb 2021 11:03:22 +0000 (UTC) Received-SPF: none client-ip=217.70.178.230; envelope-from=jeremy@korwin-zmijowski.fr; helo=relay10.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17282 gmane.lisp.scheme.srfi.srfi-64:69 Archived-At: Dear Schemers, As a Guile user, I rely mostly on srfi-64 to write tests. Recently, a Guile fellow pointed out a strange behavior from one of my code : Say I write a test suite : ;; char-sets-test.scm (use-modules (srfi srfi-64) (char-sets)) (test-begin "harness-char-sets") (test-equal "empty password is not valid" #f (password-valid? "")) (test-end "harness-char-sets") Running `guile -L . char-sets-test.scm` in the file location will produce the following output : $ guile -L . char-sets-test.scm ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /tmp/char-sets-test.scm ;;; WARNING: compilation of /tmp/char-sets-test.scm failed: ;;; no code for module (char-sets) Backtrace: 9 (primitive-load "/tmp/char-sets-test.scm") In ice-9/eval.scm: 721:20 8 (primitive-eval (use-modules (srfi srfi-64) (char- sets))) In ice-9/psyntax.scm: 1241:36 7 (expand-top-sequence ((use-modules (srfi srfi-64) (#))) …) 1233:19 6 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …) 285:10 5 (parse _ (("placeholder" placeholder)) (()) _ c&e (eval) …) In ice-9/boot-9.scm: 3898:20 4 (process-use-modules _) 222:29 3 (map1 (((srfi srfi-64)) ((char-sets)))) 222:17 2 (map1 (((char-sets)))) 3899:31 1 (_ ((char-sets))) 3300:6 0 (resolve-interface (char-sets) #:select _ #:hide _ # _ # …) ice-9/boot-9.scm:3300:6: In procedure resolve-interface: no code for module (char-sets) All good so far. Then I create the `(char-sets)` module in a file next to the test file : ;; char-sets.scm (define-module (char-sets)) And now, I rerun the tests : $ guile -L . char-sets-test.scm ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /tmp/char-sets-test.scm ;;; compiling ./char-sets.scm ;;; compiled /home/jeko/.cache/guile/ccache/3.0-LE-8-4.4/tmp/char- sets.scm.go ;;; char-sets-test.scm:10:2: warning: possibly unbound variable `password-valid?' ;;; compiled /home/jeko/.cache/guile/ccache/3.0-LE-8-4.4/tmp/char-sets- test.scm.go %%%% Starting test harness-char-sets (Writing full log to "harness- char-sets.log") # of expected passes 1 Here, the result of the test feel weird to me. As the tested procedure is not defined I was expecting the test to fail. Is there a way to get a failing test in such situation ? I fear to miss things like those and so build non working softwares. Cheers, Jérémy