Mercurial > hg > mercurial
view mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommandTest.java @ 647:73425136baeb Gaya-8.0.x
More robust tests
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Wed, 25 Sep 2013 13:21:37 +0400 |
parents | efba721f9a1d |
children | 31a1aca3305c |
line wrap: on
line source
package jetbrains.buildServer.buildTriggers.vcs.mercurial.command; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.openapi.util.SystemInfo; import junit.framework.TestCase; import org.testng.annotations.Test; import java.io.File; import java.io.IOException; /** * @author dmitry.neverov */ @Test public class BaseCommandTest extends TestCase { public void should_quote_command_line_arguments() throws IOException { File workingDir = new File("some dir"); BaseCommand command = new BaseCommand(new CommandSettings(), "/path/to/hg", workingDir); GeneralCommandLine cl = command.createCommandLine(); cl.addParameter("param with spaces"); cl.addParameter("param with quote \" rm -rf /"); if (SystemInfo.isWindows) { assertTrue(cl.getCommandLineString().endsWith(" \"param with spaces\" \"param with quote \\\" rm -rf /\"")); } else { assertTrue(cl.getCommandLineString().endsWith(" param with spaces param with quote \" rm -rf /")); } } }