github.com/GGP1/kure@v0.8.4/commands/config/edit/edit_test.go (about) 1 package edit 2 3 import ( 4 "testing" 5 6 cmdutil "github.com/GGP1/kure/commands" 7 "github.com/GGP1/kure/config" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestEditErrors(t *testing.T) { 13 db := cmdutil.SetContext(t) 14 15 cases := []struct { 16 desc string 17 path string 18 }{ 19 { 20 desc: "Invalid filename", 21 path: "\\", 22 }, 23 } 24 25 cmd := NewCmd(db) 26 27 for _, tc := range cases { 28 t.Run(tc.desc, func(t *testing.T) { 29 config.SetFilename(tc.path) 30 31 err := cmd.Execute() 32 assert.Error(t, err) 33 }) 34 } 35 }