@@ -386,13 +386,13 @@ func TestExec_Remote(t *testing.T) {
386386 command string
387387 args []interface {}
388388 }
389- tests := []struct {
389+ testCases := []struct {
390390 name string
391391 args args
392392 wantO Output
393393 }{
394394 {
395- name : "test" ,
395+ name : "echo remote test" ,
396396 args : args {
397397 command : `echo hello` ,
398398 },
@@ -401,8 +401,8 @@ func TestExec_Remote(t *testing.T) {
401401 },
402402 },
403403 }
404- for _ , tt := range tests {
405- t .Run (tt .name , func (t * testing.T ) {
404+ for _ , testCase := range testCases {
405+ t .Run (testCase .name , func (t * testing.T ) {
406406 server := ssh_mock .NewServer (t )
407407 defer server .Shutdown ()
408408 conn := server .Dial (ssh_mock .ClientConfig ())
@@ -416,9 +416,40 @@ func TestExec_Remote(t *testing.T) {
416416
417417 e .ServerContext = s
418418
419- gotO := e .Remote (tt .args .command , tt .args .args ... )
419+ gotO := e .Remote (testCase .args .command , testCase .args .args ... )
420420
421- require .Equal (t , tt .wantO , gotO , "Remote() = %v, want %v" , gotO , tt .wantO )
421+ require .Equal (t , testCase .wantO , gotO , "Remote() = %v, want %v" , gotO , testCase .wantO )
422422 })
423423 }
424424}
425+
426+ func TestExec_Local (t * testing.T ) {
427+ type args struct {
428+ command string
429+ args []interface {}
430+ }
431+ testCases := []struct {
432+ name string
433+ args args
434+ wantO Output
435+ }{
436+ {
437+ name : "echo local test" ,
438+ args : args {
439+ command : `echo hello` ,
440+ },
441+ wantO : Output {
442+ text : "hello" ,
443+ },
444+ },
445+ }
446+ for _ , testCase := range testCases {
447+ t .Run (testCase .name , func (t * testing.T ) {
448+ e := New ()
449+
450+ gotO := e .Local (testCase .args .command , testCase .args .args ... )
451+
452+ require .Equal (t , testCase .wantO , gotO , "Remote() = %v, want %v" , gotO , testCase .wantO )
453+ })
454+ }
455+ }
0 commit comments