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;
// 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);
--- /dev/null
+/*
+ * 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);
+ }
+}
+++ /dev/null
-/*
- * 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);
- }
-}