mirror of
https://github.com/nushell/nushell
synced 2025-01-26 11:55:20 +00:00
Fixes: #9913 Changes: - updated crate bracoxide from v0.1.1 to v0.1.2
This commit is contained in:
parent
a2e117f8b0
commit
d302d63030
2 changed files with 66 additions and 1 deletions
|
@ -93,7 +93,7 @@ url = "2.2"
|
||||||
uuid = { version = "1.3", features = ["v4"] }
|
uuid = { version = "1.3", features = ["v4"] }
|
||||||
wax = { version = "0.5" }
|
wax = { version = "0.5" }
|
||||||
which = { version = "4.4", optional = true }
|
which = { version = "4.4", optional = true }
|
||||||
bracoxide = "0.1.1"
|
bracoxide = "0.1.2"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winreg = "0.50"
|
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 {
|
Example {
|
||||||
description: "Use double backslashes to add a backslash.",
|
description: "Use double backslashes to add a backslash.",
|
||||||
example: "'A{B\\\\,C}' | str expand",
|
example: "'A{B\\\\,C}' | str expand",
|
||||||
|
@ -270,6 +282,59 @@ fn str_expand(contents: &str, span: Span, value_span: Span) -> Value {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
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]
|
#[test]
|
||||||
fn test_examples() {
|
fn test_examples() {
|
||||||
use crate::test_examples;
|
use crate::test_examples;
|
||||||
|
|
Loading…
Reference in a new issue