From 46819c09f356766d899e74a9a80f2385511eeae5 Mon Sep 17 00:00:00 2001 From: John McCabe Date: Fri, 25 Aug 2017 22:37:14 +0100 Subject: [PATCH] Update Bash completion tests Prefixes the tested `__handle_filename_extension_flag` and `__handle_subdirs_in_dir_flag` functions with the command name. --- bash_completions_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bash_completions_test.go b/bash_completions_test.go index a0da8714..dd3a88ef 100644 --- a/bash_completions_test.go +++ b/bash_completions_test.go @@ -2,6 +2,7 @@ package cobra import ( "bytes" + "fmt" "os" "os/exec" "strings" @@ -146,11 +147,11 @@ func TestBashCompletions(t *testing.T) { // check for filename extension flags check(t, output, `must_have_one_noun+=("three")`) // check for filename extension flags - check(t, output, `flags_completion+=("__handle_filename_extension_flag json|yaml|yml")`) + check(t, output, fmt.Sprintf(`flags_completion+=("__%s_handle_filename_extension_flag json|yaml|yml")`, rootCmd.Name())) // check for custom flags check(t, output, `flags_completion+=("__complete_custom")`) // check for subdirs_in_dir flags - check(t, output, `flags_completion+=("__handle_subdirs_in_dir_flag themes")`) + check(t, output, fmt.Sprintf(`flags_completion+=("__%s_handle_subdirs_in_dir_flag themes")`, rootCmd.Name())) checkOmit(t, output, deprecatedCmd.Name())