You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by di...@apache.org on 2007/10/28 10:06:18 UTC
svn commit: r589309 -
/commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/ArrayAccessTest.java
Author: dion
Date: Sun Oct 28 02:06:16 2007
New Revision: 589309
URL: http://svn.apache.org/viewvc?rev=589309&view=rev
Log:
Add tests for JEXL-26
Add tests for method calls on array objects:
- get(index), set(index,Object), size()
Modified:
commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/ArrayAccessTest.java
Modified: commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/ArrayAccessTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/ArrayAccessTest.java?rev=589309&r1=589308&r2=589309&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/ArrayAccessTest.java (original)
+++ commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/ArrayAccessTest.java Sun Oct 28 02:06:16 2007
@@ -122,5 +122,27 @@
asserter.assertExpression("foo.array2[1][1]", GET_METHOD_ARRAY2[1][1]);
// asserter.assertExpression("foo.array2.1.1", GET_METHOD_ARRAY2[1][1]);
}
+
+ // This is JEXL-26
+ public void testArrayAndDottedConflict() throws Exception {
+ Object[] objects = new Object[] {"an", "array", new Long(0)};
+
+ asserter.setVariable("objects", objects);
+ asserter.setVariable("status", "Enabled");
+ asserter.assertExpression("objects[1].status", null);
+
+ asserter.setVariable("base.status", "Ok");
+ asserter.assertExpression("base.objects[1].status", null);
+ }
+ public void testArrayMethods() throws Exception {
+ Object[] objects = new Object[] {"an", "array", new Long(0)};
+
+ asserter.setVariable("objects", objects);
+ asserter.assertExpression("objects.get(1)", "array");
+ asserter.assertExpression("objects.size()", new Integer(3));
+ // setting an index returns the old value
+ asserter.assertExpression("objects.set(1, 'dion')", "array");
+ asserter.assertExpression("objects[1]", "dion");
+ }
}