aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/console
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-21 00:51:34 +0900
committernsfisis <nsfisis@gmail.com>2026-06-21 00:51:34 +0900
commit7bea9042a79d3cbfe31cc2595e8b8c6a3788ba15 (patch)
tree3ed5b522c21f8fd80249f02751e46264537620f7 /crates/shirabe/tests/console
parenta01e3a45d1b183ee7fe9ca45543b0663d5995faa (diff)
downloadphp-shirabe-7bea9042a79d3cbfe31cc2595e8b8c6a3788ba15.tar.gz
php-shirabe-7bea9042a79d3cbfe31cc2595e8b8c6a3788ba15.tar.zst
php-shirabe-7bea9042a79d3cbfe31cc2595e8b8c6a3788ba15.zip
test: port small leaf tests (config, filters, platform, formatter)
Port DefaultConfigTest, IgnoreAll/IgnoreNothingPlatformRequirementFilterTest, PlatformTest, GitExcludeFilterTest, and HtmlOutputFormatterTest. Each PHP Test/<Subdir>/ maps to a single integration-test binary via tests/<dir>/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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/console')
-rw-r--r--crates/shirabe/tests/console/html_output_formatter_test.rs34
-rw-r--r--crates/shirabe/tests/console/main.rs1
2 files changed, 35 insertions, 0 deletions
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<String, Box<dyn OutputFormatterStyleInterface>> = 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 <span style=\"color:green;\">green</span> <span style=\"color:yellow;\">yellow</span> <span style=\"color:black;background-color:yellow;\">black w/ yellow bg</span>"
+ .to_string()
+ ),
+ formatter
+ .format(Some(
+ "text <info>green</info> <comment>yellow</comment> <warning>black w/ yellow bg</warning>"
+ ))
+ .unwrap()
+ );
+}
diff --git a/crates/shirabe/tests/console/main.rs b/crates/shirabe/tests/console/main.rs
new file mode 100644
index 0000000..17685a4
--- /dev/null
+++ b/crates/shirabe/tests/console/main.rs
@@ -0,0 +1 @@
+mod html_output_formatter_test;