Minor remarks below regarding the patchset. Bruno Barbier <brubar...@gmail.com> writes:
> From 9ef867cd2cf89e77b5c5a5a7090fd37b1702e06a Mon Sep 17 00:00:00 2001 > From: Bruno BARBIER <brubar...@gmail.com> > 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 <brubar...@gmail.com> > + > +;; 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 <https://www.gnu.org/licenses/>. > + > +;;; 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