Browse Source

ob-java: Define the list of all supported header arguments

* lisp/ob-java.el (org-babel-header-args:java): Complete the list of
header arguments supported for Java source blocks.
* testing/lisp/test-ob-java.el (ob-java/lint-header-arguments): Test
that the linter approves of all the supported arguments.
Rudolf Adamkovič 1 year ago
parent
commit
ee3dbb0fdb
2 changed files with 24 additions and 1 deletions
  1. 7 1
      lisp/ob-java.el
  2. 17 0
      testing/lisp/test-ob-java.el

+ 7 - 1
lisp/ob-java.el

@@ -53,7 +53,13 @@ directory, so we keep that as the default behavior.
 
 [1] https://orgmode.org/manual/Results-of-Evaluation.html")
 
-(defconst org-babel-header-args:java '((imports . :any))
+(defconst org-babel-header-args:java
+  '((dir       . :any)
+    (classname . :any)
+    (imports   . :any)
+    (cmpflag   . :any)
+    (cmdline   . :any)
+    (cmdarg    . :any))
   "Java-specific header arguments.")
 
 (defcustom org-babel-java-command "java"

+ 17 - 0
testing/lisp/test-ob-java.el

@@ -21,9 +21,26 @@
 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
+
 (require 'org-test "../testing/org-test")
 (require 'ob-core)
 
+;;; No Java required
+
+(ert-deftest ob-java/lint-header-arguments ()
+  (org-test-with-temp-text "
+#+header: :dir /tmp
+#+header: :classname com.example.Example
+#+header: :imports com.example.OtherExample
+#+header: :cmpflag -classpath .:/tmp/example/
+#+header: :cmdline -classpath .:/tmp/example/
+#+header: :cmdarg -verbose
+#+begin_src java
+#+end_src"
+    (should-not (org-lint '(wrong-header-argument)))))
+
+;;; Java required
+
 (org-test-for-executable "java")
 (org-test-for-executable "javac")
 (unless (featurep 'ob-java)