clitest/
cli.rs

1use ::std::path::PathBuf;
2
3use ::clap::Parser;
4
5#[derive(Parser, Debug)]
6#[command()]
7pub struct Args {
8    /// Path of the file to test. By default searches all '*.clts' files
9    #[arg()]
10    pub path: Option<PathBuf>,
11
12    /// How many levels of directories to recurse into, at most (for performance)
13    #[arg(short = 'n', long, default_value="1000000", conflicts_with = "path")]
14    pub max_depth: u32,
15    /// Root directory within which to search for tests
16    #[arg(short = 'r', long = "root", conflicts_with = "path")]
17    pub roots: Vec<PathBuf>,
18    /// Minimum number of tests expected. Set to 0 to succeed even if there are no tests
19    #[arg(long, default_value = "1", conflicts_with = "path")]
20    pub minimum_tests: u32,
21
22    /// Copy the content of these directories to the test directory, as test data for the tests
23    #[arg(short = 's', long)]
24    pub source_dir: Vec<PathBuf>,
25    //TODO @mark: impl
26    /// Parent directory in which to place the test directories
27    #[arg(long)]
28    pub test_dir: Option<PathBuf>,
29    //TODO @mark: impl
30    /// Number of tests to run in parallel. Not always faster, since more test directories need to be maintained
31    #[arg(short = 'P', long, default_value = "1", conflicts_with = "path")]
32    pub parallel: u16,
33    //TODO @mark: impl
34}
35
36#[test]
37fn test_cli_args() {
38    Args::try_parse_from(&["cli-test", "file.test", "-n", "2", "-r", "examples", "--root", "cli_tests", "--minimum_tests", "1"]).unwrap();
39    Args::try_parse_from(&["cli-test"]).unwrap();
40}