@@ -99,9 +99,7 @@ suite('Shell Utils', () => {
9999 } ) ;
100100
101101 suite ( 'getShellCommandAsString' , ( ) => {
102- const sampleCommand : PythonCommandRunConfiguration [ ] = [
103- { executable : 'source' , args : [ '/path/to/activate' ] } ,
104- ] ;
102+ const sampleCommand : PythonCommandRunConfiguration [ ] = [ { executable : 'source' , args : [ '/path/to/activate' ] } ] ;
105103
106104 suite ( 'leading space for history ignore' , ( ) => {
107105 test ( 'should add leading space for bash commands' , ( ) => {
@@ -184,5 +182,27 @@ suite('Shell Utils', () => {
184182 assert . ok ( ! result . startsWith ( ' ' ) , 'Fish command should not start with a leading space' ) ;
185183 } ) ;
186184 } ) ;
185+
186+ suite ( 'empty command handling' , ( ) => {
187+ test ( 'should return empty string for empty command array (bash)' , ( ) => {
188+ const result = getShellCommandAsString ( ShellConstants . BASH , [ ] ) ;
189+ assert . strictEqual ( result , '' , 'Empty command array should return empty string' ) ;
190+ } ) ;
191+
192+ test ( 'should return empty string for empty command array (gitbash)' , ( ) => {
193+ const result = getShellCommandAsString ( ShellConstants . GITBASH , [ ] ) ;
194+ assert . strictEqual ( result , '' , 'Empty command array should return empty string' ) ;
195+ } ) ;
196+
197+ test ( 'should return empty string for empty command array (pwsh)' , ( ) => {
198+ const result = getShellCommandAsString ( ShellConstants . PWSH , [ ] ) ;
199+ assert . strictEqual ( result , '' , 'Empty command array should return empty string' ) ;
200+ } ) ;
201+
202+ test ( 'should return empty string for empty command array (cmd)' , ( ) => {
203+ const result = getShellCommandAsString ( ShellConstants . CMD , [ ] ) ;
204+ assert . strictEqual ( result , '' , 'Empty command array should return empty string' ) ;
205+ } ) ;
206+ } ) ;
187207 } ) ;
188208} ) ;
0 commit comments