From: Ihor Radchenko <yantar92@posteo.net>
To: Bruno Barbier <brubar.cs@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Add tests for ob-haskell (GHCi)
Date: Sun, 26 Mar 2023 09:09:40 +0000 [thread overview]
Message-ID: <87fs9rvpyj.fsf@localhost> (raw)
In-Reply-To: <641ec686.050a0220.16dbc.a6ca@mx.google.com>
Bruno Barbier <brubar.cs@gmail.com> 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 <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2023-03-26 9:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 9:12 [PATCH] Add tests for ob-haskell (GHCi) Bruno Barbier
2023-03-19 10:20 ` Ihor Radchenko
2023-03-19 10:28 ` Ihor Radchenko
2023-03-19 10:32 ` Bruno Barbier
2023-03-22 10:16 ` Ihor Radchenko
2023-03-24 10:36 ` Ihor Radchenko
2023-03-25 10:01 ` Bruno Barbier
2023-03-26 9:09 ` Ihor Radchenko [this message]
2023-03-26 9:40 ` Bruno Barbier
2023-03-26 9:46 ` Ihor Radchenko
[not found] ` <notmuch-sha1-0807e1720f829950d42ef560bc30e56bd152766c>
2023-05-07 8:50 ` Bruno Barbier
2023-05-07 9:18 ` Ruijie Yu via General discussions about Org-mode.
2023-05-07 11:15 ` Bruno Barbier
2023-05-08 10:59 ` Ihor Radchenko
2023-05-21 7:40 ` Bruno Barbier
2023-06-02 8:44 ` Ihor Radchenko
2023-08-10 12:51 ` Ihor Radchenko
2023-08-25 19:10 ` Bruno Barbier
2023-09-07 14:21 ` Bruno Barbier
2023-09-08 8:23 ` Ihor Radchenko
2023-09-08 9:49 ` Bruno Barbier
2023-03-23 10:35 ` Ihor Radchenko
2023-03-23 21:01 ` ParetoOptimalDev
2023-03-23 21:30 ` ParetoOptimalDev
2023-03-24 10:40 ` Ihor Radchenko
2023-03-26 3:27 ` ParetoOptimalDev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fs9rvpyj.fsf@localhost \
--to=yantar92@posteo.net \
--cc=brubar.cs@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).