File: test_examples.rs

package info (click to toggle)
rust-clap-markdown 0.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 160 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 822 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use clap_markdown::MarkdownOptions;
use pretty_assertions::assert_eq;

/// Tests that the `complex-app` example featured in the README.md is
/// up-to-date.
#[test]
fn test_example_complex_app() {
    mod complex_app {
        include!("../docs/examples/complex_app.rs");
    }

    assert_eq!(
        clap_markdown::help_markdown::<complex_app::Cli>(),
        include_str!("../docs/examples/complex-app.md")
    );

    assert_eq!(
        clap_markdown::help_markdown_custom::<complex_app::Cli>(
            &MarkdownOptions::new()
                .title(format!("Some Custom Title for Complex App"))
                .show_footer(false)
                .show_table_of_contents(false)
        ),
        include_str!("../docs/examples/complex-app-custom.md"),
        "Mismatch testing CUSTOM Markdown output"
    );
}