mirror of
https://github.com/nushell/nushell.git
synced 2025-02-18 03:21:05 +01:00
Fix env var shorthand when value contains =
(#5022)
This commit is contained in:
parent
79182db587
commit
31a4fc41eb
@ -4117,7 +4117,7 @@ pub fn parse_expression(
|
|||||||
// Check if there is any environment shorthand
|
// Check if there is any environment shorthand
|
||||||
let name = working_set.get_span_contents(spans[pos]);
|
let name = working_set.get_span_contents(spans[pos]);
|
||||||
|
|
||||||
let split = name.split(|x| *x == b'=');
|
let split = name.splitn(2, |x| *x == b'=');
|
||||||
let split: Vec<_> = split.collect();
|
let split: Vec<_> = split.collect();
|
||||||
if split.len() == 2 && !split[0].is_empty() {
|
if split.len() == 2 && !split[0].is_empty() {
|
||||||
let point = split[0].len() + 1;
|
let point = split[0].len() + 1;
|
||||||
|
@ -14,8 +14,6 @@ fn env_shorthand() {
|
|||||||
assert_eq!(actual.out, "bar");
|
assert_eq!(actual.out, "bar");
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: shorthand breaks when there's an equals sign in the env var
|
|
||||||
#[ignore]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn env_shorthand_with_equals() {
|
fn env_shorthand_with_equals() {
|
||||||
let actual = nu!(cwd: ".", r#"
|
let actual = nu!(cwd: ".", r#"
|
||||||
@ -24,8 +22,6 @@ fn env_shorthand_with_equals() {
|
|||||||
assert_eq!(actual.out, "my_module=info");
|
assert_eq!(actual.out, "my_module=info");
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: shorthand breaks when there's an equals sign in the env var
|
|
||||||
#[ignore]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn env_shorthand_with_comma_equals() {
|
fn env_shorthand_with_comma_equals() {
|
||||||
let actual = nu!(cwd: ".", r#"
|
let actual = nu!(cwd: ".", r#"
|
||||||
@ -34,8 +30,6 @@ fn env_shorthand_with_comma_equals() {
|
|||||||
assert_eq!(actual.out, "info,my_module=info");
|
assert_eq!(actual.out, "info,my_module=info");
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: shorthand breaks when there's an equals sign in the env var
|
|
||||||
#[ignore]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn env_shorthand_with_comma_colons_equals() {
|
fn env_shorthand_with_comma_colons_equals() {
|
||||||
let actual = nu!(cwd: ".", r#"
|
let actual = nu!(cwd: ".", r#"
|
||||||
@ -44,8 +38,6 @@ fn env_shorthand_with_comma_colons_equals() {
|
|||||||
assert_eq!(actual.out, "info,my_module=info,lib_crate::lib_mod=trace");
|
assert_eq!(actual.out, "info,my_module=info,lib_crate::lib_mod=trace");
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: shorthand breaks when there's an equals sign in the env var
|
|
||||||
#[ignore]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn env_shorthand_multi_second_with_comma_colons_equals() {
|
fn env_shorthand_multi_second_with_comma_colons_equals() {
|
||||||
let actual = nu!(cwd: ".", r#"
|
let actual = nu!(cwd: ".", r#"
|
||||||
@ -57,8 +49,6 @@ fn env_shorthand_multi_second_with_comma_colons_equals() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: shorthand breaks when there's an equals sign in the env var
|
|
||||||
#[ignore]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn env_shorthand_multi_first_with_comma_colons_equals() {
|
fn env_shorthand_multi_first_with_comma_colons_equals() {
|
||||||
let actual = nu!(cwd: ".", r#"
|
let actual = nu!(cwd: ".", r#"
|
||||||
|
Loading…
Reference in New Issue
Block a user