github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/cmd/commands/exec_command_test.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package commands 5 6 import ( 7 "flag" 8 "testing" 9 10 "github.com/stretchr/testify/require" 11 12 "github.com/mattermost/mattermost-server/cmd" 13 ) 14 15 func TestExecCommand(t *testing.T) { 16 if filter := flag.Lookup("test.run").Value.String(); filter != "ExecCommand" { 17 t.Skip("use -run ExecCommand to execute a command via the test executable") 18 } 19 cmd.RootCmd.SetArgs(flag.Args()) 20 require.NoError(t, cmd.RootCmd.Execute()) 21 }