From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 WIvaHh8TIGTIOwAASxT56A (envelope-from ) for ; Sun, 26 Mar 2023 11:40:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id QP90Hh8TIGTAuAAAauVa8A (envelope-from ) for ; Sun, 26 Mar 2023 11:40:47 +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 320792E470 for ; Sun, 26 Mar 2023 11:40:47 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cjszBXIJ; 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=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679823647; 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=SujaBoBtwrDJaUdILF33yGYTzdTx6ruF9MvXrilAIMM=; b=JfQPvc1UqVMGeVRTrLAdHJc6mawW45OibtPEHHkEDbIyQoZUlICX74BCqpEyc2Z958tvOq t4Cx1EYO/deE4udT69KPsvuU2U+NUeRDrcJWceKF+ZevPtOllJJhX1iSLoypxOp3w1GerL BqNBgrRlxeRmA/bpFZGYSUrLi7lOSl4fYxY7wBwBoMu3vFrkwC6dxncrAdfwQSQ92v+F4H 7OGm35ex+m0rPUxizI4VEoIGOVDG+j6r6gfQHffBIexPnFTX31orxaRqYXns+97RNQxsJH g71AGjpa/znYoy5lBcc5qwxZsG0gCuWbUrRjQuQ6/eP7WkmijVIskzuDc+Q1XA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679823647; a=rsa-sha256; cv=none; b=YO1G9tjryOehWw8j+EWfLWzDmWb28f2QqIQEgeagXPjK1AQMLU0alAPQA2qg7SnD+PgRx3 ADQx8KdiB5Gu4wE7ZT1W7ldvoIjeU5CS1K550dCAtZoXYhYZvyYbfVK91b/lSKZeRZbUbm WPuTH9m0YnmI9NnSBaxT+pWURcbwEX6Ax37Omf+QzRrBfqe4TJQBUYnU1pPNwcB5jrMri2 KYcfHHnA/P7WD34HAIxLLR2AAponSb2Iv8TnP+FHZLy+B0rWX6UolEmScnLY6pMm6GDutX H8Wvy2oGQTd224uHbu0AkSTr1JhgAMfJp/hSsx7qYceBBKIvMU4evvvxmE+6nA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cjszBXIJ; 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=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgMrd-0003j4-0z; Sun, 26 Mar 2023 05:40:37 -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 1pgMrZ-0003iq-EH for emacs-orgmode@gnu.org; Sun, 26 Mar 2023 05:40:34 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pgMrX-0004u6-7G for emacs-orgmode@gnu.org; Sun, 26 Mar 2023 05:40:32 -0400 Received: by mail-wr1-x42e.google.com with SMTP id v1so5755215wrv.1 for ; Sun, 26 Mar 2023 02:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679823628; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:from:to:cc:subject:date:message-id:reply-to; bh=SujaBoBtwrDJaUdILF33yGYTzdTx6ruF9MvXrilAIMM=; b=cjszBXIJKnbuvEXjguwBwPsmTJXGHTFve6GPfOm6QdSRnEqdkNSurgDQlCypWP1Whw Wd1oBdNC9KyaLAi5NztY1fiZ5mSvMb3L1VsgjZD4lco65RgluW8wuhGKshb6C46fDfUD uZx6CcA5Eit06hTzklUpFyXURuJkm1cYwoNWsSWC0Axz5b4cJD49zUEp8qPCBc39UIRo q0EKB7R2JERmpTaWDCzn6BX9MkAasCvh9x+NUhSFPnPhuojmfWqI9s5gw7TwnijOqBlk OiEukuf5uoweGz0dGUbA8OlV0m1ODJVsipXN4HHxetJ+nz03UHmj8B+IeC7/lyznlc0g WhFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679823628; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SujaBoBtwrDJaUdILF33yGYTzdTx6ruF9MvXrilAIMM=; b=haQMbizq6UEE8CrW4zb0Peb0X0mv1ZnNih2RnGgAAPza5nblIFBi3dvXr90xxVMCLa S0na7Q5LWPQIl12zLM4+PrL8KmXBNGwC4WVTc61coa8nsCogP3ucE77ieNczCQuZaz1T NJX1qjGmgC+o8zzSdxkgFfy5039NVbTfFaY5DK3F/Wy6HCHKS6VUA+lVGnr7KBBWWVYw JOgRxq5MxkG5W577vZRCPoB9zZpqmoOZ761BuFKdFzlEZzr+/AfJaIoS45XFie75kpNM qXvn5CDude05M3zL+7px+xtul3rhj1Ls4n3Q7rc7Jcm0mER5sSv9qQJEINhQ6yoHEGsL OEcg== X-Gm-Message-State: AAQBX9dmDvv0P+ouygNsj5FvF55QzcxpLLnGW5/kBgfvEHWt4mYpWoOO EGLzMwHRhoAj+Eq/BdsM0+s= X-Google-Smtp-Source: AKy350badgZa6xLfJfSOW73rj5G93eo80lSCNotECnOtuH/xv1/OPUU5lXMnLkwMJyyIzRo+6xQOVg== X-Received: by 2002:a5d:5445:0:b0:2c9:23c4:8f93 with SMTP id w5-20020a5d5445000000b002c923c48f93mr6134875wrv.57.1679823628201; Sun, 26 Mar 2023 02:40:28 -0700 (PDT) Received: from keynux ([2a01:e0a:505:3460:169:7511:f49a:58eb]) by smtp.gmail.com with ESMTPSA id l15-20020a5d560f000000b002dcca59e14asm5804226wrv.74.2023.03.26.02.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 02:40:27 -0700 (PDT) Message-ID: <6420130b.5d0a0220.3423a.5be1@mx.google.com> Received: by keynux (sSMTP sendmail emulation); Sun, 26 Mar 2023 11:40:25 +0200 From: Bruno Barbier To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Add tests for ob-haskell (GHCi) In-Reply-To: <87fs9rvpyj.fsf@localhost> 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> Date: Sun, 26 Mar 2023 11:40:25 +0200 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=brubar.cs@gmail.com; helo=mail-wr1-x42e.google.com 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, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 320792E470 X-Spam-Score: -6.97 X-Migadu-Spam-Score: -6.97 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: 4xZPrsr/8kV5 Ihor Radchenko writes: > Bruno Barbier writes: > >> 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'. I'll see what can be done with GHCi and use this if possible. Thanks. >> +;; 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. Definitely. I'll do. Thanks. >> + (`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 ++ "\"") ? > I'm not sure I understand. I'm using the first 'org-babel-comint-with-output' to execute the source block and save the last value (the "it" variable). Then, I'm using a second 'org-babel-comint-with-output' to make sure the output of this one contains only the last value. If I display "it" in the first block, I will not be able to differentiate between some output, previous values and the last value. And, printing "org-babel-haskell-eoe" updates the "it" variable (the last value becoming "()"), so I have to store the real "it" somewhere. Am I missing something ? >> + (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. Very good point! I will update this to use the same buffer named "*ob-haskell*" when the user doesn't set the session name. I guess it's consistent with other org-babel backends. Thank you very much for the review and you help! Bruno > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at