Allows a space in a -selenium argument to JUnitShell. (allows an
argument of the form -selenium "<host>:4444/*custom firefox3" )
Strip off quotes before passing a quoted argument from JUnitShell.synthesizeArgs()
Patch by: zundel
Review by: jgw, scottb
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@3093 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/JUnitShell.java b/user/src/com/google/gwt/junit/JUnitShell.java
index 09d2bbe..a9161e5 100644
--- a/user/src/com/google/gwt/junit/JUnitShell.java
+++ b/user/src/com/google/gwt/junit/JUnitShell.java
@@ -710,8 +710,17 @@
//
Pattern pattern = Pattern.compile("[^\\s\"]+|\"[^\"\\\\]*(\\\\.[^\"\\\\]*)*\"");
Matcher matcher = pattern.matcher(args);
+ Pattern quotedArgsPattern = Pattern.compile("^([\"'])(.*)([\"'])$");
+
while (matcher.find()) {
- argList.add(matcher.group());
+ // Strip leading and trailing quotes from the arg
+ String arg = matcher.group();
+ Matcher qmatcher = quotedArgsPattern.matcher(arg);
+ if (qmatcher.matches()) {
+ argList.add(qmatcher.group(2));
+ } else {
+ argList.add(arg);
+ }
}
}
diff --git a/user/src/com/google/gwt/junit/RunStyleSelenium.java b/user/src/com/google/gwt/junit/RunStyleSelenium.java
index c8d8baf..211c093 100644
--- a/user/src/com/google/gwt/junit/RunStyleSelenium.java
+++ b/user/src/com/google/gwt/junit/RunStyleSelenium.java
@@ -68,12 +68,12 @@
public static RunStyle create(JUnitShell shell, String[] targetsIn) {
RCSelenium targets[] = new RCSelenium[targetsIn.length];
- Pattern pattern = Pattern.compile("([\\w\\.-]+):([\\d]+)/([\\w\\*]+)");
+ Pattern pattern = Pattern.compile("([\\w\\.-]+):([\\d]+)/([\\w\\s\\*]+)");
for (int i = 0; i < targets.length; ++i) {
Matcher matcher = pattern.matcher(targetsIn[i]);
if (!matcher.matches()) {
throw new JUnitFatalLaunchException("Unable to parse Selenium target "
- + targets[i] + " (expected format is [host]:[port]/[browser])");
+ + targetsIn[i] + " (expected format is [host]:[port]/[browser])");
}
RCSelenium instance = new RCSelenium(matcher.group(3), matcher.group(1),
Integer.parseInt(matcher.group(2)));