Test failures on Windows
------------------------

                 Key: EXEC-25
                 URL: https://issues.apache.org/jira/browse/EXEC-25
             Project: Commons Exec
          Issue Type: Bug
            Reporter: Dennis Lundberg


When I run the tests for exec using 'mvn test' I get the following error.

junit.framework.AssertionFailedError: Arrays not equal
        at 
org.apache.commons.exec.CommandLineTest.assertEquals(CommandLineTest.java:31)
        at 
org.apache.commons.exec.CommandLineTest.testCommandLineParsingWithExpansion2(CommandLineTest.java:320)

As far as I can tell there are two problems with the code:

1. The test cases need to take into account that there are different file 
separators on Windows and Unix.
That's easy enough to fix. I just added this

{code}
    private String replaceFileSeparator(String input) {
        return input.replace('/', File.separatorChar).replace('\\', 
File.separatorChar);
    }
{code}

and wrapped the first element of the "expected" String arrays with it.

2. Variable substitution isn't performed correctly.
After adding the above I got test failures on Unix. I debugged the test case 
and found out that the value of the command line executable was this: " 
C:\Programme\jdk1.5.0_12/bin/java". This suggests to me that variable 
substitution is performed *after* CommandLine.setExecutable(String) is 
performed, resulting in an executable with possibly wrong file separators.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to