From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: srfi-64 tests passing when they should not Date: Tue, 4 May 2021 08:31:38 +0000 Message-ID: <40a496bb-c005-3c6f-2bf2-7025f3a234bb@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5611"; mail-complaints-to="usenet@ciao.gmane.io" To: Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue May 04 10:43:03 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 1ldqdz-0001NQ-Bz for guile-user@m.gmane-mx.org; Tue, 04 May 2021 10:43:03 +0200 Original-Received: from localhost ([::1]:56446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldqdy-0004nu-FV for guile-user@m.gmane-mx.org; Tue, 04 May 2021 04:43:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldqTD-0004T5-2Z for guile-user@gnu.org; Tue, 04 May 2021 04:31:55 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:37063) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldqT3-0001TC-Bq for guile-user@gnu.org; Tue, 04 May 2021 04:31:54 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 50B0F240026 for ; Tue, 4 May 2021 10:31:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1620117100; bh=rSRd24wT2qjXIA37JXv27+UnUrKAeZUTR6cStydhzvI=; h=To:From:Subject:Date:From; b=jkR0u9Grz6CDPf9Ip0wIvU5HyEOUpa30PQqx8qhV+KQ6LmpY5XoTquzn7L7JZPvOO T090AzEpcAVbgon6bM7O6gHzA0wvc1LcApdbX0Wo40Tl68xhB3kPqPbZyIS8wFJWFf QmInix+C+GkJeCIy2MelkF9PmznCT0e5YZjncnSePtA/UQp7SNTUnYKkDsptfm3KBY WJNEeS0GmnNhZnbv0Dh/+nqJPYdIBEFIMaRkWFZN2RCzYbQxhgNynnFtl3uI32n11X tH5PY7bd0nziSgeaYGz2p7dqRc1XcIgqB67epb34lWoy0DuyB4sOzpEpLM8p1Sk2kg bYPIhpq35+Erg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FZCk34pkCz9rxm for ; Tue, 4 May 2021 10:31:39 +0200 (CEST) Content-Language: en-US Received-SPF: pass client-ip=185.67.36.65; envelope-from=zelphirkaltstahl@posteo.de; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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:17509 Archived-At: Hello Guile users! I noticed something strange about SRFI-64 unit tests, when using test-equal with an expected result of false (#f): ~~~~ (import ;; unit tests (srfi srfi-64) ;; module to test (list-utils)) (test-begin "list-utils-test") (test-group "list-prefixes-test" (test-equal "gives all list prefixes -- 00" '(("static") ("static" "img")) (list-prefixes '("static" "img" "logo.png"))) (test-equal "gives false for one element lists -- 00" #f (list-prefixes '("static"))) (test-assert "gives false for zero element lists -- 00" (equal? #f (list-prefixes '())))) (test-end "list-utils-test") ~~~~ This code is for a still empty module (not even a module defined in that (list-utils) file. So I expect all tests to fail, due to the error of unbound variables. However, the result is surprisingly 2 passing tests, despite errors happening during the test: ~~~~ %%%% Starting test list-utils-test Group begin: list-utils-test Group begin: list-prefixes-test Test begin: test-name: "gives all list prefixes -- 00" source-file: "test/test-list-utils.scm" source-line: 13 source-form: (test-equal "gives all list prefixes -- 00" (quote (("static") ("static" "img"))) (list-prefixes (quote ("static" "img" "logo.png")))) Test end: result-kind: fail actual-value: #f actual-error: (unbound-variable #f "Unbound variable: ~S" (list-prefixes) #f) expected-value: (("static") ("static" "img")) Test begin: test-name: "gives false for one element lists -- 00" source-file: "test/test-list-utils.scm" source-line: 17 source-form: (test-equal "gives false for one element lists -- 00" #f (list-prefixes (quote ("static")))) Test end: result-kind: pass actual-value: #f actual-error: (unbound-variable #f "Unbound variable: ~S" (list-prefixes) #f) expected-value: #f Test begin: test-name: "gives false for zero element lists -- 00" source-file: "test/test-list-utils.scm" source-line: 21 source-form: (test-equal "gives false for zero element lists -- 00" #f (list-prefixes (quote ()))) Test end: result-kind: pass actual-value: #f actual-error: (unbound-variable #f "Unbound variable: ~S" (list-prefixes) #f) expected-value: #f Group end: list-prefixes-test Group end: list-utils-test # of expected passes 2 # of unexpected failures 1 ~~~~ The first 2 tests are surprisingly passing. This is also the reason, why I used test-assert and manually wrote the (equal? ...) in the last test, to see, whether it makes any difference. Indeed it does. Why does die implementation behave like this? Best regards, Zelphir -- repositories: https://notabug.org/ZelphirKaltstahl