Adding an ORG test; fixed test.sh

This commit is contained in:
perro tuerto 2023-02-17 12:45:36 -08:00
parent 0b742179bc
commit 0b5213c078
6 changed files with 38 additions and 12 deletions

View File

@ -31,7 +31,7 @@ Happy hacking :)
## TODO
In order to support any markup language, the filter:
In order to support any markup language,[^2] the filter:
- Can't rely in the built-in pandoc code blocks.
- Requires syntaxis for custom literate programming blocks.
@ -40,6 +40,8 @@ In order to support any markup language, the filter:
supported (`+`, `list`, `first`)... The objective is to support any
programming language and more!
[^2]: Some markup languages like ORG doesn't support classes for code blocks.
[Pandoc]: https://pandoc.org/
[Pandoc filter]: https://pandoc.org/lua-filters.html
[literate programming]: https://en.wikipedia.org/wiki/Literate_programming

View File

@ -1,12 +1,14 @@
# Test 1
In this test, the following code block should not be executed in the terminal:
This is written in MD format.
Does nothing:
```
:(){ :|:& };: # NEVER try to execute this
```
But the following code block should be executed:
Evals:
``` eval
(first (list 1 (+ 2 3) 9))

View File

@ -1,7 +1,8 @@
# Test 2
In this test, the following code block should be executed in the terminal, the
code should be saved as an attribute, and the block should be the result:
This is written in MD format.
Evals and replaces:
``` {.eval .replace}
(list 1 (+ 2 3) 9)

View File

@ -1,14 +1,18 @@
Test 3
======
Same that Test 1 and 2, but in RST instead of MD:
This is written in RST format.
.. code:: eval
Evals:
(first (list 1 (+ 2 3) 9))
.. code::
:class: eval
.. code:: eval replace
(+ 2 3)
(list 1 (+ 2 3) 9)
Evals and replaces:
‼️ This test will fail.
.. code::
:class: eval replace
(first (list 9))

14
tests/src/t4.org Normal file
View File

@ -0,0 +1,14 @@
* Test 4
This is written in ORG format.
Evals:
#+begin_src eval
(+ 2 3 9)
#+end_src
Fails:
#+begin_src eval replace
(list (+ 2 3 9))
#+end_src

View File

@ -17,5 +17,8 @@ fi
echo "🐾 Starting tests"
for arg in "$@"; do
echo && echo "⚗️ Test in '$arg' format:"
pandoc --lua-filter ../src/literate.lua -t $arg src/*.*
md=`cat src/*.md`
rst=$'\n'`(pandoc -t markdown src/*.rst)`
org=$'\n'`pandoc -t markdown src/*.org`
echo "$md" "$rst" "$org" | pandoc --lua-filter ../src/literate.lua -t $arg
done