From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: How to add a test? Date: Mon, 29 Feb 2016 11:40:54 -0500 Message-ID: References: <87r3fxnkes.fsf@pobox.com> <87povguaza.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaQsX-0007pe-2M for emacs-orgmode@gnu.org; Mon, 29 Feb 2016 11:41:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaQsS-0000MY-VG for emacs-orgmode@gnu.org; Mon, 29 Feb 2016 11:41:00 -0500 Received: from mail-qg0-x22b.google.com ([2607:f8b0:400d:c04::22b]:34036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaQsS-0000MU-Pq for emacs-orgmode@gnu.org; Mon, 29 Feb 2016 11:40:56 -0500 Received: by mail-qg0-x22b.google.com with SMTP id b67so119655750qgb.1 for ; Mon, 29 Feb 2016 08:40:56 -0800 (PST) In-reply-to: <87povguaza.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org, George M Jones In support of Nicolas' recommendations you may also find some test examples with the macros he suggested here: https://github.com/jkitchin/org-ref/tree/master/test Over the past week I have been integrating tests on org-ref using some of those macros. They are pretty easy to use. Nicolas Goaziou writes: > Hello, > > George M Jones writes: > >> What's the process for adding a test (specifically to babel)? >> >> The only part that looks non-obvious is how to generate the test ID, >> e.g. in ob-shell-test.org: >> >> * Associative array tests (simple map) >> :PROPERTIES: >> :ID: bec1a5b0-4619-4450-a8c0-2a746b44bf8d >> :END: >> >> From there it looks like you just add to the correct file in >> org-mode/testing/examples/*.org and the corresponding >> /org-mode/testing/lisp/test-*.el file. Am I missing anything? >> >> I'll add to the README or docs unless it's already there. > > I suggest to stay away from examples/ and `org-test-at-id' altogether. > I find these tests horrible to debug when something goes wrong. > > I suggest to stay with `org-test-with-temp-text', or, if needed, > `org-test-with-temp-text-in-file' and make the test self-contained. > Also, I think it is better to have only one `should' or related, outside > of this macro, so the whole test is easier to evaluate partially. See, > e.g., "test-org-footnote.el". > > Obviously YMMV and the more important thing is to have more tests. How > tests are written is a lesser matter. Feel free to ignore my > suggestions. > > Thank you for your work. > > > Regards, -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu