summaryrefslogtreecommitdiff
path: root/test/lib-messages-test.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-15 17:06:52 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-15 17:19:47 -0400
commitbd1d554a35b543afa5a79dd483583bf2aad9cf47 (patch)
tree4c93824f367f0d0f95ce4231ee563ed8a865317e /test/lib-messages-test.sh
parent080d2decb7e3aae1917de9d8a7d5089d74833d65 (diff)
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).
Diffstat (limited to 'test/lib-messages-test.sh')
-rw-r--r--test/lib-messages-test.sh16
1 files changed, 16 insertions, 0 deletions
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
+}