felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1736021 - in /felix/trunk/gogo/runtime/src: main/java/org/apache/felix/gogo/runtime/Expander.java test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
Date Mon, 21 Mar 2016 16:55:51 GMT
Author: gnodet
Date: Mon Mar 21 16:55:51 2016
New Revision: 1736021

URL: http://svn.apache.org/viewvc?rev=1736021&view=rev
Log:
Fix capitalizing

Modified:
    felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java
    felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java?rev=1736021&r1=1736020&r2=1736021&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java (original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java Mon
Mar 21 16:55:51 2016
@@ -939,7 +939,7 @@ public class Expander extends BaseTokeni
             if (flagC || flagL || flagU) {
                 Function<String, String> cnv;
                 if (flagC)
-                    cnv = s -> s.isEmpty() ? s : s.substring(0, 1).toUpperCase() + s.substring(1);
+                    cnv = s -> s.isEmpty() ? s : s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
                 else if (flagL)
                     cnv = String::toLowerCase;
                 else

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java?rev=1736021&r1=1736020&r2=1736021&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
(original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
Mon Mar 21 16:55:51 2016
@@ -195,6 +195,28 @@ public class TestTokenizer
     }
 
     @Test
+    public void testParamFlag() throws Exception {
+        vars.clear();
+        vars.put("foo", "bar");
+        vars.put("bar", "baz");
+
+        assertEquals("bar", expand("${${foo}}"));
+        assertEquals("baz", expand("${(P)foo}"));
+        assertEquals("baz", expand("${(P)${foo}}"));
+    }
+
+    @Test
+    public void testCaseFlags() throws Exception {
+        vars.clear();
+        vars.put("foo", "bAr");
+
+        assertEquals("bAr", expand("${foo}"));
+        assertEquals("bar", expand("${(L)foo}"));
+        assertEquals("BAR", expand("${(U)${foo}}"));
+        assertEquals("Bar", expand("${(C)${foo}}"));
+    }
+
+    @Test
     public void testSorting() throws Exception {
         vars.clear();
         vars.put("array", Arrays.asList("foo1", "foo02", "foo2", "fOo3", "Foo20", "foo23"));



Mime
View raw message