forked from mirrors/org-mode
81f2741bca
* lisp/ob-octave.el (org-babel-execute:octave): -Ensure that the special Octave variable `ans' is bound when GFX-FILE is non-nil. The glue code in ORG-BABEL-OCTAVE-WRAPPER-METHOD causes Octave to exit with a non-zero exit code when `ans' is not bound. -Change format control string to %S from %s. Ensure the graphics filename is quoted. If it is not, Octave may create a mis-named file or fail entirely. * testing/examples/ob-octave-test.org: Update the Graphical tests section: -put in the correct headers; -add a remark about where to find each test. * testing/lisp/test-ob-octave.el: Add the three tests ob-octave/graphics-file, ob-octave/graphics-file-session and ob-octave/graphics-file-space. -ob-octave/graphics-file: The first test verifies that the first bug identified above is fixed; it also verifies that graphics file creation works correctly for scripting. -ob-octave/graphics-file-session: The second test verifies graphics file creation works correctly for sessions. The Octave command `crash_dumps_octave_core(0)' is included to prevent the creation of a core file (`octave-workspace'). -ob-octave/graphics-file-space: The third test verifies that a graphics filename with a space in it is created correctly. Thanks to Ihor Radchenko for helpful feedback. Ref: https://list.orgmode.org/8735asbtfe.fsf@localhost/T/#u
64 lines
1.6 KiB
Org Mode
64 lines
1.6 KiB
Org Mode
#+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
|
|
|
|
Graphics file. This test is performed by =ob-octave/graphics-file= in =testing/lisp/test-ob-octave.el=.
|
|
#+begin_src octave :results file graphics :file sombrero.png
|
|
sombrero;
|
|
#+end_src
|
|
|
|
Graphics file in a session. This test is performed by =ob-octave/graphics-file-session= in =testing/lisp/test-ob-octave.el=.
|
|
#+begin_src octave :session :results graphics file :file sombrero.png
|
|
sombrero;
|
|
#+end_src
|
|
|
|
Graphics file with a space in name. This test is performed by =ob-octave/graphics-file-space= in =testing/lisp/test-ob-octave.el=.
|
|
#+begin_src octave :results graphics file :file sombrero hat.png
|
|
sombrero;
|
|
#+end_src
|