github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/cli/connhelper/connhelper_test.go (about) 1 package connhelper 2 3 import ( 4 "testing" 5 6 "gotest.tools/v3/assert" 7 ) 8 9 func TestSSHFlags(t *testing.T) { 10 testCases := []struct { 11 in []string 12 out []string 13 }{ 14 { 15 in: []string{}, 16 out: []string{"-o ConnectTimeout=30"}, 17 }, 18 { 19 in: []string{"option", "-o anotherOption"}, 20 out: []string{"option", "-o anotherOption", "-o ConnectTimeout=30"}, 21 }, 22 { 23 in: []string{"-o ConnectTimeout=5", "anotherOption"}, 24 out: []string{"-o ConnectTimeout=5", "anotherOption"}, 25 }, 26 } 27 28 for _, tc := range testCases { 29 assert.DeepEqual(t, addSSHTimeout(tc.in), tc.out) 30 } 31 }