@@ -55,6 +55,20 @@ public function testShortcut()
5555 $ this ->assertEquals ('f|ff|fff ' , $ option ->getShortcut (), '__construct() removes the leading - of the shortcuts ' );
5656 $ option = new InputOption ('foo ' );
5757 $ this ->assertNull ($ option ->getShortcut (), '__construct() makes the shortcut null by default ' );
58+ $ option = new InputOption ('foo ' , '' );
59+ $ this ->assertNull ($ option ->getShortcut (), '__construct() makes the shortcut null when given an empty string ' );
60+ $ option = new InputOption ('foo ' , []);
61+ $ this ->assertNull ($ option ->getShortcut (), '__construct() makes the shortcut null when given an empty array ' );
62+ $ option = new InputOption ('foo ' , ['f ' , '' , 'fff ' ]);
63+ $ this ->assertEquals ('f|fff ' , $ option ->getShortcut (), '__construct() removes empty shortcuts ' );
64+ $ option = new InputOption ('foo ' , 'f||fff ' );
65+ $ this ->assertEquals ('f|fff ' , $ option ->getShortcut (), '__construct() removes empty shortcuts ' );
66+ $ option = new InputOption ('foo ' , '0 ' );
67+ $ this ->assertEquals ('0 ' , $ option ->getShortcut (), '-0 is an acceptable shortcut value ' );
68+ $ option = new InputOption ('foo ' , ['0 ' , 'z ' ]);
69+ $ this ->assertEquals ('0|z ' , $ option ->getShortcut (), '-0 is an acceptable shortcut value when embedded in an array ' );
70+ $ option = new InputOption ('foo ' , '0|z ' );
71+ $ this ->assertEquals ('0|z ' , $ option ->getShortcut (), '-0 is an acceptable shortcut value when embedded in a string-list ' );
5872 }
5973
6074 public function testModes ()
0 commit comments