From 4dc73cac3581d1e3868a9b09ac784eebc2aa19ef Mon Sep 17 00:00:00 2001 From: mpeterv Date: Mon, 17 Feb 2014 15:26:04 +0400 Subject: [PATCH] added a test for multiline descriptions --- spec/help_spec.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spec/help_spec.lua b/spec/help_spec.lua index 4ba8e60..847c94a 100644 --- a/spec/help_spec.lua +++ b/spec/help_spec.lua @@ -55,6 +55,27 @@ describe("tests related to help message generation", function() }, "\r\n"), parser:prepare():get_help()) end) + it("adds margin for multiline descriptions", function() + local parser = argparse.parser "foo" + parser:flag "-v" + :count "0-2" + :target "verbosity" + :description [[ +Sets verbosity level. +-v: Report all warnings. +-vv: Report all debugging information. ]] + + assert.equal(table.concat({ + "Usage: foo [-v] [-h]", + "", + "Options: ", + " -v Sets verbosity level. ", + " -v: Report all warnings. ", + " -vv: Report all debugging information. ", + " -h, --help Show this help message and exit. " + }, "\r\n"), parser:prepare():get_help()) + end) + it("creates correct help message for commands", function() local parser = argparse.parser "foo" parser:flag "-q" "--quiet"