From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id zHJXGqhwV2QSKAAASxT56A (envelope-from ) for ; Sun, 07 May 2023 11:34:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 2Lo/GahwV2SZxwAAauVa8A (envelope-from ) for ; Sun, 07 May 2023 11:34:32 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0376694DA for ; Sun, 7 May 2023 11:34:32 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvalw-0001Tm-Np; Sun, 07 May 2023 05:33:40 -0400 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 1pvalv-0001TY-6U for emacs-orgmode@gnu.org; Sun, 07 May 2023 05:33:39 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pvalt-00022Q-5I for emacs-orgmode@gnu.org; Sun, 07 May 2023 05:33:38 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 854d38dc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 7 May 2023 09:33:33 +0000 (UTC) References: <6416d214.5d0a0220.d9c1.54aa@mx.google.com> <875yaxvy93.fsf@localhost> <6416e4d9.df0a0220.ce03d.5c4b@mx.google.com> <87h6udozvh.fsf@localhost> <87r0texwor.fsf@localhost> <641ec686.050a0220.16dbc.a6ca@mx.google.com> <87fs9rvpyj.fsf@localhost> <6457663a.df0a0220.f6b38.a05e@mx.google.com> User-agent: mu4e 1.11.3; emacs 30.0.50 To: Bruno Barbier Cc: Ihor Radchenko , emacs-orgmode@gnu.org Subject: Re: [PATCH] Add tests for ob-haskell (GHCi) Date: Sun, 07 May 2023 17:18:15 +0800 In-reply-to: <6457663a.df0a0220.f6b38.a05e@mx.google.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Ruijie Yu From: Ruijie Yu via "General discussions about Org-mode." Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683452072; a=rsa-sha256; cv=none; b=WdKZ+z5EkS0lb9rOYMgd48THGvNQY+c5iAOjtjgaiVi+znWNR+Q5sqzdY4/rUsbL/xuEO5 8IRqIpGuGg5GJ2w/BkR3Qo8xRuM9gZbvJVf+cO1preuena4wQ6Sgveuz48otz7UPDjgkUM 9dgvFwWTQ8oXUEesS31zEcGg1x2An/c4OUMAGrQL3RIy8M/eKVua0srbzC10BXZ+IQCon7 m8+wcOvZLmjsBTcgq2gXbk28FmL3T7avv6LjlmHWSOwLlPOeGJzL+bKempiZIi8Afxgpf8 kzasVVbK26I6m75rKBSEhgtCnzo/h9wtETqB5yL76s4nTgItCSSZDWRe0ctz8g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683452072; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=q87drg4LSHMdA9KuEJD8eyJEwIV6EhDfc8ZcAQKfZ6M=; b=hNIMeIJCR3R/rkmWWx2NBzeowx1BhlWH8GoGavnm2N9KryVDBO8JcEb8rGAKz0dVEYNt0y o8Y5mZ0mMFUnJIXp64VW0qLH1VLmZSmKGhpEE3N+phccdNHSWqSgUmuKxOHwAh329TmvyP IWC0b4PreWkiXMV7H0OE16txgHTyDdF3v1uMfkyizJ9P3gE1ts19H1xSQJVbubeCNvl5vv OlQqzGICMPcnKXoBi+J+o3UF3BxaKl4vhClnRY17aPBBu/3IcTJH4wU/meJW2dMZcGEz1t 8GJruW8esbKWGEKRYy3Lmx4fFyD/rbhICQ3Q6qZPzB5phyD3kQ1rG1WdBQTyMg== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.99 X-Spam-Score: -1.99 X-Migadu-Queue-Id: 0376694DA X-TUID: CoOSzlmXeaIA Minor remarks below regarding the patchset. Bruno Barbier writes: > From 9ef867cd2cf89e77b5c5a5a7090fd37b1702e06a Mon Sep 17 00:00:00 2001 > From: Bruno BARBIER > Date: Fri, 18 Nov 2022 20:14:20 +0100 > Subject: [PATCH 01/13] ob-haskell: Add tests for GHCi > > testing/lisp/test-ob-haskell-ghci.el: New file. > --- > testing/lisp/test-ob-haskell-ghci.el | 453 +++++++++++++++++++++++++++ > 1 file changed, 453 insertions(+) > create mode 100644 testing/lisp/test-ob-haskell-ghci.el > > diff --git a/testing/lisp/test-ob-haskell-ghci.el b/testing/lisp/test-ob-haskell-ghci.el > new file mode 100644 > index 000000000..aba94d73f > --- /dev/null > +++ b/testing/lisp/test-ob-haskell-ghci.el > @@ -0,0 +1,453 @@ > +;;; test-ob-haskell-ghci.el --- tests for ob-haskell.el GHCi -*- lexical-binding: t; -*- > + > +;; Copyright (c) 2023 Free Software Foundation, Inc. lisp/org.el has only a single space, so probably single space here as well. > + > +;; Authors: Bruno BARBIER > + > +;; This program is free software; you can redistribute it and/or modify > +;; it under the terms of the GNU General Public License as published by > +;; the Free Software Foundation, either version 3 of the License, or > +;; (at your option) any later version. Do we need the text for "part of GNU Emacs"? > + > +;; This program is distributed in the hope that it will be useful, > +;; but WITHOUT ANY WARRANTY; without even the implied warranty of > +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +;; GNU General Public License for more details. > + > +;; You should have received a copy of the GNU General Public License > +;; along with this program. If not, see . > + > +;;; Commentary: > +;; > + > +;;;; Useful references > +;; > +;; - https://orgmode.org/worg/org-contrib/babel/languages/lang-compat.html > +;; - GHCi manual: https://downloads.haskell.org/ghc/latest/docs/users_guide/ghci.html > +;;;; FIXME: Random failures > +;; > +;; To increase the chances of failure when running tests, you can use this command line: > +;; > +;; (for I in 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10; do make 'BTEST_OB_LANGUAGES=haskell' BTEST_RE='haskell' test-dirty & done) 2>&1 | grep FAILED > +;; Wanted to say something here, but then realized that you deleted this portion in a later commit. > + > +;;;; Status > +;; > +;; All the tests should succeed (except for random failures); those > +;; flagged with ":expected-result :failed" are known > +;; limitations/bugs. Tested with (2023-03-18): > +;; > +;; | emacs-version | 29.0.60 | > +;; | org-version | main@4cad6c8ea (Mar 16 2023) | > +;; | haskell-mode | master@20d4e23 (Mar 4 2023) | > +;; | ghci | 9.0.2 | > + > + > +;;; Code: > +;; > + > +(require 'org-test "../testing/org-test") > +(org-test-for-executable "ghci") > +(unless (featurep 'haskell-mode) > + (signal 'missing-test-dependency "haskell-mode")) > + > + > +;;; Helpers > +;; > + > +(defun test-ob-haskell-ghci--with-global-session-worker (todo) > + "See `test-ob-haskell-ghci--with-global-session-worker'." This docstring doesn't say much and only refers to itself. Maybe explain what it does? (Or now that I look at it, potentially you wanted to refer to the macro `test-ob-haskell-ghci-with-global-session' instead.) > +(defun test-ob-haskell-ghci (args content &optional preamble unprotected) > + "Execute the code block CONTENT in a new GHCi session; return the result. > +Add ARGS to the code block argument line. Insert PREAMBLE > +before the code block. When UNPROTECTED is non-nil, don't control > +which session is used (i.e. don't call > +`test-ob-haskell-ghci--with-global-session-worker')." > + (when (listp content) > + (setq content (string-join content "\n"))) > + (unless preamble > + (setq preamble "")) > + (let ((todo (lambda () One space. > +;;;; Data tables > +;; > + > +(ert-deftest ob-haskell/int-table-data () > + "From worg: int-table-data." > + (should (equal 10 (test-ob-haskell-ghci ":var t=int-table-data" > + "sum [sum r | r <- t]" > + "#+name: int-table-data > + | 1 | 2 | > + | 3 | 4 |")))) > + > +(ert-deftest ob-haskell/float-table-data () > + "From worg: float-table-data." > + (should (equal 11.0 (test-ob-haskell-ghci ":var t=float-table-data" > + "sum [sum r | r <- t]" > + "#+name: float-table-data > + | 1.1 | 2.2 | > + | 3.3 | 4.4 |")))) > + > +(ert-deftest ob-haskell/string-table-data () > + "From worg: string-table-data." > + (should (equal "abcd" (test-ob-haskell-ghci ":var t=string-table-data" > + "concat [concat r | r <- t]" > + "#+name: string-table-data > + | a | b | > + | c | d |")))) > + > +;;;; Reuse results > +;; > +(ert-deftest ob-haskell/reuse-table () > + "Reusing a computed tables." > + (should (equal 78 (test-ob-haskell-ghci ":var t=a-table" > + "sum [sum r | r <- t]" > + "#+name: a-table > +#+begin_src haskell > + [ [x..x+2] | x <- [1,4 .. 12] ] > +#+end_src > +")))) > + > + > +;;;; Not define errors > +;; Single space? -- Best, RY