C-c C-c or unit testing
1 Running code
While using the org-mode application in GNU Emacs, one can not only enter and export code-blocks, but also execute them. The result of the execution is presented in the document itself (modifying the text).
A simple example is the following shell-script:
date +%F
2017-07-17
When the text-cursor sits inside this code-block, pressing C-c C-c
will start a shell for this code to be run. The result is presented
below the block.
This is a perfect way to interactively doe unit-testing of snippets of code which, later, integrate into one production application.
The code-blocks carry names which can be used in other code-blocks as macro's. The so called noweb-notation is limited but serves the purpose of isolating code-blocks for both testing and use in the bigger application.
The title you are reading now is an org-mode text using a code-block. On my screen it looks like:
As you can see, syntax-highlighting makes it easy to tell code from text. The syntax-highlighting even extends into the code itself, a bit dull in this simple example, but for larger programs keywords will stand out.
2 about this title
The document to generate the scripts has the same source as the document you are reading now.
Most scripts are bare bone, the amount of fancy stuff is kept to an absolute minimum in order to present only the concepts at hand and only that.
This title was written between 13th and 17th of July 2017