You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2004/07/07 03:21:55 UTC

cvs commit: jakarta-struts/web/test/test/org/apache/struts/taglib/html TestOptionsTag1.jsp

craigmcc    2004/07/06 18:21:55

  Modified:    web/test/test/org/apache/struts/taglib/html
                        TestOptionsTag1.jsp
  Log:
  Swallow whitespace characters that were causing bogus equality failures
  (^M^J does not match ^J).  With this change, and the previously commented
  out tests on cookies (because Cactus appears not to include them in the
  test request), 100% of "ant test.tomcat.41" now works for me.  I still get
  a shutdown failure on "test.tomcat.50" but that doesn't appear to be related
  to the tests themselves.
  
  Revision  Changes    Path
  1.2       +30 -1     jakarta-struts/web/test/test/org/apache/struts/taglib/html/TestOptionsTag1.jsp
  
  Index: TestOptionsTag1.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/test/test/org/apache/struts/taglib/html/TestOptionsTag1.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestOptionsTag1.jsp	3 Jan 2004 06:07:56 -0000	1.1
  +++ TestOptionsTag1.jsp	7 Jul 2004 01:21:55 -0000	1.2
  @@ -5,7 +5,6 @@
   <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
   
   
  -
   <logic:equal name="runTest" value="testOptionsCollectionArrayItemValueInCollectionProperty">
   	<bean:define id="TEST_RESULTS" toScope="page">
   	  <html:select property="string">
  @@ -189,6 +188,36 @@
   if (pageContext.getAttribute("TEST_RESULTS") != null){
   	compareTo=pageContext.getAttribute("EXPECTED_RESULTS").toString();
   }
  +
  +// Swallow tabs, carriage returns, and newlines before comparing
  +if (expected == null) {
  +  expected = "";
  +}
  +if (compareTo == null) {
  +  compareTo = "";
  +}
  +
  +StringBuffer sb = new StringBuffer();
  +for (int i = 0; i < expected.length(); i++) {
  +  char ch = expected.charAt(i);
  +  if ((ch == '\t') || (ch == '\r') || (ch == '\n')) {
  +    ;
  +  } else {
  +    sb.append(ch);
  +  }
  +}
  +expected = sb.toString();
  +
  +sb = new StringBuffer();
  +for (int i = 0; i < compareTo.length(); i++) {
  +  char ch = compareTo.charAt(i);
  +  if ((ch == '\t') || (ch == '\r') || (ch == '\n')) {
  +    ;
  +  } else {
  +    sb.append(ch);
  +  }
  +}
  +compareTo = sb.toString();
   
   Assert.assertEquals(expected, compareTo);
   %>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org