diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-11 02:36:42 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-11 02:36:42 +0900 |
| commit | 4e99773a3d203e73b8bf6464490d05649a269fa7 (patch) | |
| tree | 7a6f1a7f773a14ea72dc2f9ff4124badd345833d /crates/mozart/src/commands/browse.rs | |
| parent | 4df5f8491320e5795718cf0222e80fa27e57c8ad (diff) | |
| download | php-mozart-4e99773a3d203e73b8bf6464490d05649a269fa7.tar.gz php-mozart-4e99773a3d203e73b8bf6464490d05649a269fa7.tar.zst php-mozart-4e99773a3d203e73b8bf6464490d05649a269fa7.zip | |
test(commands): remove per-command tests
Diffstat (limited to 'crates/mozart/src/commands/browse.rs')
| -rw-r--r-- | crates/mozart/src/commands/browse.rs | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/crates/mozart/src/commands/browse.rs b/crates/mozart/src/commands/browse.rs index 957f4bc..4149cf8 100644 --- a/crates/mozart/src/commands/browse.rs +++ b/crates/mozart/src/commands/browse.rs @@ -174,95 +174,3 @@ fn which(cmd: &str) -> bool { .map(|o| o.status.success()) .unwrap_or(false) } - -#[cfg(test)] -mod tests { - use super::*; - - fn console() -> std::sync::Arc<std::sync::Mutex<Box<dyn IoInterface>>> { - std::sync::Arc::new(std::sync::Mutex::new( - Box::new(mozart_core::console::Console::new( - 0, false, false, false, true, - )) as Box<dyn IoInterface>, - )) - } - - fn view( - support: Option<&str>, - source: Option<&str>, - homepage: Option<&str>, - ) -> CompletePackageView { - CompletePackageView { - support_source: support.map(str::to_string), - source_url: source.map(str::to_string), - homepage: homepage.map(str::to_string), - } - } - - #[test] - fn is_valid_url_accepts_filter_var_compatible_schemes() { - assert!(is_valid_url("https://example.com")); - assert!(is_valid_url("http://example.com/path?query=1")); - assert!(is_valid_url("ftp://example.com/a")); - } - - #[test] - fn is_valid_url_rejects_malformed() { - assert!(!is_valid_url("")); - assert!(!is_valid_url("not-a-url")); - assert!(!is_valid_url("https://")); - } - - #[test] - fn handle_package_prefers_support_source() { - let v = view( - Some("https://github.com/vendor/pkg"), - Some("https://github.com/vendor/pkg.git"), - Some("https://vendor.example.com"), - ); - assert!(handle_package(&v, false, true, console()).unwrap()); - } - - #[test] - fn handle_package_falls_back_to_source_url() { - let v = view( - None, - Some("https://github.com/vendor/pkg.git"), - Some("https://vendor.example.com"), - ); - assert!(handle_package(&v, false, true, console()).unwrap()); - } - - #[test] - fn handle_package_falls_back_to_homepage_when_no_source() { - let v = view(None, None, Some("https://vendor.example.com")); - assert!(handle_package(&v, false, true, console()).unwrap()); - } - - #[test] - fn handle_package_show_homepage_overrides_to_homepage() { - let v = view( - Some("https://github.com/vendor/pkg"), - Some("https://github.com/vendor/pkg.git"), - Some("https://vendor.example.com"), - ); - assert!(handle_package(&v, true, true, console()).unwrap()); - } - - #[test] - fn handle_package_returns_false_when_no_valid_url() { - let v = view(None, None, None); - assert!(!handle_package(&v, false, true, console()).unwrap()); - - // Invalid URL strings still cause `handlePackage` to bail. - let bad = view(Some("not-a-url"), None, None); - assert!(!handle_package(&bad, false, true, console()).unwrap()); - } - - #[test] - fn handle_package_show_homepage_with_missing_homepage_returns_false() { - let v = view(Some("https://github.com/vendor/pkg"), None, None); - // -H and homepage absent → falls through and bails. - assert!(!handle_package(&v, true, true, console()).unwrap()); - } -} |
