mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 23:49:44 +01:00
Fix string interp/shorthand overlap (#3412)
This commit is contained in:
parent
2bb23c57df
commit
efac712f62
@ -1738,9 +1738,9 @@ fn expand_shorthand_forms(
|
||||
lite_pipeline: &LitePipeline,
|
||||
) -> (LitePipeline, Option<SpannedKeyValue>, Option<ParseError>) {
|
||||
if !lite_pipeline.commands.is_empty() {
|
||||
if lite_pipeline.commands[0].parts[0].item == "=" {
|
||||
(lite_pipeline.clone(), None, None)
|
||||
} else if lite_pipeline.commands[0].parts[0].contains('=') {
|
||||
if lite_pipeline.commands[0].parts[0].contains('=')
|
||||
&& !lite_pipeline.commands[0].parts[0].starts_with('$')
|
||||
{
|
||||
let assignment: Vec<_> = lite_pipeline.commands[0].parts[0].split('=').collect();
|
||||
if assignment.len() != 2 {
|
||||
(
|
||||
|
@ -137,6 +137,18 @@ fn string_interpolation_with_it_column_path() {
|
||||
assert_eq!(actual.out, "sammie");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn string_interpolation_shorthand_overlap() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
$"3 + 4 = {3 + 4}"
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "3 + 4 = 7");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bignum_large_integer() {
|
||||
let actual = nu!(
|
||||
|
Loading…
Reference in New Issue
Block a user