[limb-svn] r5265 - in 3.x/limb/cli: src tests/cases

svn at limb-project.com svn at limb-project.com
Fri Mar 16 16:11:22 MSK 2007


Author: pachanga
Date: 2007-03-16 16:11:22 +0300 (Fri, 16 Mar 2007)
New Revision: 5265
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5265

Modified:
   3.x/limb/cli/src/lmbCliInput.class.php
   3.x/limb/cli/tests/cases/lmbCliInputTest.class.php
Log:
-- lmbCliInput string description with ending separator fixed

Modified: 3.x/limb/cli/src/lmbCliInput.class.php
===================================================================
--- 3.x/limb/cli/src/lmbCliInput.class.php	2007-03-16 11:45:59 UTC (rev 5264)
+++ 3.x/limb/cli/src/lmbCliInput.class.php	2007-03-16 13:11:22 UTC (rev 5265)
@@ -134,6 +134,9 @@
     $opts = array();
     foreach(explode(';', $str) as $item)
     {
+      if(!$item)
+        continue;
+
       if(preg_match('~^(?:((\w)\|(\w+))|(\w\b)|(\w+)?)(=)?~', $item, $m))
       {
         $req = isset($m[6]) ? lmbCliOption :: VALUE_REQ : lmbCliOption :: VALUE_NO;

Modified: 3.x/limb/cli/tests/cases/lmbCliInputTest.class.php
===================================================================
--- 3.x/limb/cli/tests/cases/lmbCliInputTest.class.php	2007-03-16 11:45:59 UTC (rev 5264)
+++ 3.x/limb/cli/tests/cases/lmbCliInputTest.class.php	2007-03-16 13:11:22 UTC (rev 5265)
@@ -40,6 +40,14 @@
     $this->assertEqual($opts[3], new lmbCliOption('c', lmbCliOption :: VALUE_REQ));
   }
 
+  function testUseStringOptionsDescriptionWithEndingSeparator()
+  {
+    $cli = new lmbCliInput('h|help;');
+    $opts = $cli->getOptions();
+
+    $this->assertEqual($opts[0], new lmbCliOption('h', 'help'));
+  }
+
   function testReadSimpleOptionsWithArguments()
   {
     $argv = array('foo.php', '-f', 'wow', '--bar=1', 'foo', 'bar');



More information about the limb-svn mailing list