diff options
Diffstat (limited to 'crates/mozart-core/src')
| -rw-r--r-- | crates/mozart-core/src/composer.rs | 6 | ||||
| -rw-r--r-- | crates/mozart-core/src/console.rs | 8 | ||||
| -rw-r--r-- | crates/mozart-core/src/package.rs | 4 | ||||
| -rw-r--r-- | crates/mozart-core/src/platform.rs | 8 | ||||
| -rw-r--r-- | crates/mozart-core/src/suggest.rs | 8 | ||||
| -rw-r--r-- | crates/mozart-core/src/version_bumper.rs | 34 | ||||
| -rw-r--r-- | crates/mozart-core/src/wildcard.rs | 2 |
7 files changed, 0 insertions, 70 deletions
diff --git a/crates/mozart-core/src/composer.rs b/crates/mozart-core/src/composer.rs index dd7c9a6..84d6606 100644 --- a/crates/mozart-core/src/composer.rs +++ b/crates/mozart-core/src/composer.rs @@ -11,8 +11,6 @@ use std::collections::BTreeMap; use std::path::{Path, PathBuf}; -// ─── composer_home ──────────────────────────────────────────────────────────── - /// Return the Composer home directory, respecting `COMPOSER_HOME` and falling /// back to the platform default using Composer-compatible logic. /// @@ -71,8 +69,6 @@ fn use_xdg() -> bool { || std::path::Path::new("/etc/xdg").is_dir() } -// ─── ComposerConfig ─────────────────────────────────────────────────────────── - /// Effective Composer config key/value pairs for a project. /// Keys mirror `Composer\Config`'s defaults; values are stored as raw /// `serde_json::Value` so callers can re-interpret them per key. @@ -195,8 +191,6 @@ pub fn resolve_references(config: &mut ComposerConfig) { } } -// ─── Composer ──────────────────────────────────────────────────────────────── - /// Project-level Composer state. Currently only carries the merged /// `ComposerConfig`; additional accessors (root package, locker, …) can be /// layered on as commands need them. diff --git a/crates/mozart-core/src/console.rs b/crates/mozart-core/src/console.rs index e37ff23..fb7c9b9 100644 --- a/crates/mozart-core/src/console.rs +++ b/crates/mozart-core/src/console.rs @@ -267,8 +267,6 @@ impl Console { mod tests { use super::*; - // ── Verbosity::from_flags ─────────────────────────────────────────────── - #[test] fn test_verbosity_quiet_takes_priority() { assert_eq!(Verbosity::from_flags(3, true), Verbosity::Quiet); @@ -296,8 +294,6 @@ mod tests { assert_eq!(Verbosity::from_flags(10, false), Verbosity::Debug); } - // ── Verbosity ordering ────────────────────────────────────────────────── - #[test] fn test_verbosity_ordering() { assert!(Verbosity::Quiet < Verbosity::Normal); @@ -306,8 +302,6 @@ mod tests { assert!(Verbosity::VeryVerbose < Verbosity::Debug); } - // ── Console::resolve_decorated ────────────────────────────────────────── - #[test] fn test_resolve_decorated_no_ansi_wins() { assert!(!Console::resolve_decorated(true, true)); @@ -319,8 +313,6 @@ mod tests { assert!(Console::resolve_decorated(true, false)); } - // ── Console query methods ─────────────────────────────────────────────── - fn make_console(verbosity: Verbosity) -> Console { Console { interactive: false, diff --git a/crates/mozart-core/src/package.rs b/crates/mozart-core/src/package.rs index ccbda1f..a850517 100644 --- a/crates/mozart-core/src/package.rs +++ b/crates/mozart-core/src/package.rs @@ -238,10 +238,6 @@ pub trait RootPackage: CompletePackage { fn aliases(&self) -> &[VersionAlias]; } -// ────────────────────────────────────────────── -// Delegation macros -// ────────────────────────────────────────────── - /// Implements `Package` trait by delegating to an inner `PackageData` field. macro_rules! delegate_package { ($type:ty => $($path:ident).+) => { diff --git a/crates/mozart-core/src/platform.rs b/crates/mozart-core/src/platform.rs index 47ce2a0..6047b58 100644 --- a/crates/mozart-core/src/platform.rs +++ b/crates/mozart-core/src/platform.rs @@ -3,8 +3,6 @@ // Provides detection of the PHP environment (version, extensions, capabilities) // and helpers for identifying platform package names (php, ext-*, lib-*, etc.). -// ─── Data structures ───────────────────────────────────────────────────────── - /// A detected platform package with its name and version. #[derive(Debug, Clone, PartialEq, Eq)] pub struct PlatformPackage { @@ -12,8 +10,6 @@ pub struct PlatformPackage { pub version: String, } -// ─── Classification ────────────────────────────────────────────────────────── - /// Returns true if the package name is a Composer platform package. /// /// Mirrors `Composer\Repository\PlatformRepository::PLATFORM_PACKAGE_REGEX`: @@ -44,8 +40,6 @@ pub fn is_platform_package(name: &str) -> bool { } } -// ─── Detection ─────────────────────────────────────────────────────────────── - /// Composer runtime API version that Mozart emulates. /// Corresponds to `Composer::RUNTIME_API_VERSION` in Composer. pub const COMPOSER_RUNTIME_API_VERSION: &str = "2.2.2"; @@ -344,8 +338,6 @@ pub fn detect_php_extensions() -> Vec<String> { .collect() } -// ─── Tests ─────────────────────────────────────────────────────────────────── - #[cfg(test)] mod tests { use super::*; diff --git a/crates/mozart-core/src/suggest.rs b/crates/mozart-core/src/suggest.rs index 9311fdb..299355e 100644 --- a/crates/mozart-core/src/suggest.rs +++ b/crates/mozart-core/src/suggest.rs @@ -96,14 +96,10 @@ pub fn format_did_you_mean(suggestions: &[&str]) -> Option<String> { Some(format!("Did you mean {}?", formatted)) } -// ─── Tests ─────────────────────────────────────────────────────────────────── - #[cfg(test)] mod tests { use super::*; - // ── levenshtein ─────────────────────────────────────────────────────────── - #[test] fn test_levenshtein_identical() { assert_eq!(levenshtein("psr/log", "psr/log"), 0); @@ -150,8 +146,6 @@ mod tests { assert_eq!(levenshtein("monolog/monolog", "monolong/monolog"), 1); } - // ── find_similar ────────────────────────────────────────────────────────── - #[test] fn test_find_similar_returns_close_matches() { let candidates = ["psr/log", "psr/cache", "monolog/monolog", "symfony/console"]; @@ -196,8 +190,6 @@ mod tests { assert!(results.is_empty()); } - // ── format_did_you_mean ─────────────────────────────────────────────────── - #[test] fn test_format_did_you_mean_empty() { assert!(format_did_you_mean(&[]).is_none()); diff --git a/crates/mozart-core/src/version_bumper.rs b/crates/mozart-core/src/version_bumper.rs index 5d6e75e..fc53d53 100644 --- a/crates/mozart-core/src/version_bumper.rs +++ b/crates/mozart-core/src/version_bumper.rs @@ -48,8 +48,6 @@ pub fn bump_requirement( bump_single(constraint_body.trim(), &installed_version, stability_flag) } -// ─── OR constraint handling ─────────────────────────────────────────────────── - fn bump_or_constraint( constraint_body: &str, installed_version: &str, @@ -90,8 +88,6 @@ fn bump_or_constraint( Some(result) } -// ─── Single constraint handling ─────────────────────────────────────────────── - fn bump_single( constraint: &str, installed_version: &str, @@ -136,8 +132,6 @@ fn bump_single( None } -// ─── Caret bump ─────────────────────────────────────────────────────────────── - /// `^X.Y.Z` → bump to installed version if it is greater. /// /// The caret prefix is preserved; segments from installed version replace @@ -199,8 +193,6 @@ fn bump_caret(rest: &str, installed_version: &str, stability_flag: Option<&str>) Some(result) } -// ─── Tilde bump ─────────────────────────────────────────────────────────────── - /// `~X.Y.Z` (3 segments) → bump patch: `~X.Y.new_patch` /// `~X.Y` (2 segments) → convert to caret: `^X.Y.new_patch` fn bump_tilde(rest: &str, installed_version: &str, stability_flag: Option<&str>) -> Option<String> { @@ -248,8 +240,6 @@ fn bump_tilde(rest: &str, installed_version: &str, stability_flag: Option<&str>) Some(result) } -// ─── Wildcard bump ──────────────────────────────────────────────────────────── - /// `*` → `>=installed` /// `X.*` → `>=installed` (trimming trailing zeros) fn bump_wildcard( @@ -301,8 +291,6 @@ fn bump_wildcard( Some(append_stability_flag(&new_constraint, stability_flag)) } -// ─── GTE bump ───────────────────────────────────────────────────────────────── - /// `>=X.Y` → raise to installed version (trimming trailing zeros) fn bump_gte(rest: &str, installed_version: &str, stability_flag: Option<&str>) -> Option<String> { let constraint_segments = parse_version_segments(rest); @@ -342,8 +330,6 @@ fn bump_gte(rest: &str, installed_version: &str, stability_flag: Option<&str>) - Some(result) } -// ─── AND constraint bump ────────────────────────────────────────────────── - /// Bump AND constraints like `>=1.0 <2.0` or `>=1.0,<2.0`. /// /// Only the lower-bound part (>=, ^, ~) is bumped; upper-bound parts @@ -425,8 +411,6 @@ fn is_lower_bound(part: &str) -> bool { part.starts_with(">=") || part.starts_with('^') || part.starts_with('~') } -// ─── Helpers ────────────────────────────────────────────────────────────────── - /// Strip a trailing `@stability` flag from a constraint string. /// Returns (body, flag) where flag is the `@...` suffix (without the `@`). fn strip_stability_flag(constraint: &str) -> (&str, Option<&str>) { @@ -518,14 +502,10 @@ fn resolve_installed_version<'a>( .to_string() } -// ─── Tests ──────────────────────────────────────────────────────────────────── - #[cfg(test)] mod tests { use super::*; - // ── Caret bumps ─────────────────────────────────────────────────────────── - #[test] fn test_caret_bump_basic() { // ^1.0 + 1.2.1 → ^1.2.1 @@ -568,8 +548,6 @@ mod tests { assert_eq!(result, Some("^1.5".to_string())); } - // ── Tilde bumps ─────────────────────────────────────────────────────────── - #[test] fn test_tilde_three_segment_bump() { // ~2.0.0 + 2.0.3 → ~2.0.3 @@ -598,8 +576,6 @@ mod tests { assert_eq!(result, Some("^2.5".to_string())); } - // ── Wildcard bumps ──────────────────────────────────────────────────────── - #[test] fn test_wildcard_star() { // * + 1.2.3 → >=1.2.3 @@ -621,8 +597,6 @@ mod tests { assert_eq!(result, None); } - // ── GTE bumps ───────────────────────────────────────────────────────────── - #[test] fn test_gte_bump() { // >=1.2 + 1.5.0 → >=1.5 @@ -644,8 +618,6 @@ mod tests { assert_eq!(result, Some(">=1.5.3".to_string())); } - // ── OR constraints ──────────────────────────────────────────────────────── - #[test] fn test_or_constraint_bumps_matching_major() { // ^1.2 || ^2.3 + 1.3.0 → ^1.3 || ^2.3 @@ -667,8 +639,6 @@ mod tests { assert_eq!(result, None); } - // ── Dev constraints ─────────────────────────────────────────────────────── - #[test] fn test_dev_constraint_unchanged() { // dev-master → None @@ -690,8 +660,6 @@ mod tests { assert_eq!(result, Some("^1.2".to_string())); } - // ── Stability flags ─────────────────────────────────────────────────────── - #[test] fn test_stability_flag_preserved() { // ^1.0@dev + 1.2.0 → ^1.2@dev @@ -706,8 +674,6 @@ mod tests { assert_eq!(result, Some("^1.2.1@beta".to_string())); } - // ── Edge cases ──────────────────────────────────────────────────────────── - #[test] fn test_exact_constraint_no_bump() { // 1.2.3 → None (exact version, not bumped) diff --git a/crates/mozart-core/src/wildcard.rs b/crates/mozart-core/src/wildcard.rs index 9193549..4d4a763 100644 --- a/crates/mozart-core/src/wildcard.rs +++ b/crates/mozart-core/src/wildcard.rs @@ -33,8 +33,6 @@ pub fn matches_wildcard(name: &str, pattern: &str) -> bool { true } -// ─── Tests ────────────────────────────────────────────────────────────────── - #[cfg(test)] mod tests { use super::*; |
