svn commit: r710191 - in /jakarta/taglibs/proper/standard/trunk: ./ test/org/apache/taglibs/standard/lang/jstl/test/

[email protected]
Newsgroups gmane.comp.jakarta.taglibs.devel
Message-ID <[email protected]>
Author: bayard
Date: Mon Nov  3 14:24:13 2008
New Revision: 710191

URL: http://svn.apache.org/viewvc?rev=710191&view=rev
Log:
Transferred the ParserTest and EvaluationTest over from the old code to JUnit. #43640. EvaluationTest fails currently - needs investigation but not an issue with the JUnit-izing. Currently turned off in the build. 

Modified:
    jakarta/taglibs/proper/standard/trunk/build-tests.xml
    jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java
    jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java
    jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/parserTests.txt

Modified: jakarta/taglibs/proper/standard/trunk/build-tests.xml
URL: http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/build-tests.xml?rev=710191&r1=710190&r2=710191&view=diff
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/build-tests.xml (original)
+++ jakarta/taglibs/proper/standard/trunk/build-tests.xml Mon Nov  3 14:24:13 2008
@@ -362,6 +362,8 @@
       <!-- uncomment the below line to enable attaching a debugger -->
       <jvmarg line="${debug.jvm.args}"/>
 
+      <sysproperty key="javax.servlet.jsp.functions.allowed" value="true" />
+
       <classpath>
         <pathelement path="${java.class.path}"/>
         <pathelement location="${out.test.dir}/WEB-INF/classes"/>
@@ -373,6 +375,9 @@
       <batchtest>
         <fileset dir="${src.test.dir}">
           <include name="**/TestVersion.java"/>
+          <include name="**/StaticFunctionTests.java"/>
+          <include name="**/ParserTest.java"/>
+          <exclude name="**/EvaluationTest.java"/>
           <exclude name="**/testutil/*.java"/>
         </fileset>
       </batchtest>

Modified: jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java
URL: http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java?rev=710191&r1=710190&r2=710191&view=diff
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java (original)
+++ jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java Mon Nov  3 14:24:13 2008
@@ -39,6 +39,8 @@
 import org.apache.taglibs.standard.lang.jstl.Evaluator;
 import org.apache.taglibs.standard.lang.jstl.test.beans.Factory;
 
+import junit.framework.TestCase;
+
 /**
  *
  * <p>This runs a series of tests specifically for the evaluator.  It
@@ -57,8 +59,8 @@
  * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
  **/
 
