|
From: <cr...@us...> - 2009-02-02 12:05:38
|
Revision: 4981
http://jnode.svn.sourceforge.net/jnode/?rev=4981&view=rev
Author: crawley
Date: 2009-02-02 12:03:37 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
Implemented ${param+word} and ${param:+word}
Modified Paths:
--------------
trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneContext.java
trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
Modified: trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneContext.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneContext.java 2009-02-02 11:53:36 UTC (rev 4980)
+++ trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneContext.java 2009-02-02 12:03:37 UTC (rev 4981)
@@ -741,6 +741,10 @@
return (value == null) ? word : value;
case COLONHYPHEN:
return (value == null || value.length() == 0) ? word : value;
+ case PLUS:
+ return (value == null) ? "" : word;
+ case COLONPLUS:
+ return (value == null || value.length() == 0) ? "" : word;
case QUERY:
if (value == null) {
String msg = word.length() > 0 ? word : (parameter + " is unset");
Modified: trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-02-02 11:53:36 UTC (rev 4980)
+++ trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-02-02 12:03:37 UTC (rev 4981)
@@ -163,6 +163,18 @@
echo A - null is ${A-}
echo B - null is ${B-}
echo X - null is ${X-}
+ echo A :+ dog is ${A:+dog}
+ echo B :+ dog is ${B:+dog}
+ echo X :+ dog is ${X:+dog}
+ echo A + dog is ${A+dog}
+ echo B + dog is ${B+dog}
+ echo X + dog is ${X+dog}
+ echo A :+ null is ${A:+}
+ echo B :+ null is ${B:+}
+ echo X :+ null is ${X:+}
+ echo A + null is ${A+}
+ echo B + null is ${B+}
+ echo X + null is ${X+}
</script>
<output>A is cat
A is cat
@@ -185,6 +197,18 @@
A - null is cat
B - null is
X - null is
+A :+ dog is dog
+B :+ dog is
+X :+ dog is
+A + dog is dog
+B + dog is dog
+X + dog is
+A :+ null is
+B :+ null is
+X :+ null is
+A + null is
+B + null is
+X + null is
</output>
<rc>0</rc>
</testSpec>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|