From f5437632f486b7d0a0a181c58f113c86d032b02c Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 24 Apr 2017 20:11:36 -0400 Subject: Upgrading server dependancies (#6215) --- .../github.com/spf13/cobra/doc/yaml_docs_test.go | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'vendor/github.com/spf13/cobra/doc/yaml_docs_test.go') diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs_test.go b/vendor/github.com/spf13/cobra/doc/yaml_docs_test.go index a41499e1f..fb969da22 100644 --- a/vendor/github.com/spf13/cobra/doc/yaml_docs_test.go +++ b/vendor/github.com/spf13/cobra/doc/yaml_docs_test.go @@ -2,14 +2,14 @@ package doc import ( "bytes" - "fmt" + "io/ioutil" "os" + "path/filepath" "strings" "testing" -) -var _ = fmt.Println -var _ = os.Stderr + "github.com/spf13/cobra" +) func TestGenYamlDoc(t *testing.T) { c := initializeWithRootCmd() @@ -86,3 +86,23 @@ func TestGenYamlNoTag(t *testing.T) { checkStringOmits(t, found, unexpected) } + +func TestGenYamlTree(t *testing.T) { + cmd := &cobra.Command{ + Use: "do [OPTIONS] arg1 arg2", + } + + tmpdir, err := ioutil.TempDir("", "test-gen-yaml-tree") + if err != nil { + t.Fatalf("Failed to create tmpdir: %s", err.Error()) + } + defer os.RemoveAll(tmpdir) + + if err := GenYamlTree(cmd, tmpdir); err != nil { + t.Fatalf("GenYamlTree failed: %s", err.Error()) + } + + if _, err := os.Stat(filepath.Join(tmpdir, "do.yaml")); err != nil { + t.Fatalf("Expected file 'do.yaml' to exist") + } +} -- cgit v1.2.3-1-g7c22