Commit Graph

143 Commits

Author SHA1 Message Date
Litvinov Sergey 0b7ae6ffb9 ob-octave.el: Add graphical output
* lisp/ob-octave.el: add graphical output to png file

    * testing/examples/ob-octave-test.org: add a test for graphical
      output, and a test for session
2011-12-17 09:04:20 -07:00
Eric Schulte b21da5f5d6 fixed bug in parsing of arguments to code block references
* lisp/ob-ref.el (org-babel-ref-split-args): Now uses
  `org-babel-balanced-split'.
* testing/lisp/test-ob.el (test-ob/splitting-variable-lists-in-references):
  Test new working behavior.
2011-12-12 17:19:40 -07:00
Eric Schulte 3bf8d8fd86 fixed regexp when resolving noweb references
* lisp/ob.el (org-babel-expand-noweb-references): Fixed regexp.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Test both named
  code block and noweb-ref header argument references.
2011-12-11 12:02:02 -07:00
Litvinov Sergey e6377a8295 Add string input variables to ob-octave.el. Add tests for ob-octave.el 2011-12-10 06:12:29 -07:00
Eric Schulte e0748cdebd tests for the colnames header argument 2011-11-28 11:23:42 -07:00
Eric Schulte a998cae722 the :eval header argument now takes 4(6) possible values
* doc/org.texi (eval): Documenting the full range of :eval header
  argument values.
* lisp/ob.el (org-babel-confirm-evaluate): Adding support for new
  range of :eval header arguments.
* testing/lisp/test-ob.el (test-ob/eval-header-argument): Testing the
  :eval header argument.
2011-11-22 07:32:39 -07:00
Eric Schulte 3693952e3b New option to update intermediate in-buffer results
* lisp/ob-ref.el (org-babel-update-intermediate): New custom variable.
  (org-babel-ref-resolve): Optionally update the in-buffer results of
  code blocks which are evaluated to resolve references.
2011-11-21 10:02:39 -07:00
Eric Schulte 82c0f9bf69 Allow spaces around "=" in code block variable specifications
* lisp/ob.el (org-babel-join-splits-near-ch): Rejoins a list of a
  split string when a character appears on either side of the split.
  (org-babel-parse-multiple-vars): Rejoin splits around "=" signs.
2011-11-20 09:40:08 -07:00
Eric Schulte 41387f4675 marked test as expected to pass, because it is now passing 2011-11-20 09:39:09 -07:00
Eric Schulte f55810593e don't try to evaluate #+call lines in verbatim blocks
* lisp/ob-exp.el (org-babel-exp-lob-one-liners): Don't limit
  in-verbatim check to inline code blocks, do lob code blocks as well.
* testing/lisp/test-ob-lob.el (test-ob-lob/do-not-eval-lob-lines-in-example-blocks-on-export):
  Test ensuring that #+call lines in verbatim blocks are not evaluated
2011-11-18 11:30:59 -07:00
Eric Schulte 1f206ed477 new testing macro for in-file execution with temp text
* testing/org-test.el (org-test-with-temp-text-in-file): A new testing
  macros for temp-text tests which require a file name (e.g., for
  export).
2011-11-18 11:30:59 -07:00
Eric Schulte 7c21098323 Don't match partial names when resolving code or data references
* lisp/ob.el (org-babel-named-src-block-regexp-for-name): Ensure that
  partial names are not matched.
  (org-babel-named-data-regexp-for-name): Ensure that partial names
  are not matched.
* testing/lisp/test-ob.el (test-ob/do-not-resolve-to-partial-names-data):
  Test to ensure that partial names are not matched.
2011-11-16 06:15:31 -07:00
Eric Schulte 19884ab280 resolve named code blocks before named data
* lisp/ob-ref.el (org-babel-ref-resolve): Search for named code blocks
  before named data.
* lisp/ob.el (org-babel-named-data-regexp-for-name): New function for
  finding named data.
* testing/lisp/test-ob.el (test-ob/resolve-code-blocks-before-data-blocks):
  Test to ensure that named references are resolved in the correct
  order.
2011-11-15 20:13:41 -07:00
Eric Schulte 1b6de8fad5 ignore org-id file generated during testing 2011-11-15 11:19:39 -07:00
Eric Schulte c21692506d fix bug missing references to example blocks
* lisp/ob-ref.el (org-babel-ref-resolve): Don't change location when
  looking at the contents.
* testing/lisp/test-ob.el (test-ob/catches-all-references): Test
  enforcing the correct behavior.
2011-11-15 11:18:26 -07:00
Eric Schulte 9702f5520e revert changes to interactive function `org-test-run-all-tests' 2011-11-15 08:56:25 -07:00
Martyn Jago 0440b83ac5 Changes to fix sandboxed tests to suit the standard code block syntax, and some changes to reduce ID testing scope and improve result gathering. * testing/org-test.el: Add org as an executable language for sand-boxed testing to suit the standard code block syntax. Use .org-test-id-locations as ID file temporarily whilst testing. Add `org-test-update-id-locations' to do just that. Clear *Messages* buffer and temporarily set `message-log-max to t to ensure capturing entire test backtrace.
* testing/.gitignore: ignore testing/.org-test-id-locations
2011-11-15 08:56:25 -07:00
Eric Schulte 83dfaa5c8f named code blocks are replaced with their results
* lisp/ob.el (org-babel-find-named-result): Downcase "name" before comparison.
* testing/lisp/test-ob.el (test-ob/does-not-replace-a-block-with-the-results):
  Test that named code blocks are replaced with their results.
