summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/cobra/bash_completions_test.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-06-21 19:06:17 -0700
committerCorey Hulen <corey@hulen.com>2017-06-21 19:06:17 -0700
commit42f28ab8e374137fe3f5d25424489d879d4724f8 (patch)
tree20353f2446b506d32e6d353b72a57bf48f070389 /vendor/github.com/spf13/cobra/bash_completions_test.go
parent6b39c308d882a0aeac533f8ab1d90b48a2ae4b5a (diff)
downloadchat-42f28ab8e374137fe3f5d25424489d879d4724f8.tar.gz
chat-42f28ab8e374137fe3f5d25424489d879d4724f8.tar.bz2
chat-42f28ab8e374137fe3f5d25424489d879d4724f8.zip
Updating server dependancies (#6712)
Diffstat (limited to 'vendor/github.com/spf13/cobra/bash_completions_test.go')
-rw-r--r--vendor/github.com/spf13/cobra/bash_completions_test.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/vendor/github.com/spf13/cobra/bash_completions_test.go b/vendor/github.com/spf13/cobra/bash_completions_test.go
index 185570b2b..7511376ae 100644
--- a/vendor/github.com/spf13/cobra/bash_completions_test.go
+++ b/vendor/github.com/spf13/cobra/bash_completions_test.go
@@ -2,16 +2,12 @@ package cobra
import (
"bytes"
- "fmt"
"os"
"os/exec"
"strings"
"testing"
)
-var _ = fmt.Println
-var _ = os.Stderr
-
func checkOmit(t *testing.T, found, unexpected string) {
if strings.Contains(found, unexpected) {
t.Errorf("Unexpected response.\nGot: %q\nBut should not have!\n", unexpected)
@@ -178,3 +174,19 @@ func TestBashCompletionDeprecatedFlag(t *testing.T) {
t.Errorf("expected completion to not include %q flag: Got %v", flagName, bashCompletion)
}
}
+
+func BenchmarkBashCompletion(b *testing.B) {
+ c := initializeWithRootCmd()
+ cmdEcho.AddCommand(cmdTimes)
+ c.AddCommand(cmdEcho, cmdPrint, cmdDeprecated, cmdColon)
+
+ buf := new(bytes.Buffer)
+
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ if err := c.GenBashCompletion(buf); err != nil {
+ b.Fatal(err)
+ }
+ }
+}