Hi all,

I'm starting from scratch the set of tests for Ada/SPARK support in Babel.
I've prepared a file with the first example:

---8<--- testing/examples/ob-ada-spark-test-org ---8<---
* Simple tests
:PROPERTIES:
:ID:       778e63c2-2644-4a6f-8e7d-f956fa3d9241
:END:
#+name: hello-world
#+begin_src ada :unit hello_world :results silent
   with Ada.Text_IO;
   procedure Hello_World is
   begin
      Ada.Text_IO.Put_Line ("Hello world");
   end Hello_World;
#+end_src
---8<------8<------8<------8<------8<------8<---

Then in the file testing/test-ob-ada-spark.el I've defined the following test:

(ert-deftest ob-ada-spark/hello-world ()
  "Test simple Hello world."
  (org-test-at-id "778e63c2-2644-4a6f-8e7d-f956fa3d9241"
    (org-babel-next-src-block)
    (should (equal "Hello world\n" (org-babel-execute-src-block)))))

When I execute the test form within Emacs with:

(add-to-list ' load-path (concat (file-name-directory (buffer-file-name))))
(require 'org-test)
(ert 'ob-ada-spark/hello-world)

it works fine, but when I run the test from the command line with

$ make BTEST_RE='ob-ada-spark.*' test-dirty

it fails because (org-babel-execute-src-block) returns nil:

Test ob-ada-spark/hello-world condition:
    (wrong-type-argument stringp nil)
   FAILED  1/1  ob-ada-spark/hello-world (0.002933 sec) at ../lisp/test-ob-ada-spark.el:40

Everything is in place, "make compile" issues no warning and required
programs are in PATH. I've tested other languages, e.g.

$ make BTEST_RE='ob-fortran.*' test-dirty
$ make BTEST_RE='ob-java/.*' test-dirty

and everything works fine .

Any idea?? How can I debug test execution from the command line?

BR,
-- Francesc Rocher


On Sun, Feb 25, 2024 at 11:36 AM Ihor Radchenko <yantar92@posteo.net> wrote:
Francesc Rocher <francesc.rocher@gmail.com> writes:

> If you still want to include it into the mainstream org-mode repository,
> then I'll be more than happy
> to contribute. If so, let me know what are the next steps and what kind of
> test do you expect.

Yes, we are interested to have Ada support in Org mode repository.

Here is what you need to do:

1. Check our contributor instructions at
   https://orgmode.org/worg/org-contribute.html#first-patch
   In particular, pay attention to the ChangeLog entry format.
   You also need FSF copyright assignment.
   Don't worry to make mistakes - we will guide you through once you
   submit patches.

2. https://github.com/rocher/ob-ada-spark/blob/main/ob-ada-spark.el
   should go to lisp/ directory of Org repository.
   Make sure to update the file header, updating the licence and stating
   that it is now a part of Emacs.

3. You need to get rid of any external library dependencies (f.el)

4. https://github.com/rocher/ob-ada-spark/blob/main/ob-doc-Ada-SPARK.org
   should go to
   https://orgmode.org/worg/org-contrib/babel/languages/index.html
   You will need to make a patch against https://git.sr.ht/~bzg/worg
   Also, make sure to follow
   https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-template.org

5. You need to add tests to testing/lisp in Org repository.
   You may use
   https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/testing/lisp/test-ob-java.el
   as a reference.

6. It will be best if you continue maintaining ob-ada within Org mode
   repository. If you are willing to, we will also give you write access
   to the Org mode repository on savannah. We will provide instructions
   later, when we reach this stage.
   Note that we use Org mailing list to track bugs and discuss the
   development. You do not have to be subscribed, we can forward
   relevant email threads to your email inbox.

If you have any questions, feel free to ask us.

--
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>