### Question:
SahiScript { String processSet(String line, int lineNumber) { String patternStr = "(.*)_set\\s*\\(\\s*([^,]*),\\s*(.*)\\)"; Pattern pattern = Pattern.compile(patternStr); Matcher matcher = pattern.matcher(line); boolean matchFound = matcher.find(); if (!matchFound) { return modifyLine(line); } else { String popupPrefix = matcher.group(1); String varName = matcher.group(2); String varValue = matcher.group(3); StringBuffer sb = new StringBuffer(); String tempVarName = varName.replaceAll("[$]", "\\\\\\$"); logger.debug("tempVarName="+tempVarName); sb.append(scheduleLine(popupPrefix + "_sahi.setServerVar('" + tempVarName + "', " + varValue + ");", lineNumber, true)); sb.append(modifyLine(varName + " = _sahi.getServerVar('" + tempVarName + "');")); return sb.toString(); } } SahiScript(String filePath, ArrayList<String> parents, String scriptName); String jsString(); String modifiedScript(); String getDebugInfo(int lineNumber); String getLineDebugInfo(int lineNumber); static boolean lineStartsWithActionKeyword(String line); static String modifySingleLine(String line); static String modifyFunctionNames(String unmodified); static String stripSahiFromFunctionNames(String unmodified); static ArrayList<String> getActionKeyWords(); static ArrayList<String> getKeyWords(); String modifyCondition(String s, int lineNumber); String getScriptName(); String getOriginal(); String getOriginalInHTML(); String getFilePath(); String getBrowserJS(); void addIncludeInfo(SahiScript included); String getBrowserJSWithLineNumbers();  }### Answer:
@Test public void testProcessSet() { assertEquals("_sahi.schedule(\"_sahi.setServerVar('abc', document.links);\", \"scrName&n=23\");\r\nabc = _sahi.getServerVar('abc');\r\n", testScript.processSet("_set(abc, document.links)", 23)); assertEquals("_sahi.schedule(\"_sahi.setServerVar('abc', getLinks());\", \"scrName&n=23\");\r\nabc = _sahi.getServerVar('abc');\r\n", testScript.processSet("_set( abc, getLinks())", 23)); assertEquals("_sahi.schedule(\"_sahi.setServerVar('\\\\$abc', getLinks());\", \"scrName&n=23\");\r\n$abc = _sahi.getServerVar('\\$abc');\r\n", testScript.processSet("_set( $abc, getLinks())", 23)); assertEquals("_sahi.schedule(\"_sahi.setServerVar('\\\\$abc[\\\\$i]', getLinks());\", \"scrName&n=23\");\r\n$abc[$i] = _sahi.getServerVar('\\$abc[\\$i]');\r\n", testScript.processSet("_set( $abc[$i], getLinks())", 23)); assertEquals("_sahi.schedule(\"_sahi._popup('win')._sahi.setServerVar('abc', document.links);\", \"scrName&n=23\");\r\nabc = _sahi.getServerVar('abc');\r\n", testScript.processSet("_popup('win')._set(abc, document.links)", 23)); }
@Test public void testQuotedDollarVariables() { assertEquals("_sahi.schedule(\"_sahi.setServerVar('abc', \\\"$url\\\");\", \"scrName&n=23\");\r\nabc = _sahi.getServerVar('abc');\r\n", testScript.processSet("_set(abc, \"$url\")", 23)); }