diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-22 17:53:13 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-22 17:53:13 +0900 |
| commit | ec5f3292ac324789298c3a12972f8f78b688ca24 (patch) | |
| tree | 44580ee521df4b0416fcafa9089695c5bc550270 /crates/shirabe/tests/installer_test.rs | |
| parent | 7286ee29637dbc694f769b618259eb9f75bab0fa (diff) | |
| download | php-shirabe-ec5f3292ac324789298c3a12972f8f78b688ca24.tar.gz php-shirabe-ec5f3292ac324789298c3a12972f8f78b688ca24.tar.zst php-shirabe-ec5f3292ac324789298c3a12972f8f78b688ca24.zip | |
feat(cli): tell the user to run `shirabe`, not `composer`
Messages that instruct the user to run a command named the Composer
binary. Shirabe ships as its own binary, so the hints now name it.
File names (composer.json, composer.lock), the "composer" repository
type and prose about Composer itself are untouched. The installer and
functional integration fixtures live in the Composer submodule and
cannot be edited, so their expected output is normalized on load.
Diffstat (limited to 'crates/shirabe/tests/installer_test.rs')
| -rw-r--r-- | crates/shirabe/tests/installer_test.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs index 922fbd45..597f8b86 100644 --- a/crates/shirabe/tests/installer_test.rs +++ b/crates/shirabe/tests/installer_test.rs @@ -569,6 +569,15 @@ struct IntegrationCase { expect_result: ExpectResult, } +/// The fixtures come from Composer's tree and name the `composer` binary in the hints they expect +/// on stdout; Shirabe prints its own name there. +fn rename_binary_in_expected_output(expected: String) -> String { + regex::Regex::new(r"\bcomposer (?P<cmd>config|fund|suggest|update)\b") + .unwrap() + .replace_all(&expected, "shirabe $cmd") + .into_owned() +} + fn fixtures_dir(path: &str) -> std::path::PathBuf { std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .join("../../composer/tests/Composer/Test/Fixtures") @@ -752,8 +761,14 @@ fn load_integration_tests(path: &str) -> Vec<IntegrationCase> { .filter(|s| !s.is_empty()) .map(|s| serde_json::from_str(s).unwrap()); - let expect_output = test_data.get("EXPECT-OUTPUT").cloned(); - let expect_output_optimized = test_data.get("EXPECT-OUTPUT-OPTIMIZED").cloned(); + let expect_output = test_data + .get("EXPECT-OUTPUT") + .cloned() + .map(rename_binary_in_expected_output); + let expect_output_optimized = test_data + .get("EXPECT-OUTPUT-OPTIMIZED") + .cloned() + .map(rename_binary_in_expected_output); let expect = test_data["EXPECT"].clone(); let expect_result = |
