You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2009/07/08 10:47:29 UTC

svn commit: r792069 - in /felix/trunk/gogo/runtime/src: main/java/org/apache/felix/gogo/runtime/shell/Closure.java test/java/org/apache/felix/gogo/runtime/shell/TestParser.java

Author: gnodet
Date: Wed Jul  8 08:47:29 2009
New Revision: 792069

URL: http://svn.apache.org/viewvc?rev=792069&view=rev
Log:
Fix small evaluation problems in gogo

Modified:
    felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
    felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java?rev=792069&r1=792068&r2=792069&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java (original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java Wed Jul  8 08:47:29 2009
@@ -224,11 +224,11 @@
                         if (sb == null)
                         {
                             sb = new StringBuilder();
-                            if (res != null)
-                            {
-                                sb.append(res);
-                                res = null;
-                            }
+                        }
+                        if (res != null)
+                        {
+                            sb.append(res);
+                            res = null;
                         }
                         if (start != p.current)
                         {
@@ -282,11 +282,11 @@
             if (sb == null)
             {
                 sb = new StringBuilder();
-                if (res != null)
-                {
-                    sb.append(res);
-                    res = null;
-                }
+            }
+            if (res != null)
+            {
+                sb.append(res);
+                res = null;
             }
             sb.append(new Parser(p.text.subSequence(start, p.current)).unescape());
         }

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java?rev=792069&r1=792068&r2=792069&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java Wed Jul  8 08:47:29 2009
@@ -47,7 +47,6 @@
         c.addCommand("echo", this);
         c.addCommand("capture", this);
         c.set("c", "a");
-        assertEquals("a  b", c.execute("echo \"$c  b\" | capture"));
 
         assertEquals("a b", c.execute("echo a b | capture"));
         assertEquals("a b", c.execute("echo 'a b' | capture"));
@@ -63,6 +62,7 @@
         assertEquals("a  b", c.execute("echo \"${c}  b\" | capture"));
         assertEquals("aa", c.execute("echo $c$c | capture"));
         assertEquals("a ;a", c.execute("echo a\\ \\;a | capture"));
+        assertEquals("baabab", c.execute("echo b${c}${c}b${c}b | capture"));
     }
 
     public void testScope() throws Exception