Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.htmlparser.tests.scannersTests
Class ScriptScannerTest  view ScriptScannerTest download ScriptScannerTest.java

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.htmlparser.tests.ParserTestCase
              extended byorg.htmlparser.tests.scannersTests.ScriptScannerTest
All Implemented Interfaces:
junit.framework.Test

public class ScriptScannerTest
extends org.htmlparser.tests.ParserTestCase


Field Summary
 
Fields inherited from class org.htmlparser.tests.ParserTestCase
node, nodeCount, parser, reader
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
ScriptScannerTest(java.lang.String name)
           
 
Method Summary
 void testEvaluate()
           
 void testScan()
           
 void testScanBug()
          Bug reported by Gordon Deudney 2002-03-27 Upon parsing : <SCRIPT LANGUAGE="JavaScript" SRC="../js/DetermineBrowser.js"></SCRIPT> the SRC data cannot be retrieved.
 void testScanBugWG()
          Bug check by Wolfgang Germund 2002-06-02 Upon parsing : <script language="javascript"> if(navigator.appName.indexOf("Netscape") != -1) document.write ('xxx'); else document.write ('yyy'); </script> check getScriptCode().
 void testScanNoEndTag()
          Tests a bug in ScriptScanner where a NPE would be thrown if the script tag was not closed before the document ended.
 void testScanQuotedEndTag()
          See bug #741769 ScriptScanner doesn't handle quoted tags
 void testScanScriptWithComments()
           
 void testScanScriptWithLinks()
           
 void testScriptCodeExtraction()
           
 void testScriptCodeExtractionWithMultipleQuotes()
           
 void testScriptCodeExtractionWithNewlines()
          There was a bug in the ScriptScanner when there was multiline script and the last line did not have a newline before the end script tag.
 void testScriptTagComments()
          Submitted by Dhaval Udani - reproducing bug 664404
 void testScriptTagsGeneratedByScriptCode()
          Duplicates bug reported by James Moliere - whereby, if script tags are generated by script code, the parser interprets them as real tags.
 void testScriptWithinComments()
           
 
Methods inherited from class org.htmlparser.tests.ParserTestCase
assertHiddenIDTagPresent, assertNodeCount, assertNodeCount, assertSameType, assertStringEquals, assertTagEquals, assertType, assertXmlEquals, createParser, createParser, createParser, createParser, parse, parseAndAssertNodeCount, parseNodes, removeEscapeCharacters
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScriptScannerTest

public ScriptScannerTest(java.lang.String name)
Method Detail

testEvaluate

public void testEvaluate()

testScan

public void testScan()
              throws org.htmlparser.util.ParserException

testScanBug

public void testScanBug()
                 throws org.htmlparser.util.ParserException
Bug reported by Gordon Deudney 2002-03-27 Upon parsing : <SCRIPT LANGUAGE="JavaScript" SRC="../js/DetermineBrowser.js"></SCRIPT> the SRC data cannot be retrieved.


testScanBugWG

public void testScanBugWG()
                   throws org.htmlparser.util.ParserException
Bug check by Wolfgang Germund 2002-06-02 Upon parsing : <script language="javascript"> if(navigator.appName.indexOf("Netscape") != -1) document.write ('xxx'); else document.write ('yyy'); </script> check getScriptCode().


testScanScriptWithLinks

public void testScanScriptWithLinks()
                             throws org.htmlparser.util.ParserException

testScanScriptWithComments

public void testScanScriptWithComments()
                                throws org.htmlparser.util.ParserException

testScriptTagComments

public void testScriptTagComments()
                           throws org.htmlparser.util.ParserException
Submitted by Dhaval Udani - reproducing bug 664404


testScriptTagsGeneratedByScriptCode

public void testScriptTagsGeneratedByScriptCode()
                                         throws java.lang.Exception
Duplicates bug reported by James Moliere - whereby, if script tags are generated by script code, the parser interprets them as real tags. The problem was that the string parser was not moving to the ignore state on encountering double quotes (only single quotes were previously accepted).


testScriptCodeExtraction

public void testScriptCodeExtraction()
                              throws org.htmlparser.util.ParserException

testScriptCodeExtractionWithMultipleQuotes

public void testScriptCodeExtractionWithMultipleQuotes()
                                                throws org.htmlparser.util.ParserException

testScriptWithinComments

public void testScriptWithinComments()
                              throws java.lang.Exception

testScriptCodeExtractionWithNewlines

public void testScriptCodeExtractionWithNewlines()
                                          throws org.htmlparser.util.ParserException
There was a bug in the ScriptScanner when there was multiline script and the last line did not have a newline before the end script tag. For example: <script>alert() alert()</script> Would generate the following "scriptCode()" result: alert()alert() But should actually return: alert() alert() This was fixed in ScriptScanner, which this test verifies


testScanNoEndTag

public void testScanNoEndTag()
                      throws org.htmlparser.util.ParserException
Tests a bug in ScriptScanner where a NPE would be thrown if the script tag was not closed before the document ended.


testScanQuotedEndTag

public void testScanQuotedEndTag()
                          throws org.htmlparser.util.ParserException
See bug #741769 ScriptScanner doesn't handle quoted tags