From fd1ac5106db292d56648f11e43f3c7aa7e6f3034 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Fri, 24 Feb 2023 11:52:51 -0600 Subject: [PATCH] fix ansi example so it is tested (#8192) # Description This PR just fixes one `ansi` test so that the test runner will accept it and test the scenario. No other changes. # User-Facing Changes _(List of all changes that impact the user experience here. This helps us keep track of breaking changes.)_ # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --- crates/nu-command/src/platform/ansi/ansi_.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/nu-command/src/platform/ansi/ansi_.rs b/crates/nu-command/src/platform/ansi/ansi_.rs index 43cf1fe40..fda9dc0f5 100644 --- a/crates/nu-command/src/platform/ansi/ansi_.rs +++ b/crates/nu-command/src/platform/ansi/ansi_.rs @@ -507,7 +507,10 @@ impl Command for AnsiCommand { fn signature(&self) -> Signature { Signature::build("ansi") - .input_output_types(vec![(Type::Nothing, Type::String)]) + .input_output_types(vec![ + (Type::Nothing, Type::String), + (Type::List(Box::new(Type::String)), Type::String), + ]) .optional( "code", SyntaxShape::Any, @@ -599,13 +602,9 @@ Format: # Example { description: "Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purple bold 'World')", example: r#"[(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str join"#, - result: None, - // Test disabled because the final expression in the pipeline is - // not the command being tested, and this violated assumptions - // made by the run-time input/output type-checking tests. - // result: Some(Value::test_string( - // "\u{1b}[3;93;41mHello\u{1b}[0m \u{1b}[1;32mNu \u{1b}[1;35mWorld\u{1b}[0m", - // )), + result: Some(Value::test_string( + "\u{1b}[3;93;41mHello\u{1b}[0m \u{1b}[1;32mNu \u{1b}[1;35mWorld\u{1b}[0m", + )), }, Example { description: "Use ansi to color text with a style (blue on red in bold)",