Moved and renamed TestELParser class.
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 23 Jul 2009 13:15:41 +0000 (13:15 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 23 Jul 2009 13:15:41 +0000 (13:15 +0000)
Some more EL tests to be added later.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@797058 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/TestAll.java
test/org/apache/el/TestELEvaluation.java [new file with mode: 0644]
test/org/apache/el/parser/TestELParser.java [deleted file]

index 78a070b..1a6bfc8 100644 (file)
@@ -4,7 +4,7 @@ import org.apache.catalina.ha.session.TestSerializablePrincipal;
 import org.apache.catalina.startup.TestTomcat;
 import org.apache.catalina.tribes.test.TribesTestSuite;
 import org.apache.el.lang.TestELSupport;
-import org.apache.el.parser.TestELParser;
+import org.apache.el.TestELEvaluation;
 import org.apache.tomcat.util.http.TestCookies;
 import org.apache.tomcat.util.res.TestStringManager;
 
@@ -25,7 +25,7 @@ public class TestAll {
         // suite.addTest(TribesTestSuite.suite());
         // o.a.el
         suite.addTestSuite(TestELSupport.class);
-        suite.addTestSuite(TestELParser.class);
+        suite.addTestSuite(TestELEvaluation.class);
         // o.a.tomcat.util
         suite.addTestSuite(TestStringManager.class);
         
diff --git a/test/org/apache/el/TestELEvaluation.java b/test/org/apache/el/TestELEvaluation.java
new file mode 100644 (file)
index 0000000..c441be7
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el;
+
+import javax.el.ValueExpression;
+
+import org.apache.el.ExpressionFactoryImpl;
+import org.apache.jasper.el.ELContextImpl;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for EL parsing and evaluation.
+ */
+public class TestELEvaluation extends TestCase {
+
+    public void testParserBug45511() {
+        // Test cases provided by OP
+        assertEquals("true", evaluateExpression("${empty ('')}"));
+        assertEquals("true", evaluateExpression("${empty('')}"));
+        assertEquals("false", evaluateExpression("${(true) and (false)}"));
+        assertEquals("false", evaluateExpression("${(true)and(false)}"));
+    }
+
+    public void testParserBug42565() {
+        // Test cases provided by OP
+        assertEquals("false", evaluateExpression("${false?true:false}"));
+    }
+
+    public void testMisc() {
+        // From bug 45451 - not a parser bug
+        assertEquals("\\", evaluateExpression("\\\\"));
+    }
+
+    // ************************************************************************
+
+    private String evaluateExpression(String expression) {
+        ELContextImpl ctx = new ELContextImpl();
+        ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
+        ValueExpression ve = exprFactory.createValueExpression(ctx, expression,
+                String.class);
+        return (String) ve.getValue(ctx);
+    }
+}
diff --git a/test/org/apache/el/parser/TestELParser.java b/test/org/apache/el/parser/TestELParser.java
deleted file mode 100644 (file)
index 2cce209..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.el.parser;
-
-import javax.el.ValueExpression;
-
-import org.apache.el.ExpressionFactoryImpl;
-import org.apache.jasper.el.ELContextImpl;
-
-import junit.framework.TestCase;
-
-public class TestELParser extends TestCase {
-    
-    public void testBug45511() {
-        // Test cases provided by OP
-        assertEquals("true", evaluateExpression("${empty ('')}"));
-        assertEquals("true", evaluateExpression("${empty('')}"));
-        assertEquals("false", evaluateExpression("${(true) and (false)}"));
-        assertEquals("false", evaluateExpression("${(true)and(false)}"));
-    }
-    
-
-    public void testBug42565() {
-        // Test cases provided by OP
-        assertEquals("false", evaluateExpression("${false?true:false}"));
-    }
-
-
-    public void testMisc() {
-        // From bug 45451 - not a parser bug
-        assertEquals("\\", evaluateExpression("\\\\"));
-    }
-    
-
-    private String evaluateExpression(String expression) {
-        ELContextImpl ctx = new ELContextImpl();
-        ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
-        ValueExpression ve =
-            exprFactory.createValueExpression(ctx, expression, String.class );
-        return (String) ve.getValue(ctx);
-    }
-}