From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id KFXMKZILIGTCEwAASxT56A (envelope-from ) for ; Sun, 26 Mar 2023 11:08:34 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2MvxKJILIGTinAAAG6o9tA (envelope-from ) for ; Sun, 26 Mar 2023 11:08:34 +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 D10FA2DB59 for ; Sun, 26 Mar 2023 11:08:32 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Lj1OLUqm; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679821713; h=from:from:sender:sender: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:dkim-signature; bh=w8HhJET28fUP/GMAbUEGDLMrbRNG3x2/4yBZGnHkL4o=; b=P+UBIIEhMY4+3+FoHfmosIVB3GVLwVqYxhpKmGYJzFZz0k0ePIid3yjUgqp4PcLnPBxCBh //P/HCxC3DPId56RjATCVBZMCM97N46ZKI3PXIcP3ajrN9Dlfgg01Ry5jVlRctf6P5NPGy 2i9uJYqQ5F1IDoi8MHKPpTIfLIoIZYSV3EWnY+nWLvA3SLWGZFHpFX15S+mjIdjf2hDOLV mw0SDdoeFggRiBL38KOK7L/66Vt5S9/9JECUbuSTsnrhF27gq1KmpdVabrcboy9JrcZfMn BJKXHm/smexUdHPbHD/SWNPIP8KCggLlavuM7998pxxzmhcUlOOgf2UjHrRVKw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679821713; a=rsa-sha256; cv=none; b=nUiDJQPafYSVBalifCMMDayfjBJShxwVM4bsY/hbARPkbybXpQcbJ5qj+VFe01CyECXdz6 VO7pB0UtVg0me+o2oCB51UOm03psILqrKlJcewJG/mz09s421yV9FmLnjZwRLTYKAiig+n FUqHXjHp8l3IYWKtUE1AINGjNkNGf/aLGfItrHqYDOUw3ZjLhy56eQhEphFWZlS0jOzxpI 4GR0NJO2A/kC7Wzk6/BPl/C6Gy1pU05xGmKdaTLwGD+jVUcCwGJaNxC0uVnvdbpAu4heg3 jLqgHQHmIsraLAbMpSi0Y8A/njjTpLWz0F8nO6Yo9rTa2EATizX1U9bSW789sA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Lj1OLUqm; 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"; dmarc=pass (policy=none) header.from=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgMLq-00050c-DN; Sun, 26 Mar 2023 05:07:46 -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 1pgMLo-0004za-Oa for emacs-orgmode@gnu.org; Sun, 26 Mar 2023 05:07:44 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgMLl-0005pN-Ba for emacs-orgmode@gnu.org; Sun, 26 Mar 2023 05:07:44 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E3D142401D1 for ; Sun, 26 Mar 2023 11:07:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1679821658; bh=lEIWYlsamQw98I24OhUVo2E+byUvUpFAR/2QxwfgXoU=; h=From:To:Cc:Subject:Date:From; b=Lj1OLUqmgM0aFbwj5A9J94jnqI9Z3hqLzIEDMNdOl8UMjtKRjsNcweu2mfJBg8xz1 WfOal6XV5axYVw2hrUwDkixKsIkMxx9sN1gBOD5l2aGSD8iHpZaqOtFKtVrdvTpAdL gqNltpN9pJgE/EhT64/eqEtRqY30OovLU3WXTkL3GUVHdu49OsCQ9ZoMFaxzuQooJ+ w3HA0X/D87mqL1XVnd9KTKYKkAFdsokq+/KA3jA+brdqrJvLtY74iN/CZYeVe75sFk f2+0VkayXA5BJGi33YxsJzA/rFYmXcbFNYAvHu0wtAOGy2YcJxrvewP2ECx4PhpAHo ywh4pypRsy5uw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Pkqpd34sQz9rxD; Sun, 26 Mar 2023 11:07:37 +0200 (CEST) From: Ihor Radchenko To: Bruno Barbier Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Add tests for ob-haskell (GHCi) In-Reply-To: <641ec686.050a0220.16dbc.a6ca@mx.google.com> 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> Date: Sun, 26 Mar 2023 09:09:40 +0000 Message-ID: <87fs9rvpyj.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: X-Migadu-Queue-Id: D10FA2DB59 X-Spam-Score: -6.55 X-Migadu-Spam-Score: -6.55 X-Migadu-Scanner: scn0.migadu.com List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: FpmrSvjpSR7F Bruno Barbier writes: > About :results output vs :results value, I decided to use the "it" > variable, i.e. to ask GHCi what was the last value (see [1]). > > About sessions, I decided to rename the buffer as you suggested. That's > a partial workaround that should work well enough, until haskell-mode > provides a way to choose the buffer name. > > I've updated the tests and the expected results. Thanks! I will provide comments inline. > Note that I've changed the tests about errors; I'm now expecting > ob-haskell to raise errors. I'm not sure what we should expect to be > consistent with other org babel backends. Errors are usually displayed separately, using `org-babel-eval-error-notify'. > +;; 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 > +;; > + > +;;;; 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 | You can probably remove this. > + (`value (org-babel-comint-with-output > + (session org-babel-haskell-eoe nil full-body) > + (insert "__LAST_VALUE_IMPROBABLE_NAME__=()::()\n") > + (comint-send-input nil t) > + (insert full-body) > + (comint-send-input nil t) > + (insert "__LAST_VALUE_IMPROBABLE_NAME__=it\n") > + (comint-send-input nil t) > + (insert (concat "putStrLn (\"\\\"\" ++ " org-babel-haskell-eoe " ++ \"\\\"\")\n")) Why not simply putStrLn ("\"" ++ show it ++ "\"") ? > + (when (and session-name (string= session-name "none")) > + (setq session-name nil)) > + (unless session-name > + ;; As haskell-mode is using the buffer name "*haskell*", we stay > + ;; away from it. > + (setq session-name (generate-new-buffer-name "*ob-haskell*"))) This will make ob-haskell spawn a separate ghci process buffer every single time a user runs non-session src block. And the buffer is not closed after getting the result. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at