[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/scannersTests ScriptScannerTest.java,1.27,1.28
Brought to you by:
derrickoswald
From: <so...@us...> - 2003-06-17 00:43:13
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests In directory sc8-pr-cvs1:/tmp/cvs-serv935/src/org/htmlparser/tests/scannersTests Modified Files: ScriptScannerTest.java Log Message: fixed ScriptScanner failing tests.. Index: ScriptScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/ScriptScannerTest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ScriptScannerTest.java 1 Jun 2003 20:50:16 -0000 1.27 --- ScriptScannerTest.java 17 Jun 2003 00:43:08 -0000 1.28 *************** *** 117,121 **** StringBuffer sb2 = new StringBuffer(); ! sb2.append("if(navigator.appName.indexOf(\"Netscape\") != -1)\r\n"); sb2.append(" document.write ('xxx');\r\n"); sb2.append("else\r\n"); --- 117,121 ---- StringBuffer sb2 = new StringBuffer(); ! sb2.append("\r\nif(navigator.appName.indexOf(\"Netscape\") != -1)\r\n"); sb2.append(" document.write ('xxx');\r\n"); sb2.append("else\r\n"); *************** *** 172,176 **** ScriptTag scriptTag = (ScriptTag)node[0]; String scriptCode = scriptTag.getScriptCode(); ! String expectedCode = "<!--\r\n"+ " function validateForm()\r\n"+ " {\r\n"+ --- 172,176 ---- ScriptTag scriptTag = (ScriptTag)node[0]; String scriptCode = scriptTag.getScriptCode(); ! String expectedCode = "\r\n<!--\r\n"+ " function validateForm()\r\n"+ " {\r\n"+ *************** *** 180,184 **** " return true;\r\n"+ " }\r\n"+ ! "// -->"; assertStringEquals("Expected Code",expectedCode,scriptCode); } --- 180,184 ---- " return true;\r\n"+ " }\r\n"+ ! "// -->\r\n"; assertStringEquals("Expected Code",expectedCode,scriptCode); } *************** *** 561,565 **** public void testScanScriptWithTagsInComment() throws ParserException { ! String javascript = "// This is javascript with <li> tag in the comment\n"; createParser("<script>\n"+ javascript + "\n</script>"); parser.registerScanners(); --- 561,565 ---- public void testScanScriptWithTagsInComment() throws ParserException { ! String javascript = "// This is javascript with <li> tag in the comment"; createParser("<script>\n"+ javascript + "\n</script>"); parser.registerScanners(); *************** *** 568,572 **** ScriptTag scriptTag = (ScriptTag)node[0]; String scriptCode = scriptTag.getScriptCode(); ! assertStringEquals("Expected Code",javascript,scriptCode); } --- 568,578 ---- ScriptTag scriptTag = (ScriptTag)node[0]; String scriptCode = scriptTag.getScriptCode(); ! String expectedCode = ! wrapLineSeperatorAround(javascript); ! assertStringEquals("Expected Code",expectedCode,scriptCode); ! } ! ! private String wrapLineSeperatorAround(String javascript) { ! return Parser.getLineSeparator()+javascript+Parser.getLineSeparator(); } *************** *** 576,579 **** --- 582,586 ---- "that spans multiple lines;"; createParser("<script>\n"+ javascript + "\n</script>"); + Parser.setLineSeparator("\n"); parser.registerScanners(); parseAndAssertNodeCount(1); *************** *** 581,585 **** ScriptTag scriptTag = (ScriptTag)node[0]; String scriptCode = scriptTag.getScriptCode(); ! assertStringEquals("Expected Code",javascript,scriptCode); } --- 588,595 ---- ScriptTag scriptTag = (ScriptTag)node[0]; String scriptCode = scriptTag.getScriptCode(); ! ! String expectedCode = ! wrapLineSeperatorAround(javascript); ! assertStringEquals("Expected Code",expectedCode,scriptCode); } *************** *** 593,597 **** ScriptTag scriptTag = (ScriptTag)node[0]; String scriptCode = scriptTag.getScriptCode(); ! assertStringEquals("Expected Code",javascript,scriptCode); } --- 603,609 ---- ScriptTag scriptTag = (ScriptTag)node[0]; String scriptCode = scriptTag.getScriptCode(); ! String expectedCode = ! wrapLineSeperatorAround(javascript); ! assertStringEquals("Expected Code",expectedCode,scriptCode); } |