forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix indent computation of a macro with braces.
The leading whitespace of a multine string was taken into account when computing the `min_prefix_space_width`, even if that line couldn't be trimmed. The consequence is it was always shifting the macro's content to the right.
- Loading branch information
Showing
4 changed files
with
354 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
#[cfg(test)] | ||
mod test { | ||
summary_test! { | ||
tokenize_recipe_interpolation_eol, | ||
"foo: # some comment | ||
{{hello}} | ||
", | ||
"foo: \ | ||
{{hello}} \ | ||
{{ahah}}", | ||
"N:#$>^{N}$<.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_strings, | ||
r#"a = "'a'" + '"b"' + "'c'" + '"d"'#echo hello"#, | ||
r#"N="+'+"+'#."#, | ||
} | ||
|
||
summary_test! { | ||
tokenize_recipe_interpolation_eol, | ||
"foo: # some comment | ||
{{hello}} | ||
", | ||
"N:#$>^{N}$<.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_recipe_interpolation_eof, | ||
"foo: # more comments | ||
{{hello}} | ||
# another comment | ||
", | ||
"N:#$>^{N}$<#$.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_recipe_complex_interpolation_expression, | ||
"foo: #lol\n {{a + b + \"z\" + blarg}}", | ||
"N:#$>^{N+N+\"+N}<.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_recipe_multiple_interpolations, | ||
"foo:,#ok\n {{a}}0{{b}}1{{c}}", | ||
"N:,#$>^{N}_{N}_{N}<.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_junk, | ||
"bob | ||
hello blah blah blah : a b c #whatever | ||
", | ||
"N$$NNNN:NNN#$.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_empty_lines, | ||
" | ||
# this does something | ||
hello: | ||
asdf | ||
bsdf | ||
csdf | ||
dsdf # whatever | ||
# yolo | ||
", | ||
"$#$N:$>^_$^_$$^_$$^_$$<#$.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_comment_before_variable, | ||
" | ||
# | ||
A='1' | ||
echo: | ||
echo {{A}} | ||
", | ||
"$#$N='$N:$>^_{N}$<.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_interpolation_backticks, | ||
"hello:\n echo {{`echo hello` + `echo goodbye`}}", | ||
"N:$>^_{`+`}<.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_assignment_backticks, | ||
"a = `echo hello` + `echo goodbye`", | ||
"N=`+`.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_multiple, | ||
" | ||
hello: | ||
a | ||
b | ||
c | ||
d | ||
# hello | ||
bob: | ||
frank | ||
", | ||
|
||
"$N:$>^_$^_$$^_$$^_$$<#$N:$>^_$<.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_comment, | ||
"a:=#", | ||
"N:=#." | ||
} | ||
|
||
summary_test! { | ||
tokenize_comment_with_bang, | ||
"a:=#foo!", | ||
"N:=#." | ||
} | ||
|
||
summary_test! { | ||
tokenize_order, | ||
r" | ||
b: a | ||
@mv a b | ||
a: | ||
@touch F | ||
@touch a | ||
d: c | ||
@rm c | ||
c: b | ||
@mv b c", | ||
"$N:N$>^_$$<N:$>^_$^_$$<N:N$>^_$$<N:N$>^_<.", | ||
} | ||
|
||
summary_test! { | ||
tokenize_parens, | ||
r"((())) )abc(+", | ||
"((())))N(+.", | ||
} | ||
|
||
summary_test! { | ||
crlf_newline, | ||
"#\r\n#asdf\r\n", | ||
"#$#$.", | ||
} | ||
} |
Oops, something went wrong.