From: Matt <matt@excalamus.com>
To: "emacs-orgmode" <emacs-orgmode@gnu.org>
Subject: [PATCH] ob-shell-test, test-ob-shell and introduction
Date: Mon, 22 Nov 2021 13:37:46 -0500 [thread overview]
Message-ID: <17d48f09729.ddbece82213631.8340272801066201269@excalamus.com> (raw)
In-Reply-To:
[-- Attachment #1: Type: text/plain, Size: 566 bytes --]
Hi,
I'm interested in getting async into ob-shell.el. Since I've never contributed before, I figure it'd be good to start with a few easy tasks.
It looks to me like the stdin and cmdline header args aren't documented anywhere (at least I couldn't find anything). To make sure I'm using them correctly before making a patch for the manual, here are some tests.
Please let me know if things look okay. It wasn't clear to me how to send along a message with git send-email, so I formatted these patches and included them as an attachment. Is that fine?
Thanks,
Matt
[-- Attachment #2: 0001-ob-shell-test.org-Add-example-for-stdin.patch --]
[-- Type: application/octet-stream, Size: 960 bytes --]
From b59ec4c2d949ca4c2d881238393a8de3851315db Mon Sep 17 00:00:00 2001
From: Matt <matt@excalamus.com>
Date: Mon, 22 Nov 2021 13:07:53 -0500
Subject: [PATCH 1/2] ob-shell-test.org: Add example for stdin
* ob-shell-test.org Add section for testing header args.
---
testing/examples/ob-shell-test.org | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/testing/examples/ob-shell-test.org b/testing/examples/ob-shell-test.org
index 2510f4f96..39539dc9f 100644
--- a/testing/examples/ob-shell-test.org
+++ b/testing/examples/ob-shell-test.org
@@ -86,3 +86,22 @@ echo ${table[spaghetti]}
#+RESULTS:
: 20 cm
+* Header arg tests
+ :PROPERTIES:
+ :ID: cc56f3c6-13ec-4026-9d83-3106efd833e2
+ :END:
+
+** stdin
+#+name: an-org-reference
+org reference line 1
+org reference line 2
+
+#+begin_src sh :stdin an-org-reference :results output
+cat
+#+end_src
+
+#+RESULTS:
+: org reference line 1
+: org reference line 2
+
+
--
2.34.0
[-- Attachment #3: 0002-test-ob-shell.el-Add-tests-for-stdin-and-cmdline-hea.patch --]
[-- Type: application/octet-stream, Size: 1364 bytes --]
From b923d17679ba9c7cb88dd40312534c33eff74dd8 Mon Sep 17 00:00:00 2001
From: Matt <matt@excalamus.com>
Date: Mon, 22 Nov 2021 13:14:01 -0500
Subject: [PATCH 2/2] test-ob-shell.el: Add tests for stdin and cmdline header
args
* test-ob-shell.el (test-ob-shell/stdin, test-ob-shell/cmdline) Add
tests.
---
testing/lisp/test-ob-shell.el | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index 2f346f699..b9fcb3819 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -106,6 +106,19 @@ ob-comint.el, which was not previously tested."
"#+BEGIN_SRC sh :results output :var l='(1 2)\necho ${l}\n#+END_SRC"
(org-trim (org-babel-execute-src-block))))))
+(ert-deftest test-ob-shell/stdin ()
+ "Confirm stdin passes an org reference"
+ (org-test-at-id "cc56f3c6-13ec-4026-9d83-3106efd833e2"
+ (org-babel-next-src-block)
+ (should (equal "org reference line 1\norg reference line 2"
+ (org-trim (org-babel-execute-src-block))))))
+
+(ert-deftest test-ob-shell/cmdline ()
+ "Confirm cmdline header gets passed in as an argument."
+ (let ((res (org-babel-execute:sh "echo $1;" '((:cmdline . "foo")))))
+ (should res)
+ (should (equal "foo" res))))
+
(provide 'test-ob-shell)
;;; test-ob-shell.el ends here
--
2.34.0
next reply other threads:[~2021-11-22 18:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 18:37 Matt [this message]
2021-11-22 18:43 ` [PATCH] ob-shell-test, test-ob-shell and introduction Timothy
2021-11-24 18:48 ` Matt
2021-12-02 9:39 ` Timothy
2021-12-06 3:50 ` Matt
2021-12-06 4:50 ` Thomas S. Dye
2021-12-18 7:03 ` Matt
2021-12-18 20:51 ` Thomas S. Dye
2021-12-31 17:04 ` Thomas S. Dye
2021-12-31 19:18 ` Matt
2021-12-31 22:11 ` Thomas S. Dye
2022-01-02 4:32 ` Matt
2022-01-02 18:57 ` Thomas S. Dye
2022-01-05 17:12 ` Max Nikulin
2022-01-06 3:47 ` Matt
2022-01-07 16:18 ` Max Nikulin
2021-11-22 19:08 ` Thomas S. Dye
2021-11-23 4:42 ` [PATCH] ob-doc-shell.org (was [PATCH] ob-shell-test, test-ob-shell and introduction) Matt
2021-11-23 4:59 ` Thomas S. Dye
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=17d48f09729.ddbece82213631.8340272801066201269@excalamus.com \
--to=matt@excalamus.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).