CVS Update: xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests

Aleksander Andrzej Slominski <[email protected]> Thu, 19 Aug 2004 01:16:56 -0500 (EST)
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
aslom       04/08/19 01:16:56

  Modified:    src/java/tests/org/xmlpull/v1/tests
                        TestEntityReplacement.java
  Log:
  Additional tests to confirm that   <a href=http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=192>Bug 192 Escaped characters disappear in certain cases</a>  is not present in XmlPull implementations.
  
  Revision  Changes    Path
  1.10      +49 -19    xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestEntityReplacement.java
  
  Index: TestEntityReplacement.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestEntityReplacement.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -t -w -r1.9 -r1.10
  --- TestEntityReplacement.java	18 Feb 2003 19:48:10 -0000	1.9
  +++ TestEntityReplacement.java	19 Aug 2004 06:16:56 -0000	1.10
  @@ -4,14 +4,14 @@
   package org.xmlpull.v1.tests;
   
   //import junit.framework.Test;
  -import junit.framework.TestSuite;
  -
  -import java.io.StringReader;
  +import java.io.ByteArrayInputStream;
   import java.io.IOException;
  -
  +import java.io.InputStream;
  +import java.io.StringReader;
  +import junit.framework.TestSuite;
   import org.xmlpull.v1.XmlPullParser;
  -import org.xmlpull.v1.XmlPullParserFactory;
   import org.xmlpull.v1.XmlPullParserException;
  +import org.xmlpull.v1.XmlPullParserFactory;
   
   /**
    * Test if entity replacement works ok.
  @@ -108,6 +108,36 @@
   
       }
   
  +    /**
  +     * Additional tests to confirm that
  +     * <a href="http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=192">Bug 192
  +     * Escaped characters disappear in certain cases</a>
  +     * is not present in XmlPull implementations.
  +     */
  +    public void testLastEntity(String xml, String expectedText) throws Exception {
  +        InputStream stream = new ByteArrayInputStream(xml.getBytes());
  +        XmlPullParser pp = factory.newPullParser();
  +        // default parser must work!!!!
  +        pp.setInput(stream, "UTF-8" );
  +        pp.nextTag();
  +        assertEquals(XmlPullParser.START_TAG, pp.getEventType());
  +        //assertEquals("UTF-8", pp.getCharacterEncodingScheme());
  +        //assertEquals("1.0", startdoc.getVersion());
  +        String c = pp.nextText();
  +        assertEquals(expectedText,c); //FAILURE expected "<text>" but was "<text"
  +        assertEquals(XmlPullParser.END_TAG, pp.getEventType());
  +    }
  +    
  +    public void testLastEntity() throws Exception {
  +        testLastEntity(
  +            "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><document>&lt;text&gt;</document>",
  +            "<text>"
  +        );
  +        testLastEntity(
  +            "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><document>&lt;text&gt; </document>",
  +            "<text> "
  +        );
  +    }
   
       public static void main (String[] args) {
           junit.textui.TestRunner.run (new TestSuite(TestEntityReplacement.class));
  
  
  



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/2U_rlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/xmlpull-dev/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/