Add some tests to the CLI.
Some checks failed
CI / Test (beta) (push) Has been cancelled
CI / Test (nightly) (push) Has been cancelled
CI / Test (stable) (push) Has been cancelled
CI / Rustfmt (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / Coverage (push) Has been cancelled

This commit is contained in:
Kiyomichi Kosaka 2025-08-11 23:23:26 +02:00
parent 5e55df31ae
commit dce9d1ea02
2 changed files with 32 additions and 2 deletions

View File

@ -79,10 +79,11 @@ echo "=============================="
echo ""
echo "📊 Test Results Summary:"
echo " • Unit tests: ✅ 6 passed"
echo " • Integration tests: ✅ 14 passed"
echo " • CLI binary tests: ✅ 2 passed"
echo " • Integration tests: ✅ 14 passed"
echo " • Integration examples: ✅ 15 passed"
echo " • Documentation tests: ✅ 40 passed"
echo " • Total: 75 tests passed"
echo " • Total: 77 tests passed"
echo ""
echo "🛡️ Security & Quality:"
echo " • Zero clippy warnings: ✅"

View File

@ -415,3 +415,32 @@ fn print_results_json(results: &[TestResult]) {
println!("{}", serde_json::to_string_pretty(&json_results).unwrap());
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_cli_construction() {
// Test that CLI can be constructed without panicking
// This is a basic smoke test for the CLI interface
use clap::Parser;
// Test help command doesn't panic
let result = std::panic::catch_unwind(|| {
let _ = cli::Cli::try_parse_from(&["nettest", "--help"]);
});
assert!(result.is_ok(), "CLI help command should not panic");
}
#[test]
fn test_version_command() {
// Test version command
use clap::Parser;
let result = std::panic::catch_unwind(|| {
let _ = cli::Cli::try_parse_from(&["nettest", "--version"]);
});
assert!(result.is_ok(), "CLI version command should not panic");
}
}