mirror of
https://github.com/nushell/nushell.git
synced 2025-02-18 03:21:05 +01:00
Fix parsing dot dot path (#3331)
This commit is contained in:
parent
ea5bf9db36
commit
61768aa2fd
@ -486,13 +486,11 @@ fn parse_dollar_expr(
|
|||||||
//Return invocation
|
//Return invocation
|
||||||
trace!("Parsing invocation expression");
|
trace!("Parsing invocation expression");
|
||||||
parse_invocation(lite_arg, scope)
|
parse_invocation(lite_arg, scope)
|
||||||
} else if lite_arg.item.contains("..") {
|
} else if let (expr, None) = parse_range(lite_arg, scope) {
|
||||||
parse_range(lite_arg, scope)
|
(expr, None)
|
||||||
} else if lite_arg.item.contains('.') {
|
} else if let (expr, None) = parse_full_column_path(lite_arg, scope) {
|
||||||
trace!("Parsing path expression");
|
(expr, None)
|
||||||
parse_full_column_path(lite_arg, scope)
|
|
||||||
} else {
|
} else {
|
||||||
trace!("Parsing variable expression");
|
|
||||||
parse_variable(lite_arg, scope)
|
parse_variable(lite_arg, scope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,33 @@ fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn treats_dot_dot_as_path_not_range() {
|
||||||
|
Playground::setup("dot_dot_dir", |dirs, sandbox| {
|
||||||
|
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||||
|
"nu_times.csv",
|
||||||
|
r#"
|
||||||
|
name,rusty_luck,origin
|
||||||
|
Jason,1,Canada
|
||||||
|
"#,
|
||||||
|
)]);
|
||||||
|
|
||||||
|
let actual = nu!(
|
||||||
|
cwd: dirs.test(), pipeline(
|
||||||
|
r#"
|
||||||
|
mkdir temp;
|
||||||
|
cd temp;
|
||||||
|
echo $(open ../nu_times.csv).name | autoview;
|
||||||
|
cd ..;
|
||||||
|
rmdir temp
|
||||||
|
"#
|
||||||
|
));
|
||||||
|
|
||||||
|
// chop will remove the last escaped double quote from \"Estados Unidos\"
|
||||||
|
assert_eq!(actual.out, "Jason");
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn invocation_properly_redirects() {
|
fn invocation_properly_redirects() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
|
Loading…
Reference in New Issue
Block a user