-public class EvaluationTest
-{
+public class EvaluationTest extends TestCase {
+
   //-------------------------------------
   // Properties
   //-------------------------------------
@@ -204,7 +206,7 @@
    * Performs a line-by-line comparison of the two files, returning
    * true if the files are different, false if not.
    **/
-  public static boolean isDifferentFiles (DataInput pIn1,
+  public static boolean isDifferentStreams (DataInput pIn1,
 					  DataInput pIn2)
     throws IOException
   {
@@ -233,7 +235,7 @@
    * Performs a line-by-line comparison of the two files, returning
    * true if the files are different, false if not.
    **/
-  public static boolean isDifferentFiles (File pFile1,
+  public static void assertDifferentFiles (File pFile1,
 					  File pFile2)
     throws IOException
   {
@@ -249,7 +251,9 @@
 	BufferedInputStream bin2 = new BufferedInputStream (fin2);
 	DataInputStream din2 = new DataInputStream (bin2);
 
-	return isDifferentFiles (din1, din2);
+	if(isDifferentStreams (din1, din2)) {
+        fail("Files are different");
+    }
       }
       finally {
 	if (fin2 != null) {
@@ -263,7 +267,6 @@
       }
     }
   }
-
   //-------------------------------------
   // Test data
   //-------------------------------------
@@ -375,32 +378,21 @@
    *
    * Runs the evaluation test
    **/
-  public static void main (String [] pArgs)
+  public void testEvaluations()
     throws IOException
   {
-    if (pArgs.length != 2 &&
-	pArgs.length != 3) {
-      usage ();
-      System.exit (1);
-    }
 
-    File in = new File (pArgs [0]);
-    File out = new File (pArgs [1]);
+    String input = "test/org/apache/taglibs/standard/lang/jstl/test/evaluationTests.txt";
+    String output = "/tmp/evaluationTestsOutput.txt";
+    String compareName = "test/org/apache/taglibs/standard/lang/jstl/test/evaluationTestsOutput.txt";
+
+    File in = new File (input);
+    File out = new File (output);
 
     runTests (in, out);
 
-    if (pArgs.length > 2) {
-      File compare = new File (pArgs [2]);
-      if (isDifferentFiles (out, compare)) {
-	System.out.println ("Test failure - output file " +
-			    out +
-			    " differs from expected output file " +
-			    compare);
-      }
-      else {
-	System.out.println ("tests passed");
-      }
-    }
+      File compare = new File (compareName);
+      assertDifferentFiles(out, compare);
   }
 
   //-------------------------------------

Modified: jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java
URL: http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java?rev=710191&r1=710190&r2=710191&view=diff
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java (original)
+++ jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java Mon Nov  3 14:24:13 2008
@@ -31,6 +31,8 @@
 
 import org.apache.taglibs.standard.lang.jstl.Evaluator;
 
+import junit.framework.TestCase;
+
 /**
  *
  * <p>This runs a series of tests specifically for the parser.  It
@@ -48,8 +50,8 @@
  * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
  **/
 
-public class ParserTest
-{
+public class ParserTest extends TestCase {
+
   //-------------------------------------
   // Properties
   //-------------------------------------
@@ -149,7 +151,7 @@
    * Performs a line-by-line comparison of the two files, returning
    * true if the files are different, false if not.
    **/
-  public static boolean isDifferentFiles (DataInput pIn1,
+  public static boolean isDifferentStreams (DataInput pIn1,
 					  DataInput pIn2)
     throws IOException
   {
@@ -178,7 +180,7 @@
    * Performs a line-by-line comparison of the two files, returning
    * true if the files are different, false if not.
    **/
-  public static boolean isDifferentFiles (File pFile1,
+  public static void assertDifferentFiles (File pFile1,
 					  File pFile2)
     throws IOException
   {
@@ -194,7 +196,9 @@
 	BufferedInputStream bin2 = new BufferedInputStream (fin2);
 	DataInputStream din2 = new DataInputStream (bin2);
 
-	return isDifferentFiles (din1, din2);
+	if(isDifferentStreams (din1, din2)) {
+        fail("Files are different");
+    }
       }
       finally {
 	if (fin2 != null) {
@@ -216,32 +220,21 @@
    *
    * Runs the parser test
    **/
-  public static void main (String [] pArgs)
+  public void testParser()
     throws IOException
   {
-    if (pArgs.length != 2 &&
-	pArgs.length != 3) {
-      usage ();
-      System.exit (1);
-    }
 
-    File in = new File (pArgs [0]);
-    File out = new File (pArgs [1]);
+    String input = "test/org/apache/taglibs/standard/lang/jstl/test/parserTests.txt";
+    String output = "/tmp/parserTestsOutput.txt";
+    String compareName = "test/org/apache/taglibs/standard/lang/jstl/test/parserTestsOutput.txt";
+
+    File in = new File (input);
+    File out = new File (output);
 
     runTests (in, out);
 
-    if (pArgs.length > 2) {
-      File compare = new File (pArgs [2]);
-      if (isDifferentFiles (out, compare)) {
-	System.out.println ("Test failure - output file " +
-			    out +
-			    " differs from expected output file " +
-			    compare);
-      }
-      else {
-	System.out.println ("tests passed");
-      }
-    }
+      File compare = new File (compareName);
+      assertDifferentFiles(out, compare);
   }
 
   //-------------------------------------

Modified: jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/parserTests.txt
URL: http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/parserTests.txt?rev=710191&r1=710190&r2=710191&view=diff
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/parserTests.txt (original)
+++ jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/lang/jstl/test/parserTests.txt Mon Nov  3 14:24:13 2008
@@ -130,18 +130,18 @@
 ${ empty }
 
 # functions
-#${a()}
-#${ a() }
-#${a(b)}
-#${ a(b) }
-#${a(b,c)}
-#${a(b,c,d)}
-#${a:b(c)}
-#${a:b(c,d)}
-#${a:b(c,d,e)}
-#${a(b).c}
-#${a(b)[c]}
-#${a[b()]}
+${a()}
+${ a() }
+${a(b)}
+${ a(b) }
+${a(b,c)}
+${a(b,c,d)}
+${a:b(c)}
+${a:b(c,d)}
+${a:b(c,d,e)}
+${a(b).c}
+${a(b)[c]}
+${a[b()]}
 
 # non-ascii input - the parser automatically translates the @@non-ascii
 # into a UNICODE string with value \u1111
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.