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.
This commit is contained in:
Darren Schroeder 2023-02-24 11:52:51 -06:00 committed by GitHub
parent b572b4ecbd
commit fd1ac5106d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)",