2011-11-15 08:56:25 -07:00
Eric Schulte 630b9c80ca Indicate tests with missing dependencies by adding a expected failing test
* testing/lisp/test-ob-R.el (featurep): Signal missing dependencies
  with an error rather than a throw.
* testing/org-test.el (missing-test-dependency): Define the error
  signal for missing dependencies.
  (org-test-for-executable): Signal missing dependencies with an error
  rather than a throw.
  (org-test-load): Define an expected failing test for each file with
  missing dependencies.
2011-11-15 08:56:25 -07:00
Martyn Jago 49d6951caa Fix don't load symlinks (Emacs interlocking files) * testing/org-test.el: During test development various interlocking files may be present in testing/lisp directory (since they are being edited by emacs). Currently org-test-load will attempt to load these 2011-11-15 08:56:25 -07:00
Martyn Jago 0cc18ed120 Avoid loading (and failing) symbolic links (interlocking files) * testing/org-test.el: During test development various interlocking files may be present in testing/lisp directory (since they are being edited by emacs). Currently org-test-load will attempt to load these and fail. 2011-11-15 08:56:25 -07:00
Eric Schulte f98ee77b38 tests protecting nested code blocks
* testing/lisp/test-ob.el (test-org-babel/nested-code-block):
  Evaluation of a nested block.
  (test-org-babel/partial-nested-code-block): Evaluation of a
  partially nested block.
2011-11-15 08:56:25 -07:00
Eric Schulte 1ed12cac1a passing all tests after code block syntax changes
* lisp/ob-exp.el (org-babel-in-example-or-verbatim): Some valid
  execution contexts (e.g., call lines) look like commented lines.
* lisp/ob.el (org-babel-get-src-block-info): Empty match string
  doesn't count.
  (org-babel-process-params): Always process parameters, even if you
  don't to table splitting.
* testing/lisp/test-ob-C.el (ob-C/table): Ignore failures for this C
  test.
* testing/lisp/test-ob-fortran.el (ob-fortran/input-var): Ignore
  failures for this fortran test.
2011-11-15 08:56:24 -07:00
Eric Schulte 3af89e696a property names ending in plus accumulate
This results in the following behavior.

  #+property: var  foo=1
  #+property: var+ bar=2

  #+begin_src emacs-lisp
    (+ foo bar)
  #+end_src

  #+results:
  : 3

  #+begin_src emacs-lisp
    (org-entry-get (point) "var" t)
  #+end_src

  #+results:
  : foo=1 bar=2

  * overwriting a file-wide property
    :PROPERTIES:
    :var:      foo=7
    :END:

  #+begin_src emacs-lisp
    foo
  #+end_src

  #+results:
  : 7

  #+begin_src emacs-lisp
    (org-entry-get (point) "var" t)
  #+end_src

  #+results:
  : foo=7

  * appending to a file-wide property
    :PROPERTIES:
    :var+:      baz=3
    :END:

  #+begin_src emacs-lisp
    (+ foo bar baz)
  #+end_src

  #+results:
  : 6

  #+begin_src emacs-lisp
    (org-entry-get (point) "var" t)
  #+end_src

  #+results:
  : foo=1 bar=2 baz=3

