mirror of
https://github.com/nushell/nushell.git
synced 2025-04-21 19:58:21 +02: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,
|
lite_pipeline: &LitePipeline,
|
||||||
) -> (LitePipeline, Option<SpannedKeyValue>, Option<ParseError>) {
|
) -> (LitePipeline, Option<SpannedKeyValue>, Option<ParseError>) {
|
||||||
if !lite_pipeline.commands.is_empty() {
|
if !lite_pipeline.commands.is_empty() {
|
||||||
if lite_pipeline.commands[0].parts[0].item == "=" {
|
if lite_pipeline.commands[0].parts[0].contains('=')
|
||||||
(lite_pipeline.clone(), None, None)
|
&& !lite_pipeline.commands[0].parts[0].starts_with('$')
|
||||||
} else if lite_pipeline.commands[0].parts[0].contains('=') {
|
{
|
||||||
let assignment: Vec<_> = lite_pipeline.commands[0].parts[0].split('=').collect();
|
let assignment: Vec<_> = lite_pipeline.commands[0].parts[0].split('=').collect();
|
||||||
if assignment.len() != 2 {
|
if assignment.len() != 2 {
|
||||||
(
|
(
|
||||||
|
@ -137,6 +137,18 @@ fn string_interpolation_with_it_column_path() {
|
|||||||
assert_eq!(actual.out, "sammie");
|
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]
|
#[test]
|
||||||
fn bignum_large_integer() {
|
fn bignum_large_integer() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
|
Loading…
Reference in New Issue
Block a user