Skip to content

Commit

Permalink
Test multi-line strings in interpolation (#789)
Browse files Browse the repository at this point in the history
The behavior here is strange, and unintentional, but not obviously wrong.
Add a test to make sure I don't accidentally break it in the future.
  • Loading branch information
casey authored Apr 4, 2021
1 parent 7a649eb commit 78b67f6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,22 @@ mod tests {
),
}

test! {
name: interpolation_raw_multiline_string,
text: "hello:\n echo {{'\n'}}",
tokens: (
Identifier:"hello",
Colon,
Eol,
Indent:" ",
Text:"echo ",
InterpolationStart,
StringRaw:"'\n'",
InterpolationEnd,
Dedent,
),
}

test! {
name: tokenize_names,
text: "
Expand Down
13 changes: 13 additions & 0 deletions tests/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2452,6 +2452,19 @@ test! {
",
}

test! {
name: multi_line_string_in_interpolation,
justfile: "
foo:
echo {{'a
echo b
echo c'}}z
echo baz
",
stdout: "a\nb\ncz\nbaz\n",
stderr: "echo a\n echo b\n echo cz\necho baz\n",
}

#[cfg(windows)]
test! {
name: windows_interpreter_path_no_base,
Expand Down

0 comments on commit 78b67f6

Please sign in to comment.