* lisp/org.el (org-update-property-plist): Updates a given property
  list with a property name and a property value.
  (org-set-regexps-and-options): Use org-update-property-plist.
  (org-entry-get): Use org-update-property-plist.
* testing/examples/property-inheritance.org: Example file for testing
  appending property behavior.
* testing/lisp/test-property-inheritance.el: Tests of appending
  property behavior.
* lisp/ob.el (org-babel-balanced-split): Allow splitting on single
  characters as well as groups of two characters.
  (org-babel-parse-multiple-vars): Split variables on single spaces.
2011-11-15 08:56:24 -07:00
Eric Schulte 7e93b90f88 Standardized code block keywords
Nick Dokos <nicholas.dokos@hp.com> writes:

> Eric Schulte <schulte.eric@gmail.com> wrote:
>
>> The attached updated patch fixes a bug in the original.
>>
>
> Minor problem in applying:
>
> ,----
> | $ git apply ~/Mail/inbox/724
> | /home/nick/Mail/inbox/724:671: trailing whitespace.
> | #+name:
> | /home/nick/Mail/inbox/724:599: new blank line at EOF.
> | +
> | warning: 2 lines add whitespace errors.
> `----

The attached version fixes these issues, Thanks -- Eric

>From 0e43d59ee8d46a63f86780a502de726271bc39de Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Fri, 28 Oct 2011 10:44:21 -0600
Subject: [PATCH] removing code block, results and call-line synonyms -- BREAKING CHANGE

Following a round of on-list discussion many code block synonyms have
been removed, moving forward the following syntax is valid.

- call lines are specified with #+call:
- code blocks are named with #+name:
- results are named with #+name:, however results generated by a code
  block may still be labeled with #+results:, and tables named with
  #+tblname: will be considered to be named results

The following function may be used to update an existing Org-mode
buffer to the new syntax.

  (defun update-org-buffer ()
    "Update an Org-mode buffer to the new data, code block and call line syntax."
    (interactive)
    (save-excursion
      (flet ((to-re (lst) (concat "^[ \t]*#\\+" (regexp-opt lst t)
                                  "\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*"))
             (update (re new)
                     (goto-char (point-min))
                     (while (re-search-forward re nil t)
                       (replace-match new nil nil nil 1))))
        (let ((old-re (to-re '("RESULTS" "DATA" "SRCNAME" "SOURCE")))
              (lob-re (to-re '("LOB")))
              (case-fold-search t))
          (update old-re "name")
          (update lob-re "call")))))

Note: If an old version of Org-mode (e.g., the one shipped with Emacs)
      is installed on your system many of the important variables will
      be pre-defined with a defvar and *will not* have their values
      automatically updated, these include the following.
      - org-babel-data-names
      - org-babel-result-regexp
      - org-babel-src-block-regexp
      - org-babel-src-name-regexp
      - org-babel-src-name-w-name-regexp
      It may be necessary to either remove the source code of older
      versions of Org-mode, or to explicitly evaluate the ob.el file.

* lisp/ob-exp.el (org-exp-res/src-name-cleanup): Updated
  Documentation.
* lisp/ob-lob.el (org-babel-block-lob-one-liner-regexp): Updated
  regular expression.
  (org-babel-inline-lob-one-liner-regexp): Updated regular expression.
* lisp/ob-ref.el (org-babel-ref-resolve): Notice when something that
  looks like a data results may actually be a code block.
* lisp/ob-table.el: Updated documentation.
* lisp/ob.el (org-babel-src-name-regexp): Simplified regexp.
  (org-babel-get-src-block-info): Updated match strings.
  (org-babel-data-names): Simplified acceptable names.
  (org-babel-find-named-block): Indentation.
  (org-babel-find-named-result): Updated to not return a code block as
  a result.
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Removing
  references to old syntactic elements.
  (org-additional-option-like-keywords): Removing references to old
  syntactic elements.
* contrib/babel/library-of-babel.org: Updated to make use of the new
  syntax.
* testing/examples/babel-dangerous.org: Updated to make use of the new
  syntax.
* testing/examples/babel.org: Updated to make use of the new syntax.
* testing/examples/ob-awk-test.org: Updated to make use of the new
  syntax.
* testing/examples/ob-fortran-test.org: Updated to make use of the new
  syntax.
* testing/lisp/test-ob.el: Removed two bad tests which tested the
  literal values of old regular expressions rather than their
  behavior.
2011-11-15 08:56:24 -07:00
Eric Schulte 7720786c41 fix whitespace errors 2011-11-08 13:52:11 -07:00
Litvinov Sergey fddd85a172 construct a table from the output of maxima code block
Please consider a patch to construct a table from the output of maxima
code block.

>From a0305117f4e793c93d7d10bc7aab04f96bd62e9c Mon Sep 17 00:00:00 2001
From: Litvinov Sergey <slitvinov@gmail.com>
Date: Sat, 1 Oct 2011 22:29:18 +0200
Subject: [PATCH] [ob-maxima] Construct a table from the output of the code block. Add
 ert tests.
2011-11-08 13:51:27 -07:00
Eric Schulte 7e7ecb6db9 fix whitespace errors 2011-11-08 13:44:23 -07:00
Litvinov Sergey 9154641593 cpp->c++-mode, ob-C mode tests
The first patch maps cpp language code to c++-mode. The second patch
adds tests for ob-C.

>From fba6eef6944766e675e4abe1d11d347b9a728031 Mon Sep 17 00:00:00 2001
From: Sergey Litvinov <slitvinov@gmail.com>
Date: Wed, 3 Aug 2011 22:03:19 +0200
Subject: [PATCH 2/2] Add tests for ob-C.el
2011-11-08 13:41:43 -07:00
Litvinov Sergey 8d3a4da034 Extend ob-maxima: add input variables and graphic output
* lisp/ob-maxima.el (org-babel-tangle-lang-exts): Maxima extension.
  (org-babel-maxima-expand): Add input variables and graphic output.
  (org-babel-execute:maxima): Add input variables and graphic output.
  (org-babel-maxima-var-to-maxima): Add input variables and graphic
  output.
  (org-babel-maxima-graphical-output-file): Add input variables and
  graphic output.
  (org-babel-maxima-elisp-to-maxima): Add input variables and graphic
  output.
* testing/examples/ob-maxima-test.org: Examples for new Maxima
  behavior.
2011-11-08 13:40:23 -07:00
Tassilo Horn 4bbdfd229d Replace org-mode-p with usual (eq major-mode 'org-mode) check
Additionally, replace one

  (or (org-mode-p) (derived-mode-p 'org-mode))

with

  (derived-mode-p 'org-mode)

cause that is reflexive anyway (returns true, if the current mode is
org-mode).

Delete one check testing for org-mode or org derived mode
2011-10-22 11:29:24 +02:00
Eric Schulte 832fd8b415 less hacky check for executables when loading tests
* testing/org-test.el (org-test-for-executable): Less hacky check for
  executables when loading tests.
2011-09-26 06:16:55 -06:00
David Maus d5722a7b6c Use macro to compose html link export tests
* lisp/test-org-html.el (org-test-html/export-link): New
macro. Compose link export test.
(test-org-html/export-link-factory)
(test-org-html/export-link-alist): Remove factory variable and
function, use new macro instead.
2011-09-25 09:49:39 +02:00
David Maus 07d11a6847 Make sure Org mode is turned on after loading the example file
* org-test.el (org-test-in-example-file): Make sure Org mode is turned
on after loading the example file.
2011-09-25 09:26:50 +02:00
Eric Schulte 4446e50e3d org tests using throw/catch rather than errors to avoid loading unsupported tests 2011-09-24 15:57:14 -06:00
Eric Schulte c8c804e917 update function documentation for `org-test-with-temp-text'
* testing/org-test.el (org-test-with-temp-text): Update function documentation.
2011-09-23 15:49:31 -06:00
Eric Schulte 25a066d5b6 catching more general errors during recursive load of test files
* testing/org-test.el (org-test-load): Catching more general errors
  during recursive load.
