From b0d907570b9105273c7cb282ab94e05d11308164 Mon Sep 17 00:00:00 2001 From: gueckmooh Date: Fri, 28 May 2021 16:00:49 +0200 Subject: [PATCH] Update tests for mutiline descriptions --- argparse_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/argparse_test.go b/argparse_test.go index 6b94774..4899221 100644 --- a/argparse_test.go +++ b/argparse_test.go @@ -2691,3 +2691,27 @@ func TestCommandHelpSetSnameOnly(t *testing.T) { t.Error("Help arugment names should have defaulted") } } + +func TestCommandHelpMultiline(t *testing.T) { + expected := `usage: command [-h|--help] -s|--string "" + + Program with multiline + description. + +Arguments: + + -h --help Print help information + -s --string String argument example + on several lines + +` + + parser := NewParser("command", "Program with multiline\ndescription.") + + parser.String("s", "string", &Options{Required: true, Help: "String argument example\non several lines"}) + + actual := parser.Help(nil) + if expected != actual { + t.Errorf("Expectations unmet. expected: %s, actual: %s", expected, actual) + } +}