Add basic BEGIN_SRC block support.

This commit is contained in:
Sergio Martínez Portela 2020-12-06 00:26:44 +01:00
parent a5bfeadfeb
commit ffe6f007fc
3 changed files with 161 additions and 24 deletions

View file

@ -9,13 +9,15 @@
:CREATED: [2020-01-01 Wed 01:01]
:END:
#+BEGIN_SRC shell
#+BEGIN_SRC shell :results verbatim
echo "This is a test"
echo "with two lines"
exit 0 # Exit successfully
#+END_SRC
#+RESULTS:
: This is a test
: with two lines
* Second item
:PROPERTIES:
@ -24,11 +26,13 @@ exit 0 # Exit successfully
:END:
#+BEGIN_SRC shell :results drawer
echo "This is another test"
exit 0 # Comment
echo "This is another test"
echo "with two lines too"
exit 0 # Comment
#+END_SRC
#+RESULTS:
:results:
This is another test
with two lines too
:end:

View file

@ -260,14 +260,21 @@ class TestSerde(unittest.TestCase):
self.assertEqual(len(snippets), 2)
self.assertEqual(
snippets[0].content,
'echo "This is a test"\n' + "exit 0 # Exit successfully",
'echo "This is a test"\n'
+ 'echo "with two lines"\n'
+ "exit 0 # Exit successfully",
)
self.assertEqual(
snippets[0].result,
"This is a test",
"This is a test\n" + "with two lines",
)
self.assertEqual(
snippets[1].content, 'echo "This is another test"\n' + "exit 0 # Comment"
snippets[1].content,
'echo "This is another test"\n'
+ 'echo "with two lines too"\n'
+ "exit 0 # Comment",
)
self.assertEqual(
snippets[1].result, "This is another test\n" + "with two lines too"
)
self.assertEqual(snippets[1].result, "This is another test")