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/all_functional_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/all_functional_test.rs')
| -rw-r--r-- | crates/shirabe/tests/all_functional_test.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/shirabe/tests/all_functional_test.rs b/crates/shirabe/tests/all_functional_test.rs index 9879bca4..9f750717 100644 --- a/crates/shirabe/tests/all_functional_test.rs +++ b/crates/shirabe/tests/all_functional_test.rs @@ -125,6 +125,15 @@ fn clean_output(output: &str) -> String { String::from_utf8_lossy(&processed).into_owned() } +/// 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: &str) -> String { + regex::Regex::new(r"\bcomposer (?P<cmd>config|fund|suggest|update)\b") + .unwrap() + .replace_all(expected, "shirabe $cmd") + .into_owned() +} + /// ref: the inline `--EXPECT--` matcher in AllFunctionalTest::testIntegration. Literal byte /// comparison, except `%regex%` spans in `expected` are matched as `{regex}` against the remaining /// output and consume whatever they match. @@ -216,9 +225,10 @@ fn run_integration(test_filename: &str) { let raw_output = String::from_utf8_lossy(&proc.stdout).into_owned(); if let Some(expected) = test_data.get("EXPECT") { + let expected = rename_binary_in_expected_output(expected); let output = clean_output(&raw_output); let output = output.trim(); - expect_matches(expected, output); + expect_matches(&expected, output); } if let Some(expect_regex) = test_data.get("EXPECT-REGEX") { assert!(preg_match(expect_regex, &clean_output(&raw_output)).is_some()); |
