str-expand: Add Escaping Example (#9841)

**Related Issue: #9838**

Adds an **example**, how bracoxide/str-expand handles the escaping char
`\`.
This commit is contained in:
A. Taha Baki 2023-07-31 15:45:39 +03:00 committed by GitHub
parent 87abfee268
commit e16ce1df36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,30 @@ impl Command for SubCommand {
},)
},
Example {
description: "Ignore the next character after the backslash ('\\')",
example: "'A{B\\,,C}' | str expand",
result: Some(Value::List{
vals: vec![
Value::test_string("AB,"),
Value::test_string("AC"),
],
span: Span::test_data()
},)
},
Example {
description: "Use double backslashes to add a backslash.",
example: "'A{B\\\\,C}' | str expand",
result: Some(Value::List{
vals: vec![
Value::test_string("AB\\"),
Value::test_string("AC"),
],
span: Span::test_data()
},)
},
Example {
description: "Export comma separated values inside braces (`{}`) to a string list.",
example: "\"{apple,banana,cherry}\" | str expand",