From: santorini lysias <santorinilysias@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Reporting org-babel bug for java
Date: Thu, 30 Mar 2017 18:27:53 -0700 [thread overview]
Message-ID: <CABUVz_P64TsKyEsdPqVV+p6PZgjKU6VuqX7F1c3pdrHH29J35Q@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2916 bytes --]
Hello,
I've never used a mailing list before, so bear with me if I'm not "doing
this right."
I found behavior that I think is a bug and not a feature. This is for
org-babel Java.
The content below the equals signs, below, comprise an org-mode file that I
will refer to in order to report the behavior that is the topic of this
post. Two Java jars are referenced in the classpaths and are needed in
order to run the code. They can be obtained from the Junit download page.
This code basically runs a Junit test. The concern I have is with this line:
#+begin_src java :classname ParameterizedTest :cmpflag "-cp
~/Linux/rep/junit-4.12.jar:~/Linux/rep/hamcrest-core-1.3.jar:." :cmdline
"-cp ~/Linux/rep/junit-4.12.jar:~/Linux/rep/hamcrest-core-1.3.jar:."
If I press C-c C-c on this block of code, it runs fine. However, if the
string after :cmpflag is written as "-cp
.:~/Linux/rep/junit-4.12.jar:~/Linux/rep/hamcrest-core-1.3.jar" the
compilation of this Java class will fail because the Junit jar cannot be
located!
This only happens because I change the order of the jars as they appear in
the classpath. This is not a Java problem, since the order of items in the
classpath should not change Java behavior. I have to conclude there is
something happening in the org-babel code that is causing this.
Org-mode file below
=============
* calculator
#+begin_src java :classname Calculator :cmpflag "-cp ." :cmdline "-cp ."
public class Calculator{
public double add(double number1, double number2){
return number1+number2;
}
}
#+end_src
* parameterized test
#+begin_src java :classname ParameterizedTest :cmpflag "-cp
~/Linux/rep/junit-4.12.jar:~/Linux/rep/hamcrest-core-1.3.jar:." :cmdline
"-cp ~/Linux/rep/junit-4.12.jar:~/Linux/rep/hamcrest-core-1.3.jar:."
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Arrays;
import java.util.Collection;
@RunWith(value=Parameterized.class)
public class ParameterizedTest{
private double expected;
private double valueOne;
private double valueTwo;
@Parameters
public static Collection<Integer[]> getTestParameters(){
return Arrays.asList(new Integer[][]{
{2, 1, 1},
{3, 2, 1},
{4, 3, 1},
});
}
public ParameterizedTest(double expected, double valueOne, double
valueTwo){
this.expected = expected;
this.valueOne = valueOne;
this.valueTwo = valueTwo;
}
@Test
public void sum(){
Calculator calc = new Calculator();
assertEquals(expected, calc.add(valueOne, valueTwo), 0);
}
}
#+end_src
* run test
#+begin_src sh :results verbatim
java -cp
.:/home/ahan/Linux/rep/junit-4.12.jar:/home/ahan/Linux/rep/hamcrest-core-1.3.jar:
org.junit.runner.JUnitCore ParameterizedTest
#+end_src
#+RESULTS:
: JUnit version 4.12
: ...
: Time: 0.007
:
: OK (3 tests)
:
[-- Attachment #2: Type: text/html, Size: 3472 bytes --]
reply other threads:[~2017-03-31 1:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABUVz_P64TsKyEsdPqVV+p6PZgjKU6VuqX7F1c3pdrHH29J35Q@mail.gmail.com \
--to=santorinilysias@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).