2011-09-23 09:57:40 -06:00
Eric Schulte b3e322125d testing that results are duplicated -- By Sebastien Vauban
* testing/lisp/test-ob.el (test-org-babel/just-one-results-block):
  Ensure that result blocks are not duplicated.
2011-09-23 09:50:46 -06:00
Eric Schulte 8bff3bfc22 code cleanliness in test-ob.el
* testing/lisp/test-ob.el (test-org-babel/multi-line-header-regexp):
  Code cleanliness.
  (test-org-babel/inline-src_blk-default-results-replace-line-2): Code
  cleanliness.
  (test-org-babel/inline-src_blk-manual-results-replace): Code
  cleanliness.
  (test-org-babel/inline-src_blk-results-silent): Code cleanliness.
  (test-org-babel/inline-src_blk-results-raw): Code cleanliness.
  (test-org-babel/inline-src_blk-results-scalar): Code cleanliness.
  (test-org-babel/inline-src_blk-results-verbatim): Code cleanliness.
  (test-org-babel/no-defaut-value-for-var): Code cleanliness.
2011-09-23 09:50:01 -06:00
Eric Schulte decd7227f6 only load those test files for which the required executables are present
* testing/org-test.el (org-exe-not-found): An error type used to
  signal a missing executable
  (org-test-for-executable): A function used by test files to throw an
  error if a required executable is not present.
  (org-test-load): Simply skip files for which the required
  executables are not present.

