Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[JENKINS-17876] Directly invoke QuotedStringTokenizer so quotes can b…
…e preserved in both the installation default args and the instance args.
- Loading branch information
Showing
with
47 additions
and 8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,32 @@ | ||
package hudson.plugins.msbuild; | ||
|
||
import org.junit.Test; | ||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* | ||
* @author Jonathan Zimmerman | ||
*/ | ||
public class MsBuildBuilderTest { | ||
|
||
@Test | ||
public void shouldRetainQuotedArguments() { | ||
final String platform = "/p:Platform=\"Any CPU\""; | ||
|
||
String[] tokenizedArgs = MsBuildBuilder.tokenizeArgs(platform); | ||
assertNotNull(tokenizedArgs); | ||
assertEquals(1, tokenizedArgs.length); | ||
assertEquals(platform, tokenizedArgs[0]); | ||
} | ||
|
||
@Test | ||
public void shouldSplitArguments() { | ||
final String arguments = "/t:Build /p:Configuration=Debug"; | ||
|
||
String[] tokenizedArgs = MsBuildBuilder.tokenizeArgs(arguments); | ||
assertNotNull(tokenizedArgs); | ||
assertEquals(2, tokenizedArgs.length); | ||
assertEquals("/t:Build", tokenizedArgs[0]); | ||
assertEquals("/p:Configuration=Debug", tokenizedArgs[1]); | ||
} | ||
} |