github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/cli-plugins/manager/hooks_test.go (about) 1 package manager 2 3 import ( 4 "testing" 5 6 "gotest.tools/v3/assert" 7 ) 8 9 func TestGetNaiveFlags(t *testing.T) { 10 testCases := []struct { 11 args []string 12 expectedFlags map[string]string 13 }{ 14 { 15 args: []string{"docker"}, 16 expectedFlags: map[string]string{}, 17 }, 18 { 19 args: []string{"docker", "build", "-q", "--file", "test.Dockerfile", "."}, 20 expectedFlags: map[string]string{ 21 "q": "", 22 "file": "", 23 }, 24 }, 25 { 26 args: []string{"docker", "--context", "a-context", "pull", "-q", "--progress", "auto", "alpine"}, 27 expectedFlags: map[string]string{ 28 "context": "", 29 "q": "", 30 "progress": "", 31 }, 32 }, 33 } 34 35 for _, tc := range testCases { 36 assert.DeepEqual(t, getNaiveFlags(tc.args), tc.expectedFlags) 37 } 38 }