diff --git a/justfile b/justfile index e74e9142db..1b9ea12d25 100755 --- a/justfile +++ b/justfile @@ -30,7 +30,7 @@ run: # only run tests matching `PATTERN` [group: 'test'] -filter PATTERN: (watch f'ltest --tests --all --all-targets {{PATTERN}}') +filter PATTERN: (watch f'ltest --tests --all --all-targets {{ PATTERN }}') [group: 'misc'] build: diff --git a/src/expression.rs b/src/expression.rs index cee39836cf..4a879f2ed0 100644 --- a/src/expression.rs +++ b/src/expression.rs @@ -202,7 +202,7 @@ impl Display for Expression<'_> { write!(f, "{start}")?; for (expression, string) in expressions { - write!(f, "{expression}{string}")?; + write!(f, " {expression} {string}")?; } Ok(()) diff --git a/tests/format_string.rs b/tests/format_string.rs index 7b8c93edf7..87707f85db 100644 --- a/tests/format_string.rs +++ b/tests/format_string.rs @@ -254,9 +254,18 @@ fn dump() { case("f''''''"); case(r#"f"""#); case(r#"f"""""""#); - case("f'{{'a'}}b{{'c'}}d'"); - case("f'''{{'a'}}b{{'c'}}d'''"); - case(r#"f"""{{'a'}}b{{'c'}}d""""#); + case("f'{{ 'a' }}b{{ 'c' }}d'"); + case("f'''{{ 'a' }}b{{ 'c' }}d'''"); + case(r#"f"""{{ 'a' }}b{{ 'c' }}d""""#); +} + +#[test] +fn interpolation_expressions_are_formatted_with_spaces() { + Test::new() + .justfile("foo := f'{{'a'}}'") + .arg("--dump") + .stdout("foo := f'{{ 'a' }}'\n") + .success(); } #[test]