diff options
Diffstat (limited to 'crates/shirabe/tests/console')
| -rw-r--r-- | crates/shirabe/tests/console/html_output_formatter_test.rs | 34 | ||||
| -rw-r--r-- | crates/shirabe/tests/console/main.rs | 1 |
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; |
