diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2024-01-08 02:35:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-08 02:35:32 -0500 |
commit | 0f969fcfd4409f8045357298c5229500cf720cba (patch) | |
tree | 00b8f45372a177ab9402b695de1adfa2a0308526 /src/constants.rs | |
parent | 0c161ae77e92580541ae19e3bd4363216be5b5e8 (diff) |
refactor: clean up help drawing code (#1374)
* refactor: clean up the help drawing
* a bit cleaner
* add test
* some fmt
Diffstat (limited to 'src/constants.rs')
-rw-r--r-- | src/constants.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/constants.rs b/src/constants.rs index d736e928..f09a5d5b 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -752,6 +752,7 @@ mod test { #[test] fn help_menu_matches_entry_len() { + // The two match since HELP_TEXT contains HELP_CONTENTS_TEXT as an entry assert_eq!( HELP_CONTENTS_TEXT.len(), HELP_TEXT.len(), @@ -759,6 +760,16 @@ mod test { ) } + #[test] + fn help_menu_text_has_sections() { + for (itx, line) in HELP_TEXT.iter().enumerate() { + if itx > 0 { + assert!(line.len() >= 2, "each section should be at least 2 lines"); + assert!(line[0].contains(" - "), "each section should have a header"); + } + } + } + /// This test exists because previously, [`SIDE_BORDERS`] was set incorrectly after I moved from /// tui-rs to ratatui. #[test] |