package jetbrains.mps.execution.impl.configurations.tests.commands; /*Generated by MPS */ import junit.framework.TestCase; import junit.framework.Assert; import java.util.Arrays; import jetbrains.mps.internal.collections.runtime.Sequence; import jetbrains.mps.execution.api.commands.ProcessHandlerBuilder; public class SplitCommandInParts_Test extends TestCase { public void test_withoutSpaces() throws Exception { Assert.assertTrue(Arrays.equals(Sequence.fromIterable(ProcessHandlerBuilder.splitCommandInParts("commandwithoutspaces")).toGenericArray(String.class), new String[]{"commandwithoutspaces"})); } public void test_withSpaces() throws Exception { Assert.assertTrue(Arrays.equals(Sequence.fromIterable(ProcessHandlerBuilder.splitCommandInParts("command with spaces")).toGenericArray(String.class), new String[]{"command", "with", "spaces"})); } public void test_javaProperties() throws Exception { Assert.assertTrue(Arrays.equals(Sequence.fromIterable(ProcessHandlerBuilder.splitCommandInParts("-Dxx=xxx -Dyyy=\"YYY YYY YYY\" -Dzz=zzz")).toGenericArray(String.class), new String[]{"-Dxx=xxx", "-Dyyy=YYY YYY YYY", "-Dzz=zzz"})); } public void test_javaCommand() throws Exception { Assert.assertTrue(Arrays.equals(Sequence.fromIterable(ProcessHandlerBuilder.splitCommandInParts("\"C:\\Program Files (x86)\\Java\\java.exe\" -Dxx=xxx -Dyyy=\"YYY YYY YYY\" -Dzz=zzz -classpath \"C:\\MPS 2.0\\lib\\mps.jar\":\"C:\\MPS 2.0\\lib\\idea-patch.jar\":C:\\Path jetbrains.mps.Launcher")).toGenericArray(String.class), new String[]{"C:\\Program Files (x86)\\Java\\java.exe", "-Dxx=xxx", "-Dyyy=YYY YYY YYY", "-Dzz=zzz", "-classpath", "C:\\MPS 2.0\\lib\\mps.jar:C:\\MPS 2.0\\lib\\idea-patch.jar:C:\\Path", "jetbrains.mps.Launcher"})); } public void test_quotsInCommand() throws Exception { Assert.assertTrue(Arrays.equals(Sequence.fromIterable(ProcessHandlerBuilder.splitCommandInParts("-Dxxx=xxx -Dquoted=\\\"Quoted!\\\" -Dyyy=yyy")).toGenericArray(String.class), new String[]{"-Dxxx=xxx", "-Dquoted=\"Quoted!\"", "-Dyyy=yyy"})); } public void test_quotsInCommandStart() throws Exception { Assert.assertTrue(Arrays.equals(Sequence.fromIterable(ProcessHandlerBuilder.splitCommandInParts("\\\"Quoted!\\\" -Dyyy=yyy ")).toGenericArray(String.class), new String[]{"\"Quoted!\"", "-Dyyy=yyy"})); } public void test_quotsInCommandEnd() throws Exception { Assert.assertTrue(Arrays.equals(Sequence.fromIterable(ProcessHandlerBuilder.splitCommandInParts("-Dxxx=xxx -Dquoted=\\\"Quoted!\\\"")).toGenericArray(String.class), new String[]{"-Dxxx=xxx", "-Dquoted=\"Quoted!\""})); } public SplitCommandInParts_Test() { } }