MT <[email protected]> writes:

> Thanks for the feedback.  It seems that the test didn't run on my local 
> machine due to the absence of Java.  Basically, such test cases are failing 
> because I removed the =org-trim=, so some of the existing ob functions that 
> are careless about blank lines are revealed now.  I tried to fix some others 
> (in ob-sql and ob-sqlite) as well, but if I miss some, it should all be easy 
> fix.

I applied the first two patches and the test is still failing for me.

    (ert-test-failed
     ((should
       (string=
        "package tangle;\n\npublic class Tangle {\n    public static void 
main(String[] args) {\n        return \"tangled\";\n    }\n}\n"
        (unwind-protect ... ... ...)))
      :form
      (string=
       "package tangle;\n\npublic class Tangle {\n    public static void 
main(String[] args) {\n        return \"tangled\";\n    }\n}\n"
       "package tangle;\npublic class Tangle {\n    public static void 
main(String[] args) {\n        return \"tangled\";\n    }\n}\n")
      :value nil :explanation
      (arrays-of-different-length 118 117
                                  "package tangle;\n\npublic class Tangle {\n   
 public static void main(String[] args) {\n        return \"tangled\";\n    
}\n}\n"
                                  "package tangle;\npublic class Tangle {\n    
public static void main(String[] args) {\n        return \"tangled\";\n    
}\n}\n"
                                  first-mismatch-at 16)))
   FAILED   128/1460  ob-java/tangle-with-package (0.003503 sec) at 
../lisp/test-ob-java.el:596

The original test looks like

(string=
      "package tangle;

public class Tangle {
    public static void main(String[] args) {
        return \"tangled\";
    }
}
"
      (unwind-protect ...))

Could you please explain why you removed the blank line before class
declaration in the patch?

> diff --git a/lisp/ob-java.el b/lisp/ob-java.el
> index ec0c99b5d..3657ca6dc 100644
> --- a/lisp/ob-java.el
> +++ b/lisp/ob-java.el
> @@ -367,7 +367,8 @@ is simplest to expand the code block from the inside out."
>        (when (not (re-search-forward org-babel-java--class-re nil t))
>          (org-babel-java--move-past org-babel-java--package-re) ; if package 
> is defined, move past it
>          (org-babel-java--move-past org-babel-java--imports-re) ; if imports 
> are defined, move past them
> -        (insert (concat "\npublic class " (file-name-base classname) " {\n"))
> +        (unless (bobp) (insert "\n"))
> +        (insert (concat "public class " (file-name-base classname) " {\n"))

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to