Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/test/java/org/gvsig/expresionevaluator/impl/TestExpression.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/test/java/org/gvsig/expresionevaluator/impl/TestExpression.java	(revision 44618)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/test/java/org/gvsig/expresionevaluator/impl/TestExpression.java	(revision 44619)
@@ -1,25 +1,59 @@
 package org.gvsig.expresionevaluator.impl;
 
 import junit.framework.TestCase;
+import org.apache.commons.lang3.Range;
 import org.gvsig.expressionevaluator.Expression;
 import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
 import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
+import org.gvsig.expressionevaluator.Interpreter;
 import org.gvsig.expressionevaluator.MutableSymbolTable;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+import org.gvsig.expressionevaluator.spi.AbstractSymbolTable;
 import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
 
+public class TestExpression extends TestCase {
 
-public class TestExpression extends TestCase {
-    
+    private static class MyValueSymbolTable extends AbstractSymbolTable {
+
+        private class MyValueFunction extends AbstractFunction {
+
+            public MyValueFunction() {
+                super("Numeric", "MyValue", Range.is(0));
+            }
+
+            @Override
+            public Object call(Interpreter interpreter, Object[] args) {
+                return value;
+            }
+
+            @Override
+            public boolean allowConstantFolding() {
+                return false;
+            }
+        }
+        private int value;
+
+        @SuppressWarnings("OverridableMethodCallInConstructor")
+        public MyValueSymbolTable(String name) {
+            super(name);
+            this.addFunction(new MyValueFunction());
+        }
+
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
     public TestExpression(String testName) {
         super(testName);
     }
-    
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
         new DefaultLibrariesInitializer().fullInitialize();
     }
-    
+
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
@@ -28,51 +62,72 @@
     private MutableSymbolTable createMutableSymbolTable() {
         ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
         MutableSymbolTable t = manager.createSymbolTable();
-        return  t;
+        return t;
     }
-    
+
     private Expression createExpression() {
         ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
         Expression e = manager.createExpression();
-        return  e;
+        return e;
     }
-    
-    
+
     // TODO add test methods here. The name must begin with 'test'. For example:
     // public void testHello() {}
-
     
     public void testToJSON1() {
         String source = "precio + 10";
 
         Expression expression = createExpression();
         expression.setPhrase(source);
-        
+
         assertEquals(
-                "{\"phrase\":\"precio + 10\"}", 
+                "{\"phrase\":\"precio + 10\"}",
                 expression.toJSON()
         );
     }
-    
+
     public void testA() {
-        
+
         Expression expression = createExpression();
         expression.setPhrase("precio * 10");
-        
+
         MutableSymbolTable t1 = createMutableSymbolTable();
         t1.setVar("precio", 2);
         Object v1 = expression.execute(t1);
-        assertEquals(20, (int)v1);
-        
+        assertEquals(20, (int) v1);
+
         t1.setVar("precio", 3);
         v1 = expression.execute(t1);
-        assertEquals(30, (int)v1);
-        
+        assertEquals(30, (int) v1);
+
         MutableSymbolTable t2 = createMutableSymbolTable();
         t2.setVar("precio", 4);
         v1 = expression.execute(t2);
-        assertEquals(40, (int)v1);
-        
+        assertEquals(40, (int) v1);
+
     }
-    
+
+    public void testB() {
+
+        Expression expression = createExpression();
+        expression.setPhrase("MYVALUE()");
+
+        MyValueSymbolTable t1 = new MyValueSymbolTable("MyValueSymbolTable1");
+        t1.setValue(2);
+        Object v1 = expression.execute(t1);
+        assertEquals(2, (int) v1);
+
+        t1.setValue(3);
+        v1 = expression.execute(t1);
+        assertEquals(3, (int) v1);
+
+        MyValueSymbolTable t2 = new MyValueSymbolTable("MyValueSymbolTable2");
+        expression.link(t2);
+        t2.setValue(4);
+        v1 = expression.execute(t2);
+        assertEquals(4, (int) v1);
+
+    }
+
+
 }
