From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: [babel] Babel as a test harness? Date: Fri, 19 Mar 2010 18:43:35 -0500 Message-ID: <211769421003191643l2d00b8cai63028b369408552f@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0932156688==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nslqs-00074U-Et for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 19:43:38 -0400 Received: from [140.186.70.92] (port=55037 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nslqr-00074M-82 for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 19:43:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nslqq-0003W6-9F for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 19:43:37 -0400 Received: from mail-gy0-f169.google.com ([209.85.160.169]:50531) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nslqq-0003Vw-6d for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 19:43:36 -0400 Received: by gyb13 with SMTP id 13so3289836gyb.0 for ; Fri, 19 Mar 2010 16:43:35 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --===============0932156688== Content-Type: multipart/alternative; boundary=000e0cd6aae276414904822fea4e --000e0cd6aae276414904822fea4e Content-Type: text/plain; charset=ISO-8859-1 I think it would be cool to use Org-babel as a simple test harness. I'd like to have an org file, with various sections that demonstrate how to do something in Groovy. I'd like to be able to run all the code in the org file and make sure they all run successfully (return code 0). In Groovy, the "assert" function will exit with a non-zero code if it fails. How would I use org-babel to generate a "summary" table with the name of each patch of code and whether or not it succeeded? Something like this would be cool: * Regular Expressions ** Here's how to match "foo" #+source simple_regex #+begin_src groovy assert "foo" =~ /foo/ #+end_src ** Here's how to match "bar" or "baz" #+source regex_or #+begin_src groovy assert "bar" =~ "ba(z|r)" #+end_src * Results: | simple_regex | success | | regex_or | success | --000e0cd6aae276414904822fea4e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I think it would be cool to use Org-babel as a simple test harness.

= I'd like to have an org file, with various sections that demonstrate ho= w to do
something in Groovy.=A0 I'd like to be able to run all the c= ode in the org file and make sure
they all run successfully (return code 0).

In Groovy, the "asse= rt" function will exit with a non-zero code if it fails.=A0 How
wou= ld I use org-babel to generate a "summary" table with the name of=
each patch of code and whether or not it succeeded?

Something like t= his would be cool:

* Regular Expressions
** Here's how to mat= ch "foo"

#+source simple_regex
#+begin_src groovy
assert "foo" =3D~ /foo/
#+end_src

** Here's how to = match "bar" or "baz"
#+source regex_or
#+begin_sr= c groovy
assert "bar" =3D~ "ba(z|r)"
#+end_src

* Results:
| simple_regex | success |
| regex_or=A0= =A0=A0=A0=A0=A0=A0 | success |

--000e0cd6aae276414904822fea4e-- --===============0932156688== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0932156688==--