From b84755875aa04fa2ac5cdb651434d6af267520c4 Mon Sep 17 00:00:00 2001 From: Matthew Witkowski Date: Tue, 19 Sep 2023 09:56:28 -0400 Subject: [PATCH] Add tests for invalid flag values. --- cmd/provenanced/cmd/docgen_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cmd/provenanced/cmd/docgen_test.go b/cmd/provenanced/cmd/docgen_test.go index 120c438c49..719612581b 100644 --- a/cmd/provenanced/cmd/docgen_test.go +++ b/cmd/provenanced/cmd/docgen_test.go @@ -47,6 +47,34 @@ func TestDocGen(t *testing.T) { createTarget: false, err: "mkdir %s: no such file or directory", }, + { + name: "failure - bad yaml value", + target: "tmp", + createTarget: true, + flags: []string{"--yaml=xyz"}, + err: "invalid argument \"xyz\" for \"--yaml\" flag: strconv.ParseBool: parsing \"xyz\": invalid syntax", + }, + { + name: "failure - bad rest value", + target: "tmp", + createTarget: true, + flags: []string{"--rest=xyz"}, + err: "invalid argument \"xyz\" for \"--rest\" flag: strconv.ParseBool: parsing \"xyz\": invalid syntax", + }, + { + name: "failure - bad markdown value", + target: "tmp", + createTarget: true, + flags: []string{"--markdown=xyz"}, + err: "invalid argument \"xyz\" for \"--markdown\" flag: strconv.ParseBool: parsing \"xyz\": invalid syntax", + }, + { + name: "failure - bad manpage value", + target: "tmp", + createTarget: true, + flags: []string{"--manpage=xyz"}, + err: "invalid argument \"xyz\" for \"--manpage\" flag: strconv.ParseBool: parsing \"xyz\": invalid syntax", + }, { name: "success - yaml is generated", target: "tmp",