From bd1d554a35b543afa5a79dd483583bf2aad9cf47 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 15 Apr 2016 17:06:52 -0400 Subject: libremessages:flag: Fix several things (also librexgettext) - Fix a bug where it panicked if given an odd number of sub-headings. - Document the the ability to include sub-headings. - Fix librexgettext's handling of it. It only worked correctly for times when it was only called once in a program, or when it was only ever called with exactly one flag/description pair (and no headings). --- test/lib-messages-test.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/lib-messages-test.sh b/test/lib-messages-test.sh index 3fcac63..d895d99 100644 --- a/test/lib-messages-test.sh +++ b/test/lib-messages-test.sh @@ -46,3 +46,19 @@ it_fails_with_msg_and_no_args() { libremessages msg || ret=$? [[ $ret != 0 ]] } + +it_allows_subheadings_to_flag() { + # Note that old versions of `flag` panicked if given an odd + # number of headings, so give an odd number here. + libremessages flag \ + -a adesc \ + -b bdesc \ + Head1: \ + -c cdesc > $tmpdir/out + printf '%s\n' \ + ' -a adesc' \ + ' -b bdesc' \ + ' Head1:' \ + ' -c cdesc' > $tmpdir/exp + diff -u $tmpdir/exp $tmpdir/out +} -- cgit v1.2.3-2-g168b