* testing/lisp/test-ob-R.el: Conditional loading.
* testing/lisp/test-ob-awk.el: Conditional loading.
* testing/lisp/test-ob-fortran.el: Conditional loading.
2011-09-21 16:41:44 -06:00
Eric Schulte 20e670946e fix leftover cruft in test-ob-R.el 2011-09-21 13:31:38 -06:00
Eric Schulte 12f0fb2d75 adding a file for R tests
* testing/lisp/test-ob-R.el (test-ob-R/simple-session): Simple session
  test.
2011-09-21 09:10:22 -06:00
Martyn Jago cfc019073e Refactor tests to use `org-test-with-temp-text' * testing/lisp/test-ob.el: refactor 2011-09-21 09:10:22 -06:00
Martyn Jago 94c0f143dd Modifications to enable test script to run with emacs-23 and emacs-22 * testing/org-test.el: enable test script to run with emacs-23 and emacs-22 * testing/lisp/test-org-exp.el: added org-ascii requirement 2011-09-20 09:03:41 -06:00
Eric Schulte ded9f87ebc org-test-with-temp-text allows variable inputs holding strings
* testing/org-test.el (org-test-with-temp-text): Allow variable inputs
  holding strings.
2011-09-20 09:01:20 -06:00
Eric Schulte 9da40a0d6e Convenience macro for testing.
* testing/org-test.el (org-test-with-temp-text): Convenience macro for
  testing.
2011-09-19 10:01:32 -06:00
David Maus 56de2cf7a6 Explicitely set coding system for unescaped string
* test-org.el (test-org/org-link-unescape-ascii-extended-char):
Explicitely set coding system for unescaped string.

Needed for Emacs22 to pass these tests. The input string is extended
ASCII which is covered by latin-1 coding system.
2011-09-18 16:40:01 +02:00
David Maus ee957745db Conditionally define `special-mode' for Emacs22
* org-test.el: Conditionally define `special-mode' for Emacs22.

Copied definition from Emacs23's simple.el.
2011-09-18 10:35:50 +02:00
Eric Schulte 15a9eac67e isolating dangerous testing examples
* testing/examples/babel-dangerous.org: To house the dangerous.
* testing/examples/babel.org (an): Removed a trouble maker.
2011-09-16 09:52:34 -06:00
Sebastien Vauban cd05d152cf Add test checking that any variable declared with no default value will generate a proper error message. 2011-09-16 09:52:34 -06:00