jstrachan    02/05/20 05:32:23

  Modified:    jexl/src/test/org/apache/commons/jexl JexlTest.java
  Log:
  Added a couple more EL unit tests for the use of dot notation to lookup map entries 
and the use of underscores in variable names
  
  Revision  Changes    Path
  1.7       +35 -1     
jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java
  
  Index: JexlTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JexlTest.java     20 May 2002 10:49:27 -0000      1.6
  +++ JexlTest.java     20 May 2002 12:32:23 -0000      1.7
  @@ -71,7 +71,7 @@
    *  Simple testcases
    *
    *  @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - *  @version $Id: JexlTest.java,v 1.6 2002/05/20 10:49:27 jstrachan Exp $
  + *  @version $Id: JexlTest.java,v 1.7 2002/05/20 12:32:23 jstrachan Exp $
    */
   public class JexlTest extends TestCase
   {
  @@ -533,6 +533,40 @@
           Object o = e.evaluate(jc);
   
           assertEquals("o incorrect", "two", o);
  +    }
  +
  +    /**
  +      *  test variables with underscore names
  +      */
  +    public void testVariableNames()
  +         throws Exception
  +    {
  +        Expression e = ExpressionFactory.createExpression("foo_bar");
  +        JexlContext jc = JexlHelper.createContext();
  +
  +        
  +        jc.getVars().put("foo_bar", "123" );
  +        Object o = e.evaluate(jc);
  +
  +        assertEquals("o incorrect", "123", o);
  +    }
  +
  +    /**
  +      *  test the use of dot notation to lookup map entries
  +      */
  +    public void testMapDot()
  +         throws Exception
  +    {
  +        Expression e = ExpressionFactory.createExpression("foo.bar");
  +        JexlContext jc = JexlHelper.createContext();
  +
  +        Map foo = new HashMap();
  +        foo.put( "bar", "123" );
  +                
  +        jc.getVars().put("foo", foo );
  +        Object o = e.evaluate(jc);
  +
  +        assertEquals("o incorrect", "123", o);
       }
   
       public class Foo
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to