Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public String[] getRawCommandline() to avoid OS dependency code in unit tests #68

Merged
merged 1 commit into from Sep 28, 2019

Conversation

zosrothko
Copy link
Contributor

Hi

In order to avoid such bad OS dependency code as below

        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 );

@hboutemy hboutemy self-requested a review September 28, 2019 16:51
@hboutemy hboutemy merged commit 6f15ab2 into codehaus-plexus:master Sep 28, 2019
@hboutemy hboutemy added this to the 3.3.0 milestone Sep 28, 2019
@zosrothko
Copy link
Contributor Author

@hboutemy Any idea when the 3.3.0 version will be released?

@slachiewicz
Copy link
Member

it's ready: https://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/3.3.0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants