add lisp packages
This commit is contained in:
8
lisp/org/testing/examples/agenda-file.org
Normal file
8
lisp/org/testing/examples/agenda-file.org
Normal file
@@ -0,0 +1,8 @@
|
||||
* Test Agenda
|
||||
|
||||
<2017-03-10 Fri>
|
||||
* test agenda
|
||||
SCHEDULED: <2017-07-19 Wed>
|
||||
** subnote
|
||||
* test code 216bc1ff1d862e78183e38ee9a4da504919b9878
|
||||
<2019-01-08 Tue>
|
||||
1
lisp/org/testing/examples/att1/fileA
Normal file
1
lisp/org/testing/examples/att1/fileA
Normal file
@@ -0,0 +1 @@
|
||||
Text in fileA
|
||||
1
lisp/org/testing/examples/att1/fileB
Normal file
1
lisp/org/testing/examples/att1/fileB
Normal file
@@ -0,0 +1 @@
|
||||
Text in fileB
|
||||
1
lisp/org/testing/examples/att2/fileC
Normal file
1
lisp/org/testing/examples/att2/fileC
Normal file
@@ -0,0 +1 @@
|
||||
Text in fileC
|
||||
1
lisp/org/testing/examples/att2/fileD
Normal file
1
lisp/org/testing/examples/att2/fileD
Normal file
@@ -0,0 +1 @@
|
||||
text in fileD
|
||||
32
lisp/org/testing/examples/attachments.org
Normal file
32
lisp/org/testing/examples/attachments.org
Normal file
@@ -0,0 +1,32 @@
|
||||
#+TITLE: Org attach testfile
|
||||
Used to test and verify the functionality of org-attach.
|
||||
|
||||
* H1
|
||||
:PROPERTIES:
|
||||
:DIR: att1
|
||||
:END:
|
||||
A link to one attachment: [[attachment:fileA]]
|
||||
|
||||
** H1.1
|
||||
A link to another attachment: [[attachment:fileB]]
|
||||
|
||||
** H1.2
|
||||
:PROPERTIES:
|
||||
:DIR: att2
|
||||
:END:
|
||||
|
||||
* H2
|
||||
:PROPERTIES:
|
||||
:ID: abcd123
|
||||
:END:
|
||||
|
||||
* H3
|
||||
:PROPERTIES:
|
||||
:DIR: att1
|
||||
:ID: abcd1234
|
||||
:END:
|
||||
|
||||
** H3.1
|
||||
:PROPERTIES:
|
||||
:ID: abcd12345
|
||||
:END:
|
||||
15
lisp/org/testing/examples/babel-dangerous.org
Normal file
15
lisp/org/testing/examples/babel-dangerous.org
Normal file
@@ -0,0 +1,15 @@
|
||||
#+Title: dangerous code block examples which should be isolated
|
||||
#+OPTIONS: ^:nil
|
||||
|
||||
* no default value for vars
|
||||
:PROPERTIES:
|
||||
:ID: f2df5ba6-75fa-4e6b-8441-65ed84963627
|
||||
:END:
|
||||
|
||||
There is no default value assigned to =x= variable. This is not permitted
|
||||
anymore.
|
||||
|
||||
#+name: carre
|
||||
#+begin_src python :var x
|
||||
return x*x
|
||||
#+end_src
|
||||
490
lisp/org/testing/examples/babel.org
Normal file
490
lisp/org/testing/examples/babel.org
Normal file
@@ -0,0 +1,490 @@
|
||||
#+Title: a collection of examples for Babel tests
|
||||
#+OPTIONS: ^:nil
|
||||
|
||||
* =:noweb= header argument expansion
|
||||
:PROPERTIES:
|
||||
:ID: eb1f6498-5bd9-45e0-9c56-50717053e7b7
|
||||
:END:
|
||||
|
||||
#+name: noweb-example
|
||||
#+begin_src emacs-lisp :results silent :exports code
|
||||
(message "expanded1")
|
||||
#+end_src
|
||||
|
||||
#+name: noweb-example2
|
||||
#+begin_src emacs-lisp :results silent
|
||||
(message "expanded2")
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb yes :results silent
|
||||
;; noweb-1-yes-start
|
||||
<<noweb-example>>
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb no :results silent
|
||||
;; noweb-no-start
|
||||
<<noweb-example1>>
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb yes :results silent
|
||||
;; noweb-2-yes-start
|
||||
<<noweb-example2>>
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb tangle :results silent
|
||||
;; noweb-tangle-start
|
||||
<<noweb-example1>>
|
||||
<<noweb-example2>>
|
||||
#+end_src
|
||||
|
||||
* =:noweb= header argument expansion using :exports results
|
||||
:PROPERTIES:
|
||||
:ID: 8701beb4-13d9-468c-997a-8e63e8b66f8d
|
||||
:END:
|
||||
|
||||
#+name: noweb-example
|
||||
#+begin_src emacs-lisp :exports results
|
||||
(message "expanded1")
|
||||
#+end_src
|
||||
|
||||
#+name: noweb-example2
|
||||
#+begin_src emacs-lisp :exports results
|
||||
(message "expanded2")
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb yes :exports results
|
||||
;; noweb-1-yes-start
|
||||
<<noweb-example>>
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb no :exports code
|
||||
;; noweb-no-start
|
||||
<<noweb-example1>>
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb yes :exports results
|
||||
;; noweb-2-yes-start
|
||||
<<noweb-example2>>
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb tangle :exports code
|
||||
<<noweb-example1>>
|
||||
<<noweb-example2>>
|
||||
#+end_src
|
||||
|
||||
* excessive id links on tangling
|
||||
:PROPERTIES:
|
||||
:ID: ef06fd7f-012b-4fde-87a2-2ae91504ea7e
|
||||
:END:
|
||||
|
||||
** no, don't give me an ID
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(message "not to be tangled")
|
||||
#+end_src
|
||||
|
||||
** yes, I'd love an ID
|
||||
:PROPERTIES:
|
||||
:ID: ae7b55ca-9ef2-4d30-bd48-da30e35fd0f3
|
||||
:END:
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(message "for tangling")
|
||||
#+end_src
|
||||
* simple named code block
|
||||
:PROPERTIES:
|
||||
:ID: 0d82b52d-1bb9-4916-816b-2c67c8108dbb
|
||||
:END:
|
||||
|
||||
#+name: i-have-a-name
|
||||
#+begin_src emacs-lisp
|
||||
42
|
||||
#+end_src
|
||||
|
||||
#+name:
|
||||
: 42
|
||||
|
||||
#+name: i-have-a-name
|
||||
: 42
|
||||
|
||||
* Pascal's Triangle -- exports both test
|
||||
:PROPERTIES:
|
||||
:ID: 92518f2a-a46a-4205-a3ab-bcce1008a4bb
|
||||
:END:
|
||||
|
||||
#+name: pascals-triangle
|
||||
#+begin_src emacs-lisp :var n=5 :exports both
|
||||
(defun pascals-triangle (n)
|
||||
(if (= n 0)
|
||||
(list (list 1))
|
||||
(let* ((prev-triangle (pascals-triangle (- n 1)))
|
||||
(prev-row (car (reverse prev-triangle))))
|
||||
(append prev-triangle
|
||||
(list (cl-map 'list #'+
|
||||
(append prev-row '(0))
|
||||
(append '(0) prev-row)))))))
|
||||
|
||||
(pascals-triangle n)
|
||||
#+end_src
|
||||
|
||||
* calling code blocks from inside table
|
||||
:PROPERTIES:
|
||||
:ID: 6d2ff4ce-4489-4e2a-9c65-e3f71f77d975
|
||||
:END:
|
||||
|
||||
#+name: take-sqrt
|
||||
#+begin_src emacs-lisp :var n=9
|
||||
(sqrt n)
|
||||
#+end_src
|
||||
|
||||
* executing an lob call line
|
||||
:PROPERTIES:
|
||||
:header-args: :results silent
|
||||
:ID: fab7e291-fde6-45fc-bf6e-a485b8bca2f0
|
||||
:END:
|
||||
|
||||
#+call: echo(input="testing")
|
||||
#+call: echo(input="testing") :results vector
|
||||
#+call: echo[:var input="testing"]()
|
||||
#+call: echo[:var input="testing"]() :results vector
|
||||
#+call: echo("testing")
|
||||
#+call: echo("testing") :results vector
|
||||
This is an inline call call_echo(input="testing") embedded in prose.
|
||||
This is an inline call call_echo(input="testing")[:results vector] embedded in prose.
|
||||
#+call: lob-minus(8, 4)
|
||||
call_echo("testing")
|
||||
call_concat(1,2,3)
|
||||
|
||||
#+name: concat
|
||||
#+begin_src emacs-lisp :var a=0 :var b=0 :var c=0
|
||||
(format "%S%S%S" a b c)
|
||||
#+end_src
|
||||
|
||||
* exporting an lob call line
|
||||
:PROPERTIES:
|
||||
:ID: 72ddeed3-2d17-4c7f-8192-a575d535d3fc
|
||||
:END:
|
||||
|
||||
#+name: double
|
||||
#+begin_src emacs-lisp :var it=0
|
||||
(* 2 it)
|
||||
#+end_src
|
||||
|
||||
The following exports as a normal call line
|
||||
#+call: double(it=0)
|
||||
|
||||
Now here is an inline call call_double(it=1) stuck in the middle of
|
||||
some prose.
|
||||
|
||||
This one should not be exported =call_double(it=2)= because it is
|
||||
quoted.
|
||||
|
||||
Finally this next one should export, even though it starts a line
|
||||
call_double(it=3) because sometimes inline blocks fold with a
|
||||
paragraph.
|
||||
|
||||
And, a call with raw results call_double(4)[:results raw] should not
|
||||
have quoted results.
|
||||
|
||||
The following 2*5=call_double(5) should export even when prefixed by
|
||||
an = sign.
|
||||
|
||||
* inline source block
|
||||
:PROPERTIES:
|
||||
:ID: 54cb8dc3-298c-4883-a933-029b3c9d4b18
|
||||
:END:
|
||||
Here is one in the middle src_sh{echo 1} of a line.
|
||||
Here is one at the end of a line. src_sh{echo 2}
|
||||
src_sh{echo 3} Here is one at the beginning of a line.
|
||||
|
||||
* exported inline source block
|
||||
:PROPERTIES:
|
||||
:ID: cd54fc88-1b6b-45b6-8511-4d8fa7fc8076
|
||||
:header-args: :exports code
|
||||
:END:
|
||||
Here is one in the middle src_sh{echo 1} of a line.
|
||||
Here is one at the end of a line. src_sh{echo 2}
|
||||
src_sh{echo 3} Here is one at the beginning of a line.
|
||||
Here is one that is also evaluated: src_sh[:exports both]{echo 4}
|
||||
|
||||
* mixed blocks with exports both
|
||||
:PROPERTIES:
|
||||
:ID: 5daa4d03-e3ea-46b7-b093-62c1b7632df3
|
||||
:END:
|
||||
|
||||
#+name: a-list
|
||||
- a
|
||||
- b
|
||||
- c
|
||||
|
||||
#+begin_src emacs-lisp :exports both
|
||||
"code block results"
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :var lst=a-list :results list :exports both
|
||||
(reverse lst)
|
||||
#+end_src
|
||||
|
||||
* using the =:noweb-ref= header argument
|
||||
:PROPERTIES:
|
||||
:ID: 54d68d4b-1544-4745-85ab-4f03b3cbd8a0
|
||||
:header-args: :noweb-sep ""
|
||||
:END:
|
||||
|
||||
#+begin_src sh :tangle yes :noweb yes :shebang "#!/bin/sh"
|
||||
<<fullest-disk>>
|
||||
#+end_src
|
||||
|
||||
** query all mounted disks
|
||||
#+begin_src sh :noweb-ref fullest-disk
|
||||
df
|
||||
#+end_src
|
||||
|
||||
** strip the header row
|
||||
#+begin_src sh :noweb-ref fullest-disk
|
||||
|sed '1d'
|
||||
#+end_src
|
||||
|
||||
** sort by the percent full
|
||||
#+begin_src sh :noweb-ref fullest-disk
|
||||
|awk '{print $5 " " $6}'|sort -n |tail -1
|
||||
#+end_src
|
||||
|
||||
** extract the mount point
|
||||
#+begin_src sh :noweb-ref fullest-disk
|
||||
|awk '{print $2}'
|
||||
#+end_src
|
||||
* resolving sub-trees as references
|
||||
:PROPERTIES:
|
||||
:ID: 2409e8ba-7b5f-4678-8888-e48aa02d8cb4
|
||||
:header-args: :results silent
|
||||
:END:
|
||||
|
||||
#+begin_src emacs-lisp :var text=d4faa7b3-072b-4dcf-813c-dd7141c633f3
|
||||
(length text)
|
||||
#+end_src
|
||||
|
||||
#+begin_src org :noweb yes
|
||||
<<simple-subtree>>
|
||||
<<d4faa7b3-072b-4dcf-813c-dd7141c633f3>>
|
||||
#+end_src
|
||||
|
||||
** simple subtree with custom ID
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: simple-subtree
|
||||
:END:
|
||||
this is simple
|
||||
|
||||
** simple subtree with global ID
|
||||
:PROPERTIES:
|
||||
:ID: d4faa7b3-072b-4dcf-813c-dd7141c633f3
|
||||
:END:
|
||||
has length 14
|
||||
|
||||
* exporting a code block with a name
|
||||
:PROPERTIES:
|
||||
:ID: b02ddd8a-eeb8-42ab-8664-8a759e6f43d9
|
||||
:END:
|
||||
|
||||
exporting a code block with a name
|
||||
#+name: qux
|
||||
#+begin_src sh :foo "baz"
|
||||
echo bar
|
||||
#+end_src
|
||||
* noweb no-export and exports both
|
||||
:PROPERTIES:
|
||||
:ID: 8a820f6c-7980-43db-8a24-0710d33729c9
|
||||
:END:
|
||||
Weird interaction.
|
||||
|
||||
here is one block
|
||||
|
||||
#+name: noweb-no-export-and-exports-both-1
|
||||
#+BEGIN_SRC sh :exports none
|
||||
echo 1
|
||||
#+END_SRC
|
||||
|
||||
and another
|
||||
|
||||
#+BEGIN_SRC sh :noweb no-export :exports both
|
||||
# I am inside the code block
|
||||
<<noweb-no-export-and-exports-both-1>>
|
||||
#+END_SRC
|
||||
|
||||
* in order evaluation on export
|
||||
:PROPERTIES:
|
||||
:header-args: :exports results
|
||||
:ID: 96cc7073-97ec-4556-87cf-1f9bffafd317
|
||||
:END:
|
||||
|
||||
First.
|
||||
#+name: foo-for-order-of-evaluation
|
||||
#+begin_src emacs-lisp :var it=1
|
||||
(push it *evaluation-collector*)
|
||||
#+end_src
|
||||
|
||||
Second
|
||||
#+begin_src emacs-lisp
|
||||
(push 2 *evaluation-collector*)
|
||||
#+end_src
|
||||
|
||||
Third src_emacs-lisp{(car (push 3 *evaluation-collector*))}
|
||||
|
||||
Fourth
|
||||
#+call: foo-for-order-of-evaluation(4)
|
||||
|
||||
Fifth
|
||||
#+begin_src emacs-lisp
|
||||
(push 5 *evaluation-collector*)
|
||||
#+end_src
|
||||
* exporting more than just results from a call line
|
||||
:PROPERTIES:
|
||||
:ID: bec63a04-491e-4caa-97f5-108f3020365c
|
||||
:END:
|
||||
Here is a call line with more than just the results exported.
|
||||
#+call: double(8)
|
||||
* strip noweb references on export
|
||||
:PROPERTIES:
|
||||
:ID: 8e7bd234-99b2-4b14-8cd6-53945e409775
|
||||
:END:
|
||||
|
||||
#+name: strip-export-1
|
||||
#+BEGIN_SRC sh :exports none
|
||||
i="10"
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC sh :noweb strip-export :exports code :results silent
|
||||
<<strip-export-1>>
|
||||
echo "1$i"
|
||||
#+END_SRC
|
||||
|
||||
* use case of reading entry properties
|
||||
:PROPERTIES:
|
||||
:ID: cc5fbc20-bca5-437a-a7b8-2b4d7a03f820
|
||||
:END:
|
||||
|
||||
Use case checked and documented with this test: During their
|
||||
evaluation the source blocks read values from properties from the
|
||||
entry where the call has been made unless the value is overridden with
|
||||
the optional argument of the caller.
|
||||
|
||||
** section
|
||||
:PROPERTIES:
|
||||
:a: 1
|
||||
:c: 3
|
||||
:END:
|
||||
|
||||
Note: Just export of a property can be done with a macro: {{{property(a)}}}.
|
||||
|
||||
#+NAME: src_block_location_shell-sect-call
|
||||
#+CALL: src_block_location_shell()
|
||||
|
||||
#+NAME: src_block_location_elisp-sect-call
|
||||
#+CALL: src_block_location_elisp()
|
||||
|
||||
- sect inline call_src_block_location_shell()[:results raw]
|
||||
- sect inline call_src_block_location_elisp()[:results raw]
|
||||
|
||||
*** subsection
|
||||
:PROPERTIES:
|
||||
:b: 2
|
||||
:c: 4
|
||||
:END:
|
||||
|
||||
#+NAME: src_block_location_shell-sub0-call
|
||||
#+CALL: src_block_location_shell()
|
||||
|
||||
#+NAME: src_block_location_elisp-sub0-call
|
||||
#+CALL: src_block_location_elisp()
|
||||
|
||||
- sub0 inline call_src_block_location_shell()[:results raw]
|
||||
- sub0 inline call_src_block_location_elisp()[:results raw]
|
||||
|
||||
#+NAME: src_block_location_shell-sub1-call
|
||||
#+CALL: src_block_location_shell(c=5, e=6)
|
||||
|
||||
#+NAME: src_block_location_elisp-sub1-call
|
||||
#+CALL: src_block_location_elisp(c=5, e=6)
|
||||
|
||||
- sub1 inline call_src_block_location_shell(c=5, e=6)[:results raw]
|
||||
- sub1 inline call_src_block_location_elisp(c=5, e=6)[:results raw]
|
||||
|
||||
**** function definition
|
||||
|
||||
comments for ":var":
|
||||
- The "or" is to deal with a property not present.
|
||||
- The t is to get property inheritance.
|
||||
#+NAME: src_block_location_shell
|
||||
#+HEADER: :var a=(or (org-entry-get org-babel-current-src-block-location "a" t) "0")
|
||||
#+HEADER: :var b=(or (org-entry-get org-babel-current-src-block-location "b" t) "0")
|
||||
#+HEADER: :var c=(or (org-entry-get org-babel-current-src-block-location "c" t) "0")
|
||||
#+HEADER: :var d=(or (org-entry-get org-babel-current-src-block-location "d" t) "0")
|
||||
#+HEADER: :var e=(or (org-entry-get org-babel-current-src-block-location "e" t) "0")
|
||||
#+BEGIN_SRC sh :shebang #!/bin/sh :exports results :results verbatim
|
||||
printf "shell a:$a, b:$b, c:$c, d:$d, e:$e"
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS: src_block_location_shell
|
||||
|
||||
#+NAME: src_block_location_elisp
|
||||
#+HEADER: :var a='nil
|
||||
#+HEADER: :var b='nil
|
||||
#+HEADER: :var c='nil
|
||||
#+HEADER: :var d='nil
|
||||
#+HEADER: :var e='nil
|
||||
#+BEGIN_SRC emacs-lisp :exports results
|
||||
(setq
|
||||
;; - The first `or' together with ":var <var>='nil" is to check for
|
||||
;; a value bound from an optional call argument, in the examples
|
||||
;; here: c=5, e=6
|
||||
;; - The second `or' is to deal with a property not present
|
||||
;; - The t is to get property inheritance
|
||||
a (or a (string-to-number
|
||||
(or (org-entry-get org-babel-current-src-block-location "a" t)
|
||||
"0")))
|
||||
b (or b (string-to-number
|
||||
(or (org-entry-get org-babel-current-src-block-location "b" t)
|
||||
"0")))
|
||||
c (or c (string-to-number
|
||||
(or (org-entry-get org-babel-current-src-block-location "c" t)
|
||||
"0")))
|
||||
d (or d (string-to-number
|
||||
(or (org-entry-get org-babel-current-src-block-location "e" t)
|
||||
"0")))
|
||||
e (or e (string-to-number
|
||||
(or (org-entry-get org-babel-current-src-block-location "d" t)
|
||||
"0"))))
|
||||
(format "elisp a:%d, b:%d, c:%d, d:%d, e:%d" a b c d e)
|
||||
#+END_SRC
|
||||
|
||||
* =:file-ext= and =:output-dir= header args
|
||||
:PROPERTIES:
|
||||
:ID: 93573e1d-6486-442e-b6d0-3fedbdc37c9b
|
||||
:END:
|
||||
#+name: file-ext-basic
|
||||
#+BEGIN_SRC emacs-lisp :file-ext txt
|
||||
nil
|
||||
#+END_SRC
|
||||
|
||||
#+name: file-ext-dir-relative
|
||||
#+BEGIN_SRC emacs-lisp :file-ext txt :output-dir foo
|
||||
nil
|
||||
#+END_SRC
|
||||
|
||||
#+name: file-ext-dir-relative-slash
|
||||
#+BEGIN_SRC emacs-lisp :file-ext txt :output-dir foo/
|
||||
nil
|
||||
#+END_SRC
|
||||
|
||||
#+name: file-ext-dir-absolute
|
||||
#+BEGIN_SRC emacs-lisp :file-ext txt :output-dir /tmp
|
||||
nil
|
||||
#+END_SRC
|
||||
|
||||
#+name: file-ext-file-wins
|
||||
#+BEGIN_SRC emacs-lisp :file-ext txt :file foo.bar
|
||||
nil
|
||||
#+END_SRC
|
||||
|
||||
#+name: output-dir-and-file
|
||||
#+BEGIN_SRC emacs-lisp :output-dir xxx :file foo.bar
|
||||
nil
|
||||
#+END_SRC
|
||||
1
lisp/org/testing/examples/data/ab/cd123/fileE
Normal file
1
lisp/org/testing/examples/data/ab/cd123/fileE
Normal file
@@ -0,0 +1 @@
|
||||
peek-a-boo
|
||||
1
lisp/org/testing/examples/diary-file
Normal file
1
lisp/org/testing/examples/diary-file
Normal file
@@ -0,0 +1 @@
|
||||
2019-01-08 test code: f0bcf0cd8bad93c1451bb6e1b2aaedef5cce7cbb
|
||||
1
lisp/org/testing/examples/include.html
Normal file
1
lisp/org/testing/examples/include.html
Normal file
@@ -0,0 +1 @@
|
||||
<p>HTML!</p>
|
||||
35
lisp/org/testing/examples/include.org
Normal file
35
lisp/org/testing/examples/include.org
Normal file
@@ -0,0 +1,35 @@
|
||||
Small Org file with an include keyword.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports results
|
||||
(+ 2 1)
|
||||
#+END_SRC
|
||||
|
||||
#+INCLUDE: "include2.org"
|
||||
|
||||
* Heading
|
||||
body
|
||||
|
||||
* Another heading
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: ah
|
||||
:END:
|
||||
1
|
||||
2
|
||||
3
|
||||
|
||||
* A headline with a table
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: ht
|
||||
:END:
|
||||
#+CAPTION: a table
|
||||
#+NAME: tbl
|
||||
| 1 |
|
||||
|
||||
* drawer-headline
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: dh
|
||||
:END:
|
||||
:LOGBOOK:
|
||||
drawer
|
||||
:END:
|
||||
content
|
||||
1
lisp/org/testing/examples/include2.org
Normal file
1
lisp/org/testing/examples/include2.org
Normal file
@@ -0,0 +1 @@
|
||||
Success!
|
||||
10
lisp/org/testing/examples/link-in-heading.org
Normal file
10
lisp/org/testing/examples/link-in-heading.org
Normal file
@@ -0,0 +1,10 @@
|
||||
this file has a link in it's heading, which can cause problems
|
||||
|
||||
* [[http://www.example.com][example]]
|
||||
|
||||
what a weird heading...
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; a8b1d111-eca8-49f0-8930-56d4f0875155
|
||||
(message "my heading has a link")
|
||||
#+end_src
|
||||
28
lisp/org/testing/examples/links.org
Normal file
28
lisp/org/testing/examples/links.org
Normal file
@@ -0,0 +1,28 @@
|
||||
#+TITLE: Testing various links types
|
||||
|
||||
* Plain links
|
||||
|
||||
- https://orgmode.org
|
||||
- [[https://orgmode.org][Org mode website]]
|
||||
- mailto:bzg@gnu.org
|
||||
|
||||
* Links to files
|
||||
|
||||
- file:///home/
|
||||
- [[file:normal.org][normal.org]]
|
||||
- [[file:normal.org::3][normal.org (third line)]]
|
||||
- file:normal.org::example
|
||||
- file:normal.org::* top
|
||||
- id:eaefc396-8943-4666-be6a-d5a1dbb05480
|
||||
|
||||
* External links
|
||||
:PROPERTIES:
|
||||
:ID: eaefc396-8943-4666-be6a-d5a1dbb05480
|
||||
:END:
|
||||
|
||||
- info:Org
|
||||
- [[info:org:External links]]
|
||||
- [[shell:ls -l]]
|
||||
- elisp:org-agenda
|
||||
- [[elisp:(find-file-other-frame "normal.org")]]
|
||||
|
||||
2
lisp/org/testing/examples/macro-templates.org
Normal file
2
lisp/org/testing/examples/macro-templates.org
Normal file
@@ -0,0 +1,2 @@
|
||||
#+TITLE: Macro templates
|
||||
#+MACRO: included-macro success
|
||||
9
lisp/org/testing/examples/no-heading.org
Normal file
9
lisp/org/testing/examples/no-heading.org
Normal file
@@ -0,0 +1,9 @@
|
||||
This is an example file for use by the Org mode tests.
|
||||
|
||||
This file is special because it has no headings, which can be
|
||||
erroneously assumed by some code.
|
||||
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
;; 94839181-184f-4ff4-a72f-94214df6f5ba
|
||||
(message "I am code")
|
||||
#+end_src
|
||||
28
lisp/org/testing/examples/normal.org
Normal file
28
lisp/org/testing/examples/normal.org
Normal file
@@ -0,0 +1,28 @@
|
||||
#+TITLE: Example file
|
||||
#+OPTIONS: num:nil ^:nil
|
||||
#+STARTUP: hideblocks
|
||||
|
||||
This is an example file for use by the Org mode tests.
|
||||
|
||||
* top
|
||||
** code block
|
||||
:PROPERTIES:
|
||||
:header-args: :tangle yes
|
||||
:CUSTOM_ID: code-block-section
|
||||
:END:
|
||||
Here are a couple of code blocks.
|
||||
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
;; 94839181-184f-4ff4-a72f-94214df6f5ba
|
||||
(message "I am code")
|
||||
#+end_src
|
||||
* accumulating properties in drawers
|
||||
:PROPERTIES:
|
||||
:header-args+: :var bar=2
|
||||
:header-args: :var foo=1
|
||||
:ID: 75282ba2-f77a-4309-a970-e87c149fe125
|
||||
:END:
|
||||
|
||||
#+begin_src emacs-lisp :results silent
|
||||
(list bar foo)
|
||||
#+end_src
|
||||
158
lisp/org/testing/examples/ob-C-test.org
Normal file
158
lisp/org/testing/examples/ob-C-test.org
Normal file
@@ -0,0 +1,158 @@
|
||||
#+Title: a collection of examples for ob-C tests
|
||||
#+OPTIONS: ^:nil
|
||||
* Simple tests
|
||||
:PROPERTIES:
|
||||
:ID: fa6db330-e960-4ea2-ac67-94bb845b8577
|
||||
:END:
|
||||
#+source: simple
|
||||
#+begin_src cpp :includes "<iostream>" :results silent
|
||||
std::cout << 42;
|
||||
return 0;
|
||||
#+end_src
|
||||
|
||||
#+source: simple
|
||||
#+begin_src D :results silent
|
||||
writefln ("%s", 42);
|
||||
#+end_src
|
||||
|
||||
#+source: integer_var
|
||||
#+begin_src cpp :var q=12 :includes "<iostream>" :results silent
|
||||
std::cout << q;
|
||||
return 0;
|
||||
#+end_src
|
||||
|
||||
#+source: integer_var
|
||||
#+begin_src D :var q=12 :results silent
|
||||
writefln ("%s", q);
|
||||
#+end_src
|
||||
|
||||
#+source: two_var
|
||||
#+begin_src cpp :var q=12 :var p=10 :includes "<iostream>" :results silent
|
||||
std::cout << p+q;
|
||||
return 0;
|
||||
#+end_src
|
||||
|
||||
#+source: two_var
|
||||
#+begin_src D :var q=12 :var p=10 :results silent
|
||||
writefln ("%s", p+q);
|
||||
#+end_src
|
||||
|
||||
#+source: string_var
|
||||
#+begin_src cpp :var q="word" :includes '(<iostream> <cstring>) :results silent
|
||||
std::cout << q << ' ' << std::strlen(q);
|
||||
return 0;
|
||||
#+end_src
|
||||
|
||||
#+source: string_var
|
||||
#+begin_src D :var q="word" :results silent
|
||||
writefln ("%s %s", q, q.length);
|
||||
#+end_src
|
||||
|
||||
#+source: define
|
||||
#+begin_src cpp :defines N 42 :includes "<iostream>" :results silent
|
||||
std::cout << N;
|
||||
return 0;
|
||||
#+end_src
|
||||
|
||||
* Array
|
||||
:PROPERTIES:
|
||||
:ID: 2df1ab83-3fa3-462a-a1f3-3aef6044a874
|
||||
:END:
|
||||
#+source: array
|
||||
#+begin_src cpp :includes "<iostream>" :results vector :results silent
|
||||
for (int i=1; i<3; i++) {
|
||||
std::cout << i << '\n';
|
||||
}
|
||||
return 0;
|
||||
#+end_src
|
||||
|
||||
#+source: array
|
||||
#+begin_src D :results vector :results silent
|
||||
foreach (i; 1..3)
|
||||
writefln ("%s", i);
|
||||
#+end_src
|
||||
|
||||
* Matrix
|
||||
:PROPERTIES:
|
||||
:ID: cc65d6b3-8e8e-4f9c-94cd-f5a00cdeceb5
|
||||
:END:
|
||||
#+name: C-matrix
|
||||
| 1 | 2 |
|
||||
| 3 | 4 |
|
||||
|
||||
#+source: list_var
|
||||
#+begin_src cpp :var a='("abc" "def") :includes "<iostream>" :results silent
|
||||
std::cout << a[0] << a[1] << sizeof(a)/sizeof(*a) << '\n';
|
||||
#+end_src
|
||||
|
||||
#+source: list_var
|
||||
#+begin_src D :var a='("abc" "def") :results silent
|
||||
writefln ("%s%s%s", a[0], a[1], a.length);
|
||||
#+end_src
|
||||
|
||||
#+source: vector_var
|
||||
#+begin_src cpp :var a='[1 2] :includes "<iostream>" :results silent
|
||||
std::cout << a[0] << a[1] << sizeof(a)/sizeof(*a) << '\n';
|
||||
#+end_src
|
||||
|
||||
#+source: vector_var
|
||||
#+begin_src D :var a='[1 2] :results silent
|
||||
writefln ("%s%s%s", a[0], a[1], a.length);
|
||||
#+end_src
|
||||
|
||||
#+source: list_list_var
|
||||
#+begin_src cpp :var q=C-matrix :includes "<iostream>" :results silent
|
||||
std::cout << q[0][0] << ' ' << q[1][0] << '\n'
|
||||
<< q[0][1] << ' ' << q[1][1] << '\n'; // transpose
|
||||
#+end_src
|
||||
|
||||
#+source: list_list_var
|
||||
#+begin_src D :var q=C-matrix :results silent
|
||||
writefln ("%s %s", q[0][0], q[1][0]);
|
||||
writefln ("%s %s", q[0][1], q[1][1]); // transpose
|
||||
#+end_src
|
||||
|
||||
* Inhomogeneous table
|
||||
:PROPERTIES:
|
||||
:ID: e112bc2e-419a-4890-99c2-7ac4779531cc
|
||||
:END:
|
||||
|
||||
#+name: tinomogen
|
||||
| day | quty |
|
||||
|-----------+------|
|
||||
| monday | 34 |
|
||||
| tuesday | 41 |
|
||||
| wednesday | 56 |
|
||||
| thursday | 17 |
|
||||
| friday | 12 |
|
||||
| saturday | 7 |
|
||||
| sunday | 4 |
|
||||
|
||||
#+source: inhomogeneous_table
|
||||
#+begin_src cpp :var tinomogen=tinomogen :results silent :includes <string.h> <stdio.h>
|
||||
int main()
|
||||
{
|
||||
int i, j;
|
||||
for (i=0; i<tinomogen_rows; i++) {
|
||||
for (j=0; j<tinomogen_cols; j++)
|
||||
printf ("%s ", tinomogen[i][j]);
|
||||
printf ("\n");
|
||||
}
|
||||
printf ("Friday %s\n", tinomogen_h(4,"day"));
|
||||
return 0;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
#+source: inhomogeneous_table
|
||||
#+begin_src D :var tinomogen=tinomogen :results silent
|
||||
import std.stdio;
|
||||
void main()
|
||||
{
|
||||
for (int i=0; i<tinomogen_rows; i++) {
|
||||
for (int j=0; j<tinomogen_cols; j++)
|
||||
writef ("%s ", tinomogen[i][j]);
|
||||
writeln();
|
||||
}
|
||||
writefln ("Friday %s\n", tinomogen_h(4,"day"));
|
||||
}
|
||||
#+end_src
|
||||
2
lisp/org/testing/examples/ob-awk-test.in
Normal file
2
lisp/org/testing/examples/ob-awk-test.in
Normal file
@@ -0,0 +1,2 @@
|
||||
# an input file for awk test
|
||||
15
|
||||
46
lisp/org/testing/examples/ob-awk-test.org
Normal file
46
lisp/org/testing/examples/ob-awk-test.org
Normal file
@@ -0,0 +1,46 @@
|
||||
#+Title: a collection of examples for ob-awk tests
|
||||
#+OPTIONS: ^:nil
|
||||
|
||||
* Simple tests
|
||||
:PROPERTIES:
|
||||
:ID: 9e998b2a-3581-43fe-b26d-07d3c507b86a
|
||||
:END:
|
||||
Run without input stream
|
||||
#+begin_src awk :output silent :results silent
|
||||
BEGIN {
|
||||
print 42
|
||||
}
|
||||
#+end_src
|
||||
|
||||
Use a code block output as an input
|
||||
#+begin_src awk :stdin genseq :results silent
|
||||
{
|
||||
print 42+$1
|
||||
}
|
||||
#+end_src
|
||||
|
||||
Use input file
|
||||
#+name: genfile
|
||||
#+begin_src awk :in-file ob-awk-test.in :results silent
|
||||
$0~/[\t]*#/{
|
||||
# skip comments
|
||||
next
|
||||
}
|
||||
{
|
||||
print $1*10
|
||||
}
|
||||
#+end_src
|
||||
|
||||
#+name: awk-table-input
|
||||
| a | b | c |
|
||||
|
||||
#+begin_src awk :var a=awk-table-input
|
||||
BEGIN{ print a; }
|
||||
#+end_src
|
||||
|
||||
* Input data generators
|
||||
A code block to generate input stream
|
||||
#+name: genseq
|
||||
#+begin_src emacs-lisp :results silent
|
||||
(print "1")
|
||||
#+end_src
|
||||
108
lisp/org/testing/examples/ob-fortran-test.org
Normal file
108
lisp/org/testing/examples/ob-fortran-test.org
Normal file
@@ -0,0 +1,108 @@
|
||||
#+Title: a collection of examples for ob-fortran tests
|
||||
#+OPTIONS: ^:nil
|
||||
|
||||
* simple programs
|
||||
:PROPERTIES:
|
||||
:ID: 459384e8-1797-4f11-867e-dde0473ea7cc
|
||||
:END:
|
||||
#+name: hello
|
||||
#+begin_src fortran :results silent
|
||||
print *, 'Hello world'
|
||||
#+end_src
|
||||
|
||||
#+name: fortran_parameter
|
||||
#+begin_src fortran :results silent
|
||||
integer, parameter :: i = 10
|
||||
write (*, '(i2)') i
|
||||
#+end_src
|
||||
|
||||
* variable resolution
|
||||
:PROPERTIES:
|
||||
:ID: d8d1dfd3-5f0c-48fe-b55d-777997e02242
|
||||
:END:
|
||||
#+begin_src fortran :var N = 15 :results silent
|
||||
write (*, '(i2)') N
|
||||
#+end_src
|
||||
|
||||
Define for preprocessed fortran
|
||||
#+begin_src fortran :defines N 42 :results silent
|
||||
implicit none
|
||||
write (*, '(i2)') N
|
||||
#+end_src
|
||||
|
||||
#+begin_src fortran :var s="word" :results silent
|
||||
write (*, '(a4)') s
|
||||
#+end_src
|
||||
* arrays
|
||||
:PROPERTIES:
|
||||
:ID: c28569d9-04ce-4cad-ab81-1ea29f691465
|
||||
:END:
|
||||
Real array as input
|
||||
#+begin_src fortran :var s='(1.0 2.0 3.0) :results silent
|
||||
write (*, '(3f5.2)'), s
|
||||
#+end_src
|
||||
|
||||
#+name: test_tbl
|
||||
| 1.0 |
|
||||
| 2.0 |
|
||||
|
||||
#+begin_src fortran :var s=test_tbl :results silent
|
||||
write (*, '(2f5.2)'), s
|
||||
#+end_src
|
||||
|
||||
* matrix
|
||||
:PROPERTIES:
|
||||
:ID: 3f73ab19-d25a-428d-8c26-e8c6aa933976
|
||||
:END:
|
||||
Real matrix as input
|
||||
#+name: fortran-input-matrix1
|
||||
| 0.0 | 42.0 |
|
||||
| 0.0 | 0.0 |
|
||||
| 0.0 | 0.0 |
|
||||
|
||||
#+name: fortran-input-matrix2
|
||||
| 0.0 | 0.0 | 0.0 |
|
||||
| 0.0 | 0.0 | 42.0 |
|
||||
|
||||
#+begin_src fortran :var s=fortran-input-matrix1 :results silent
|
||||
write (*, '(i2)'), nint(s(1,2))
|
||||
#+end_src
|
||||
|
||||
#+begin_src fortran :var s=fortran-input-matrix2 :results silent
|
||||
write (*, '(i2)'), nint(s(2,3))
|
||||
#+end_src
|
||||
|
||||
* failing
|
||||
:PROPERTIES:
|
||||
:ID: 891ead4a-f87a-473c-9ae0-1cf348bcd04f
|
||||
:END:
|
||||
Should fail (TODO: add input variables for the case with explicit
|
||||
program statement)
|
||||
#+begin_src fortran :var s="word" :results silent
|
||||
program ex
|
||||
print *, "output of ex program"
|
||||
end program ex
|
||||
#+end_src
|
||||
|
||||
Fails to compile (TODO: error check in ob-fortran.el)
|
||||
#+begin_src fortran :var s='(1 ()) :results silent
|
||||
print *, s
|
||||
#+end_src
|
||||
|
||||
Should fail to compile with gfortran
|
||||
#+begin_src fortran :flags --std=f95 --pedantic-error :results silent
|
||||
program ex
|
||||
integer*8 :: i
|
||||
end program ex
|
||||
#+end_src
|
||||
|
||||
* programs input parameters
|
||||
:PROPERTIES:
|
||||
:ID: 2d5330ea-9934-4737-9ed6-e1d3dae2dfa4
|
||||
:END:
|
||||
Pass parameters to the program
|
||||
#+begin_src fortran :cmdline "23" :results silent
|
||||
character(len=255) :: cmd
|
||||
call get_command_argument(1, cmd)
|
||||
write (*,*) trim(cmd)
|
||||
#+end_src
|
||||
112
lisp/org/testing/examples/ob-header-arg-defaults.org
Normal file
112
lisp/org/testing/examples/ob-header-arg-defaults.org
Normal file
@@ -0,0 +1,112 @@
|
||||
#+TITLE: Tests for default header arguments to Babel source blocks
|
||||
#+OPTIONS: ^:nil
|
||||
#+PROPERTY: header-args :var t1="gh1" t2="gh2_clobbered"
|
||||
#+PROPERTY: header-args+ :var t4="gh4" t2="gh2" :var end=9
|
||||
#+PROPERTY: header-args:emacs-lisp :var t1="ge1" t4="ge4_clobbered"
|
||||
#+PROPERTY: header-args:emacs-lisp+ :var t4="ge4" :var t5="ge5"
|
||||
#+PROPERTY: header-args:emacs-lisp+ :results silent :noweb yes
|
||||
|
||||
#+NAME: showvar
|
||||
#+BEGIN_SRC emacs-lisp :execute no
|
||||
(mapconcat (lambda (n)
|
||||
(let* ((n (string (+ 48 n)))
|
||||
(p (intern (concat "t" n))))
|
||||
(if (boundp p) (eval p) (concat "--" n))))
|
||||
(number-sequence 1 end)
|
||||
"/")
|
||||
#+END_SRC
|
||||
|
||||
* Global property
|
||||
:PROPERTIES:
|
||||
:ID: 3fdadb69-5d15-411e-aad0-f7860cdd7816
|
||||
:END:
|
||||
|
||||
| Global | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| header-args | gh1 | gh2 | --- | gh4 | --- | --- | --- | --- | --- |
|
||||
| header-args:emacs-lisp | ge1 | --- | --- | ge4 | ge5 | --- | --- | --- | --- |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| Result | ge1 | gh2 | --3 | ge4 | ge5 | --6 | --7 | --8 | --9 |
|
||||
|
||||
#+CALL: showvar() :results silent
|
||||
#+BEGIN_SRC emacs-lisp :var end=7
|
||||
<<showvar>>
|
||||
#+END_SRC
|
||||
|
||||
* Tree property
|
||||
** Overwrite
|
||||
:PROPERTIES:
|
||||
:ID: a9cdfeda-9f31-4bb5-b694-2cf452f07dfd
|
||||
:header-args: :var t7="th7"
|
||||
:header-args:emacs-lisp: :var t8="te8"
|
||||
:header-args:emacs-lisp+: :results silent :noweb yes :var end=9
|
||||
:END:
|
||||
|
||||
| Global | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| header-args | gh1 | gh2 | --- | gh4 | --- | --- | --- | --- | --- |
|
||||
| header-args:emacs-lisp | ge1 | --- | --- | ge4 | ge5 | --- | --- | --- | --- |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| Tree | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| header-args | --- | --- | --- | --- | --- | --- | th7 | --- | --- |
|
||||
| header-args:emacs-lisp | --- | --- | --- | --- | --- | --- | --- | te8 | --- |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| Result #+CALL | ge1 | gh2 | --3 | ge4 | ge5 | --6 | th7 | te8 | --9 |
|
||||
| Result noweb | --1 | --2 | --3 | --4 | --5 | --6 | th7 | te8 | --9 |
|
||||
|
||||
#+CALL: showvar() :results silent
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
<<showvar>>
|
||||
#+END_SRC
|
||||
|
||||
** Accumulate
|
||||
:PROPERTIES:
|
||||
:ID: 1d97d258-fd50-4107-a095-e4625bffc57b
|
||||
:header-args+: :var t2="th2" t3="th3"
|
||||
:header-args:emacs-lisp+: :var t5="te5" end=8
|
||||
:END:
|
||||
|
||||
| Global | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|
||||
|-------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| header-args | gh1 | gh2 | --- | gh4 | --- | --- | --- | --- | --- |
|
||||
| header-args:emacs-lisp | ge1 | --- | --- | ge4 | ge5 | --- | --- | --- | --- |
|
||||
|-------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| Tree | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|
||||
|-------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| header-args+ | --- | th2 | th3 | --- | --- | --- | --- | --- | --- |
|
||||
| header-args:emacs-lisp+ | --- | --- | --- | --- | te5 | --- | --- | --- | --- |
|
||||
|-------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| Result #+CALL | ge1 | th2 | th3 | ge4 | te5 | --6 | --7 | --8 | --9 |
|
||||
| Result noweb | ge1 | th2 | th3 | ge4 | te5 | --6 | --7 | --8 | --9 |
|
||||
|
||||
#+CALL: showvar(end=6) :results silent
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
<<showvar>>
|
||||
#+END_SRC
|
||||
|
||||
** Complex
|
||||
:PROPERTIES:
|
||||
:ID: fa0e912d-d9b4-47b0-9f9e-1cbb39f7cbc2
|
||||
:header-args+: :var t2="th2"
|
||||
:header-args:emacs-lisp: :var t5="te5" end=7
|
||||
:header-args:emacs-lisp+: :results silent :noweb yes :var end=9
|
||||
:END:
|
||||
|
||||
| Global | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| header-args | gh1 | gh2 | --- | gh4 | --- | --- | --- | --- | --- |
|
||||
| header-args:emacs-lisp | ge1 | --- | --- | ge4 | ge5 | --- | --- | --- | --- |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| Tree | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| header-args+ | --- | th2 | --- | --- | --- | --- | --- | --- | --- |
|
||||
| header-args:emacs-lisp | --- | --- | --- | --- | te5 | --- | --- | --- | --- |
|
||||
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||
| Result #+CALL | gh1 | th2 | go3 | gh4 | te5 | --6 | --7 | --8 | --9 |
|
||||
| Result noweb | gh1 | th2 | --3 | gh4 | te5 | --6 | --7 | --8 | --9 |
|
||||
|
||||
#+CALL: showvar(end=6) :results silent
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
<<showvar>>
|
||||
#+END_SRC
|
||||
31
lisp/org/testing/examples/ob-lilypond-broken.ly
Normal file
31
lisp/org/testing/examples/ob-lilypond-broken.ly
Normal file
@@ -0,0 +1,31 @@
|
||||
line 1
|
||||
line 2
|
||||
line 3
|
||||
line 4
|
||||
line 5
|
||||
line 6
|
||||
line 7
|
||||
line 8
|
||||
line 9
|
||||
line 10
|
||||
line 11
|
||||
line 12
|
||||
line 13
|
||||
line 14
|
||||
line 15
|
||||
line 16
|
||||
line 17
|
||||
line 18
|
||||
line 19
|
||||
line 20
|
||||
line 21
|
||||
line 22
|
||||
line 23
|
||||
line 24
|
||||
line 25
|
||||
line 26
|
||||
line 27
|
||||
line 28
|
||||
line 29
|
||||
line 30
|
||||
|
||||
39
lisp/org/testing/examples/ob-lilypond-broken.org
Normal file
39
lisp/org/testing/examples/ob-lilypond-broken.org
Normal file
@@ -0,0 +1,39 @@
|
||||
* Faulty lilypond org file for test purposes (do not adjust)
|
||||
line 2
|
||||
line 3
|
||||
line 4
|
||||
line 5
|
||||
line 6
|
||||
line 7
|
||||
line 8
|
||||
line 9
|
||||
line 10
|
||||
line 11
|
||||
line 12
|
||||
line 13
|
||||
line 14
|
||||
line 15
|
||||
line 16
|
||||
line 17
|
||||
line 18
|
||||
line 19
|
||||
line 20
|
||||
line 21
|
||||
line 22
|
||||
line 23
|
||||
line 24
|
||||
line 25
|
||||
line 26
|
||||
line 27
|
||||
line 28
|
||||
line 29
|
||||
line 30
|
||||
line 31
|
||||
line 32
|
||||
line 33
|
||||
line 34
|
||||
line 35
|
||||
line 36
|
||||
line 37
|
||||
line 38
|
||||
line 39
|
||||
15
lisp/org/testing/examples/ob-lilypond-test.error
Normal file
15
lisp/org/testing/examples/ob-lilypond-test.error
Normal file
@@ -0,0 +1,15 @@
|
||||
Processing `xxx'
|
||||
Parsing...
|
||||
/path/to/tangled/file/test.ly:25:0: error: syntax error, unexpected \score, expecting '='
|
||||
|
||||
\score {
|
||||
Interpreting music... [8][16][24][32]
|
||||
Preprocessing graphical objects...
|
||||
Interpreting music...
|
||||
MIDI output to `xxx'
|
||||
Finding the ideal number of pages...
|
||||
Fitting music on 2 or 3 pages...
|
||||
Drawing systems...
|
||||
Layout output to `xxx'
|
||||
Converting to `xxx'...
|
||||
error: failed files: "/Path/to/tangled/file/test.ly/example.ly"
|
||||
30
lisp/org/testing/examples/ob-lilypond-test.ly
Normal file
30
lisp/org/testing/examples/ob-lilypond-test.ly
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
% [[file:~/.emacs.d/martyn/martyn/ob-lilypond/test/test-build/test.org::*LilyPond%2520Version][LilyPond-Version:1]]
|
||||
|
||||
\version "2.12.3"
|
||||
|
||||
% LilyPond-Version:1 ends here
|
||||
|
||||
% [[file:~/.emacs.d/martyn/martyn/ob-lilypond/test/test-build/test.org::*lilypond%2520block%2520for%2520test%2520purposes][lilypond-block-for-test-purposes:1]]
|
||||
|
||||
\score {
|
||||
\relative c' {
|
||||
c8 d e f g a b c |
|
||||
b a g f e d c4 |
|
||||
}
|
||||
|
||||
% lilypond-block-for-test-purposes:1 ends here
|
||||
|
||||
% [[file:~/.emacs.d/martyn/martyn/ob-lilypond/test/test-build/test.org::*lilypond%2520block%2520for%2520test%2520purposes][lilypond-block-for-test-purposes:2]]
|
||||
|
||||
\layout {
|
||||
}
|
||||
\midi {
|
||||
\context {
|
||||
\Score
|
||||
tempoWholesPerMinute = #(ly:make-moment 150 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
% lilypond-block-for-test-purposes:2 ends here
|
||||
37
lisp/org/testing/examples/ob-lilypond-test.org
Normal file
37
lisp/org/testing/examples/ob-lilypond-test.org
Normal file
@@ -0,0 +1,37 @@
|
||||
* Test org lilypond file
|
||||
|
||||
This is a simple file for test purposes
|
||||
|
||||
** LilyPond Version
|
||||
|
||||
#+begin_src lilypond
|
||||
|
||||
\version "2.12.3"
|
||||
|
||||
#+end_src
|
||||
|
||||
** DONE lilypond block for test purposes
|
||||
|
||||
#+begin_src lilypond
|
||||
|
||||
\score {
|
||||
\relative c' {
|
||||
c8 d e f g a b c |
|
||||
b a g f e d c4 |
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
#+begin_src lilypond
|
||||
|
||||
\layout {
|
||||
}
|
||||
\midi {
|
||||
\context {
|
||||
\Score
|
||||
tempoWholesPerMinute = #(ly:make-moment 150 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#+end_src
|
||||
91
lisp/org/testing/examples/ob-maxima-test.org
Normal file
91
lisp/org/testing/examples/ob-maxima-test.org
Normal file
@@ -0,0 +1,91 @@
|
||||
#+Title: a collection of examples for ob-maxima tests
|
||||
#+OPTIONS: ^:nil
|
||||
|
||||
* Simple tests
|
||||
:PROPERTIES:
|
||||
:ID: b5842ed4-8e8b-4b18-a1c9-cef006b6a6c8
|
||||
:END:
|
||||
#+begin_src maxima :var s=4 :results silent
|
||||
print(s);
|
||||
#+end_src
|
||||
|
||||
Pass a string
|
||||
#+begin_src maxima :var fun="sin(x)" :var q=2 :results silent
|
||||
print(diff(fun, x, q))$
|
||||
#+end_src
|
||||
|
||||
* Graphic output
|
||||
Graphic output
|
||||
#+begin_src maxima :var a=0.5 :results graphics :file maxima-test-sin.png
|
||||
plot2d(sin(a*x), [x, 0, 2*%pi])$
|
||||
#+end_src
|
||||
|
||||
#+begin_src maxima :results graphics :file maxima-test-3d.png
|
||||
plot3d (2^(-u^2 + v^2), [u, -3, 3], [v, -2, 2])$
|
||||
#+end_src
|
||||
* Output to a file
|
||||
Output to a file
|
||||
#+begin_src maxima :file maxima-test-ouput.out
|
||||
for i:1 thru 10 do print(i)$
|
||||
#+end_src
|
||||
* List input
|
||||
:PROPERTIES:
|
||||
:ID: b5561c6a-73cd-453a-ba5e-62ad84844de6
|
||||
:END:
|
||||
Simple list as an input
|
||||
#+begin_src maxima :var a=(list 1 2 3) :results silent :results verbatim
|
||||
print(a)$
|
||||
#+end_src
|
||||
|
||||
#+begin_src maxima :var a=(list 1 (list 1 2) 3) :results silent :results verbatim
|
||||
print(a+1);
|
||||
#+end_src
|
||||
|
||||
* Table input
|
||||
:PROPERTIES:
|
||||
:ID: 400ee228-6b12-44fd-8097-7986f0f0db43
|
||||
:END:
|
||||
#+name: test_tbl_col
|
||||
| 1.0 |
|
||||
| 2.0 |
|
||||
|
||||
#+name: test_tbl_row
|
||||
| 1.0 | 2.0 |
|
||||
|
||||
#+begin_src maxima :var s=test_tbl_col :results silent :results verbatim
|
||||
print(s+1.0);
|
||||
#+end_src
|
||||
|
||||
#+begin_src maxima :var s=test_tbl_row :results silent :results verbatim
|
||||
print(s+1.0);
|
||||
#+end_src
|
||||
|
||||
Matrix
|
||||
#+name: test_tbl_mtr
|
||||
| 1.0 | 1.0 |
|
||||
|
||||
#+begin_src maxima :var s=test_tbl_mtr :results silent :results verbatim
|
||||
ms: apply(matrix, s);
|
||||
print(ms);
|
||||
#+end_src
|
||||
|
||||
* Construct a table from the output
|
||||
:PROPERTIES:
|
||||
:ID: cc158527-b867-4b1d-8ae0-b8c713a90fd7
|
||||
:END:
|
||||
#+begin_src maxima :results silent
|
||||
with_stdout("/dev/null", load(numericalio))$
|
||||
m: genmatrix (lambda([i,j], i+j-1), 3, 3)$
|
||||
write_data(m, "/dev/stdout")$
|
||||
#+end_src
|
||||
|
||||
* Latex output
|
||||
#+begin_src maxima :exports both :results latex :results verbatim
|
||||
assume(x>0);
|
||||
tex(ratsimp(diff(%e^(a*x), x)));
|
||||
#+end_src
|
||||
|
||||
#+results:
|
||||
#+BEGIN_LaTeX
|
||||
$$a\,e^{a\,x}$$
|
||||
#+END_LaTeX
|
||||
55
lisp/org/testing/examples/ob-octave-test.org
Normal file
55
lisp/org/testing/examples/ob-octave-test.org
Normal file
@@ -0,0 +1,55 @@
|
||||
#+Title: a collection of examples for ob-octave tests
|
||||
#+OPTIONS: ^:nil
|
||||
|
||||
* Simple tests
|
||||
:PROPERTIES:
|
||||
:ID: 54dcd61d-cf6c-4d7a-b9e5-854953c8a753
|
||||
:END:
|
||||
Number output
|
||||
#+begin_src octave :exports results :results silent
|
||||
ans = 10
|
||||
#+end_src
|
||||
|
||||
Array output
|
||||
#+begin_src octave :exports results :results silent
|
||||
ans = 1:4'
|
||||
#+end_src
|
||||
|
||||
* Input tests
|
||||
:PROPERTIES:
|
||||
:ID: cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba
|
||||
:END:
|
||||
Input an integer variable
|
||||
#+begin_src octave :exports results :results silent :var s=42
|
||||
ans = s
|
||||
#+end_src
|
||||
|
||||
Input an array
|
||||
#+begin_src octave :exports results :results silent :var s='(1.0 2.0 3.0)
|
||||
ans = s
|
||||
#+end_src
|
||||
|
||||
Input a matrix
|
||||
#+begin_src octave :exports results :results silent :var s='((1 2) (3 4))
|
||||
ans = s
|
||||
#+end_src
|
||||
|
||||
Input a string
|
||||
#+begin_src octave :exports results :results silent :var s="test"
|
||||
ans = s(1:2)
|
||||
#+end_src
|
||||
|
||||
Input elisp nil
|
||||
#+begin_src octave :exports results :results silent :var s='nil
|
||||
ans = s
|
||||
#+end_src
|
||||
|
||||
|
||||
* Graphical tests
|
||||
#+begin_src octave :results graphics :file chart.png
|
||||
sombrero;
|
||||
#+end_src
|
||||
|
||||
#+begin_src octave :session
|
||||
sombrero;
|
||||
#+end_src
|
||||
5
lisp/org/testing/examples/ob-screen-test.org
Normal file
5
lisp/org/testing/examples/ob-screen-test.org
Normal file
@@ -0,0 +1,5 @@
|
||||
#+Title: a collection of examples for ob-screen tests
|
||||
#+begin_src screen :session create-tmpdir
|
||||
mkdir -p $TMPDIR
|
||||
cd $TMPDIR
|
||||
#+end_src
|
||||
35
lisp/org/testing/examples/ob-sed-test.org
Normal file
35
lisp/org/testing/examples/ob-sed-test.org
Normal file
@@ -0,0 +1,35 @@
|
||||
#+PROPERTY: results silent scalar
|
||||
#+Title: a collection of examples for ob-sed tests
|
||||
|
||||
* Test simple execution of sed script
|
||||
:PROPERTIES:
|
||||
:ID: C7E7CA6A-2601-42C9-B534-4102D62E458D
|
||||
:END:
|
||||
|
||||
#+NAME: ex1
|
||||
#+BEGIN_EXAMPLE
|
||||
An example sentence.
|
||||
#+END_EXAMPLE
|
||||
|
||||
#+BEGIN_SRC sed :stdin ex1
|
||||
s/n example/ processed/
|
||||
2 d
|
||||
#+END_SRC
|
||||
|
||||
* Test :in-file header argument
|
||||
:PROPERTIES:
|
||||
:ID: 54EC49AA-FE9F-4D58-812E-00FC87FAF562
|
||||
:END:
|
||||
|
||||
#+BEGIN_SRC sed :in-file test1.txt
|
||||
s/test/tested/
|
||||
#+END_SRC
|
||||
|
||||
* Test :cmd-line header argument
|
||||
:PROPERTIES:
|
||||
:ID: E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1
|
||||
:END:
|
||||
|
||||
#+BEGIN_SRC sed :in-file test2.txt :cmd-line "-i"
|
||||
s/test/tested again/
|
||||
#+END_SRC
|
||||
88
lisp/org/testing/examples/ob-shell-test.org
Normal file
88
lisp/org/testing/examples/ob-shell-test.org
Normal file
@@ -0,0 +1,88 @@
|
||||
#+Title: a collection of examples for ob-shell tests
|
||||
#+OPTIONS: ^:nil
|
||||
|
||||
* Sample data structures
|
||||
#+NAME: sample_array
|
||||
| one |
|
||||
| two |
|
||||
| three |
|
||||
|
||||
#+NAME: sample_mapping_table
|
||||
| first | one |
|
||||
| second | two |
|
||||
| third | three |
|
||||
|
||||
#+NAME: sample_big_table
|
||||
| bread | 2 | kg |
|
||||
| spaghetti | 20 | cm |
|
||||
| milk | 50 | dl |
|
||||
|
||||
* Array tests
|
||||
:PROPERTIES:
|
||||
:ID: 0ba56632-8dc1-405c-a083-c204bae477cf
|
||||
:END:
|
||||
** Generic shell: no arrays
|
||||
#+begin_src sh :exports results :var array=sample_array
|
||||
echo ${array}
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: one two three
|
||||
|
||||
** Bash shell: support for arrays
|
||||
Bash will see a simple indexed array. In this test, we check that the
|
||||
returned value is indeed only the first item of the array, as opposed to
|
||||
the generic serialiation that will return all elements of the array as
|
||||
a single string.
|
||||
#+begin_src bash :exports results :var array=sample_array
|
||||
echo ${array}
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: one
|
||||
|
||||
* Associative array tests (simple map)
|
||||
:PROPERTIES:
|
||||
:ID: bec1a5b0-4619-4450-a8c0-2a746b44bf8d
|
||||
:END:
|
||||
** Generic shell: no special handing
|
||||
The shell will see all values as a single string.
|
||||
#+begin_src sh :exports results :var table=sample_mapping_table
|
||||
echo ${table}
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: first one second two third three
|
||||
|
||||
** Bash shell: support for associative arrays
|
||||
Bash will see a table that contains the first column as the 'index'
|
||||
of the associative array, and the second column as the value.
|
||||
#+begin_src bash :exports results :var table=sample_mapping_table
|
||||
echo ${table[second]}
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: two
|
||||
|
||||
* Associative array tests (more than 2 columns)
|
||||
:PROPERTIES:
|
||||
:ID: 82320a48-3409-49d7-85c9-5de1c6d3ff87
|
||||
:END:
|
||||
** Generic shell: no special handing
|
||||
#+begin_src sh :exports results :var table=sample_big_table
|
||||
echo ${table}
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: bread 2 kg spaghetti 20 cm milk 50 dl
|
||||
|
||||
** Bash shell: support for associative arrays with lists
|
||||
Bash will see an associative array that contains each row as a single
|
||||
string. Bash cannot handle lists in associative arrays.
|
||||
#+begin_src bash :exports results :var table=sample_big_table
|
||||
echo ${table[spaghetti]}
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: 20 cm
|
||||
|
||||
14
lisp/org/testing/examples/org-exp.org
Normal file
14
lisp/org/testing/examples/org-exp.org
Normal file
@@ -0,0 +1,14 @@
|
||||
#+Title: a collection of examples for export tests
|
||||
#+OPTIONS: ^:nil
|
||||
|
||||
* stripping commas from within blocks on export
|
||||
:PROPERTIES:
|
||||
:ID: 76d3a083-67fa-4506-a41d-837cc48158b5
|
||||
:END:
|
||||
The following commas should not be removed.
|
||||
|
||||
#+begin_src r
|
||||
a <- c(1
|
||||
, 2
|
||||
, 3)
|
||||
#+end_src
|
||||
25
lisp/org/testing/examples/property-inheritance.org
Normal file
25
lisp/org/testing/examples/property-inheritance.org
Normal file
@@ -0,0 +1,25 @@
|
||||
#+property: header-args :var foo=1
|
||||
#+property: header-args+ :var bar=2
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(+ foo bar)
|
||||
#+end_src
|
||||
|
||||
* overwriting a file-wide property
|
||||
:PROPERTIES:
|
||||
:header-args: :var foo=7
|
||||
:END:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
foo
|
||||
#+end_src
|
||||
|
||||
* appending to a file-wide property
|
||||
:PROPERTIES:
|
||||
:header-args+: :var baz=3
|
||||
:END:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(+ foo bar baz)
|
||||
#+end_src
|
||||
|
||||
1
lisp/org/testing/examples/pub-symlink/link.org
Normal file
1
lisp/org/testing/examples/pub-symlink/link.org
Normal file
@@ -0,0 +1 @@
|
||||
Symlink
|
||||
9
lisp/org/testing/examples/pub/a.org
Normal file
9
lisp/org/testing/examples/pub/a.org
Normal file
@@ -0,0 +1,9 @@
|
||||
#+title: A
|
||||
#+date: <2014-03-04 Tue>
|
||||
|
||||
* Headline1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: a1
|
||||
:END:
|
||||
|
||||
[[file:b.org::*Headline1]]
|
||||
9
lisp/org/testing/examples/pub/b.org
Normal file
9
lisp/org/testing/examples/pub/b.org
Normal file
@@ -0,0 +1,9 @@
|
||||
#+title: b
|
||||
#+date: <2012-03-29 Thu>
|
||||
|
||||
* Headline1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: b1
|
||||
:END:
|
||||
|
||||
[[file:a.org::#a1]]
|
||||
1
lisp/org/testing/examples/pub/file.txt
Normal file
1
lisp/org/testing/examples/pub/file.txt
Normal file
@@ -0,0 +1 @@
|
||||
Text
|
||||
1
lisp/org/testing/examples/pub/link
Symbolic link
1
lisp/org/testing/examples/pub/link
Symbolic link
@@ -0,0 +1 @@
|
||||
../pub-symlink
|
||||
1
lisp/org/testing/examples/pub/noextension
Normal file
1
lisp/org/testing/examples/pub/noextension
Normal file
@@ -0,0 +1 @@
|
||||
No extension
|
||||
2
lisp/org/testing/examples/pub/sub/c.org
Normal file
2
lisp/org/testing/examples/pub/sub/c.org
Normal file
@@ -0,0 +1,2 @@
|
||||
#+title: C
|
||||
#+date: <2013-03-20 Wed>
|
||||
1
lisp/org/testing/examples/setupfile.org
Normal file
1
lisp/org/testing/examples/setupfile.org
Normal file
@@ -0,0 +1 @@
|
||||
#+SETUPFILE: subdir/setupfile2.org
|
||||
6
lisp/org/testing/examples/setupfile3.org
Normal file
6
lisp/org/testing/examples/setupfile3.org
Normal file
@@ -0,0 +1,6 @@
|
||||
#+BIND: variable value
|
||||
#+DESCRIPTION: l2
|
||||
#+LANGUAGE: en
|
||||
#+SELECT_TAGS: b
|
||||
#+TITLE: b
|
||||
#+PROPERTY: a 1
|
||||
1
lisp/org/testing/examples/subdir/setupfile2.org
Normal file
1
lisp/org/testing/examples/subdir/setupfile2.org
Normal file
@@ -0,0 +1 @@
|
||||
#+SETUPFILE: ../setupfile3.org
|
||||
Reference in New Issue
Block a user