[
https://issues.apache.org/jira/browse/EXEC-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13891621#comment-13891621
]
Gary Gregory commented on EXEC-82:
----------------------------------
Please attach your tests as a patch file so we can add them to the code base.
> Losing Single Quotes
> ---------------------
>
> Key: EXEC-82
> URL: https://issues.apache.org/jira/browse/EXEC-82
> Project: Commons Exec
> Issue Type: Bug
> Affects Versions: 1.2
> Environment: OSX JDK 1.7
> Reporter: Kevin Brown
>
> if I have a single quote at the end of my argument it disappears. Sometimes
> one at the beginning disappears as well. These test cases are not intended
> to be comprehensive.
> @Test
> public void testCommandLineQuoting1() {
> CommandLine cmdLine = new CommandLine("foo.sh");
> cmdLine.addArgument("12'3'4");
> assertEquals("[foo.sh, \"12'3'4\"]", cmdLine.toString()); //OK
> }
> @Test
> public void testCommandLineQuoting2() {
> CommandLine cmdLine = new CommandLine("foo.sh");
> cmdLine.addArgument("12'3'");
> assertEquals("[foo.sh, \"12'3'\"]", cmdLine.toString());
> //Expected :[foo.sh, "12'3'"]
> //Actual :[foo.sh, "12'3"]
> }
> @Test
> public void testCommandLineQuoting3() {
> CommandLine cmdLine = new CommandLine("foo.sh");
> cmdLine.addArgument("'123'");
> assertEquals("[foo.sh, \"'123'\"]", cmdLine.toString());
> //Expected :[foo.sh, "'123'"]
> //Actual :[foo.sh, 123]
> }
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)