From 7bea9042a79d3cbfe31cc2595e8b8c6a3788ba15 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 21 Jun 2026 00:51:34 +0900 Subject: test: port small leaf tests (config, filters, platform, formatter) Port DefaultConfigTest, IgnoreAll/IgnoreNothingPlatformRequirementFilterTest, PlatformTest, GitExcludeFilterTest, and HtmlOutputFormatterTest. Each PHP Test// maps to a single integration-test binary via tests//main.rs (the target is named after the directory) whose #[test] functions are collected from the module tree. Tests that exercise unported library behavior (regex backreferences, Preg::split, env expansion) are marked #[ignore]. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../tests/console/html_output_formatter_test.rs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'crates/shirabe/tests/console/html_output_formatter_test.rs') diff --git a/crates/shirabe/tests/console/html_output_formatter_test.rs b/crates/shirabe/tests/console/html_output_formatter_test.rs index e3b65d9..af75551 100644 --- a/crates/shirabe/tests/console/html_output_formatter_test.rs +++ b/crates/shirabe/tests/console/html_output_formatter_test.rs @@ -1 +1,35 @@ //! ref: composer/tests/Composer/Test/Console/HtmlOutputFormatterTest.php + +use indexmap::IndexMap; +use shirabe::console::html_output_formatter::HtmlOutputFormatter; +use shirabe_external_packages::symfony::console::formatter::{ + OutputFormatterStyle, OutputFormatterStyleInterface, +}; + +#[test] +#[ignore = "HtmlOutputFormatter::format uses a regex pattern the regex crate cannot compile (backreferences)"] +fn test_formatting() { + let mut styles: IndexMap> = IndexMap::new(); + styles.insert( + "warning".to_string(), + Box::new(OutputFormatterStyle::new( + Some("black"), + Some("yellow"), + vec![], + )), + ); + + let mut formatter = HtmlOutputFormatter::new(styles); + + assert_eq!( + Some( + "text green yellow black w/ yellow bg" + .to_string() + ), + formatter + .format(Some( + "text green yellow black w/ yellow bg" + )) + .unwrap() + ); +} -- cgit v1.3.1