Fix env var shorthand when value contains = (#5022)

This commit is contained in:
Reilly Wood 2022-03-29 13:56:55 -07:00 committed by GitHub
parent 79182db587
commit 31a4fc41eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 11 deletions

View File

@ -4117,7 +4117,7 @@ pub fn parse_expression(
// Check if there is any environment shorthand
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();
if split.len() == 2 && !split[0].is_empty() {
let point = split[0].len() + 1;

View File

@ -14,8 +14,6 @@ fn env_shorthand() {
assert_eq!(actual.out, "bar");
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_with_equals() {
let actual = nu!(cwd: ".", r#"
@ -24,8 +22,6 @@ fn env_shorthand_with_equals() {
assert_eq!(actual.out, "my_module=info");
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_with_comma_equals() {
let actual = nu!(cwd: ".", r#"
@ -34,8 +30,6 @@ fn env_shorthand_with_comma_equals() {
assert_eq!(actual.out, "info,my_module=info");
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_with_comma_colons_equals() {
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");
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_multi_second_with_comma_colons_equals() {
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]
fn env_shorthand_multi_first_with_comma_colons_equals() {
let actual = nu!(cwd: ".", r#"