Add public String[] getRawCommandline() to avoid OS dependency code in unit tests by zosrothko · Pull Request #68 · codehaus-plexus/plexus-utils
String[] commandLine = cl.getCommandline();
if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
{
if ( Os.isFamily( Os.FAMILY_WIN9X ) )
{
assertArrayEquals( new String[] { "command.com", "/C", "\"gcc -Ip1 -Ip2 -Isp1 -Isp2 -o object.o -c source.c\"" }, commandLine );
}
else
{
assertArrayEquals( new String[] { "cmd.exe", "/X", "/C", "\"gcc -Ip1 -Ip2 -Isp1 -Isp2 -o object.o -c source.c\"" }, commandLine );
}
}
else
{
assertArrayEquals( new String[] { "gcc", "-Ip1", "-Ip2", "-Isp1", "-Isp2", simpleArgv[0], simpleArgv[1],
simpleArgv[2], simpleArgv[3] }, commandLine );
}
this PR introduces the function public String[] getRawCommandline() so that the above code be reformated as
String[] commandLine = cl.getRawCommandline();
assertArrayEquals( new String[] { "gcc", "-Ip1", "-Ip2", "-Isp1", "-Isp2", simpleArgv[0], simpleArgv[1],
simpleArgv[2], simpleArgv[3] }, commandLine );