From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Faiz Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] test-suite: Add tests for `for-rdelim-in-port`-related functions. Date: Tue, 17 Dec 2024 12:31:23 +0800 Message-ID: <8e113f49-c1dc-313b-e65a-24a73c5b887a@disroot.org> References: <43ad0b39-03cf-b648-3bc9-8c4a064519a8@disroot.org> 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="12018"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ricardo Wurmus , Tomas Volf <~@wolfsden.cz>, Maxime Devos , Nala Ginrut , mikael@djurfeldt.com To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Tue Dec 17 05:32:16 2024 Return-path: Envelope-to: guile-devel@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 1tNPFo-00031U-4p for guile-devel@m.gmane-mx.org; Tue, 17 Dec 2024 05:32:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNPFT-0008I5-8N; Mon, 16 Dec 2024 23:31:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNPFQ-0008HW-Eg for guile-devel@gnu.org; Mon, 16 Dec 2024 23:31:52 -0500 Original-Received: from layka.disroot.org ([178.21.23.139]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNPFL-0007uc-Ki for guile-devel@gnu.org; Mon, 16 Dec 2024 23:31:52 -0500 Original-Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id E2F6324DFC; Tue, 17 Dec 2024 05:31:41 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Original-Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id IBRAhPm0VFAw; Tue, 17 Dec 2024 05:31:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1734409893; bh=8+iGVUcSCG4kzrumVIimHEyjwnRUXKiB3T+LlwRifPk=; h=Date:Subject:From:To:Cc:References:In-Reply-To; b=eG8HA2q90hVx6ZPhMAJH3lKriNJRbezH+Q2npaIAA0y9XnGS4J1MQg1QOZAqs4PKX X7gMumZoNZiGr9yKvSg+QeztnQtL3w0IxHJwrYRgk6RAZW2pG/PTzgoni1Q9uxuHdu 4P7FXsGFuaixwj09MOwIy1jsKbr1Z4mkGUMtuaWmTJuQ9HNYhzVH0FGqujr1XgHjci 59eCoJla90wKdHfcGtYdp49x748mwXHF+tLDgALNlJty/lZr9WytTWbkz/M177/4zW 4+q4B/U8gZ8swxiiBASPdrOQiYNJMffIRYQAm14sOxAxQJ+/uXX8aeE6B/PNWlT7RZ sVotxuW3A2e6g== Content-Language: en-US In-Reply-To: <43ad0b39-03cf-b648-3bc9-8c4a064519a8@disroot.org> Received-SPF: pass client-ip=178.21.23.139; envelope-from=adam.faiz@disroot.org; helo=layka.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22835 Archived-At: >From 258d20a9665e6f845a167258c33374a00e734885 Mon Sep 17 00:00:00 2001 From: AwesomeAdam54321 Date: Tue, 17 Dec 2024 12:20:52 +0800 Subject: [PATCH] test-suite: Add tests for `for-rdelim-in-port`-related functions. * test-suite/tests/ports.test: Add test cases for `for-delimited-in-port` and `for-line-in-file`. --- test-suite/tests/ports.test | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test index bec5e356c..15d515f1f 100644 --- a/test-suite/tests/ports.test +++ b/test-suite/tests/ports.test @@ -2089,6 +2089,28 @@ (not (string-index (%search-load-path (basename (test-file))) #\\)))))) +(let ((lst '()) + (lines '()) + (string "line1\nline2\nline3") + (filename (test-file))) + (call-with-input-string + "A\0B\0C" + (lambda (port) + (pass-if "for-delimited-in-port returns true upon completion" + (for-delimited-in-port port + (lambda (entry) + (set! lst (cons entry lst))) + #:delims "\0") + (equal? lst '("C" "B" "A"))))) + (let ((port (open-output-file filename))) + (display string port) + (close-port port)) + (pass-if "for-line-in-file returns true upon completion" + (for-line-in-file filename + (lambda (line) + (set! lines (cons line lines)))) + (equal? lines '("line3" "line2" "line1")))) + (delete-file (test-file)) ;;; Local Variables: -- 2.46.0