mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
Fixes: #9913 Changes: - updated crate bracoxide from v0.1.1 to v0.1.2
This commit is contained in:
parent
a2e117f8b0
commit
d302d63030
@ -93,7 +93,7 @@ url = "2.2"
|
||||
uuid = { version = "1.3", features = ["v4"] }
|
||||
wax = { version = "0.5" }
|
||||
which = { version = "4.4", optional = true }
|
||||
bracoxide = "0.1.1"
|
||||
bracoxide = "0.1.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = "0.50"
|
||||
|
@ -65,6 +65,18 @@ impl Command for SubCommand {
|
||||
},)
|
||||
},
|
||||
|
||||
Example {
|
||||
description: "Commas that are not inside any braces need to be skipped.",
|
||||
example: "'Welcome\\, {home,mon ami}!' | str expand",
|
||||
result: Some(Value::List{
|
||||
vals: vec![
|
||||
Value::test_string("Welcome, home!"),
|
||||
Value::test_string("Welcome, mon ami!"),
|
||||
],
|
||||
span: Span::test_data()
|
||||
},)
|
||||
},
|
||||
|
||||
Example {
|
||||
description: "Use double backslashes to add a backslash.",
|
||||
example: "'A{B\\\\,C}' | str expand",
|
||||
@ -270,6 +282,59 @@ fn str_expand(contents: &str, span: Span, value_span: Span) -> Value {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn dots() {
|
||||
assert_eq!(
|
||||
str_expand("{a.b.c,d}", Span::test_data(), Span::test_data()),
|
||||
Value::List {
|
||||
vals: vec![
|
||||
Value::String {
|
||||
val: String::from("a.b.c"),
|
||||
span: Span::test_data(),
|
||||
},
|
||||
Value::String {
|
||||
val: String::from("d"),
|
||||
span: Span::test_data(),
|
||||
},
|
||||
],
|
||||
span: Span::test_data(),
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
str_expand("{1.2.3,a}", Span::test_data(), Span::test_data()),
|
||||
Value::List {
|
||||
vals: vec![
|
||||
Value::String {
|
||||
val: String::from("1.2.3"),
|
||||
span: Span::test_data(),
|
||||
},
|
||||
Value::String {
|
||||
val: String::from("a"),
|
||||
span: Span::test_data(),
|
||||
},
|
||||
],
|
||||
span: Span::test_data(),
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
str_expand("{a-1.2,b}", Span::test_data(), Span::test_data()),
|
||||
Value::List {
|
||||
vals: vec![
|
||||
Value::String {
|
||||
val: String::from("a-1.2"),
|
||||
span: Span::test_data(),
|
||||
},
|
||||
Value::String {
|
||||
val: String::from("b"),
|
||||
span: Span::test_data(),
|
||||
},
|
||||
],
|
||||
span: Span::test_data(),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_examples() {
|
||||
use crate::test_examples;
|
||||
|
Loading…
Reference in New Issue
Block a user