Make x test src/tools/rustfmt --bless
format rustfmt with the freshly built in-tree version
This commit is contained in:
parent
2b444672e1
commit
841f8dc19f
@ -430,6 +430,10 @@ fn run(self, builder: &Builder<'_>) {
|
||||
&[],
|
||||
);
|
||||
|
||||
if builder.config.cmd.bless() {
|
||||
cargo.env("BLESS", "1");
|
||||
}
|
||||
|
||||
let dir = testdir(builder, compiler.host);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
cargo.env("RUSTFMT_TEST_DIR", dir);
|
||||
|
@ -152,15 +152,13 @@ fn default_handler(
|
||||
TerminalUrl::No,
|
||||
))
|
||||
};
|
||||
Handler::with_emitter(
|
||||
Box::new(SilentOnIgnoredFilesEmitter {
|
||||
Handler::with_emitter(Box::new(SilentOnIgnoredFilesEmitter {
|
||||
has_non_ignorable_parser_errors: false,
|
||||
source_map,
|
||||
emitter,
|
||||
ignore_path_set,
|
||||
can_reset,
|
||||
}),
|
||||
)
|
||||
}))
|
||||
}
|
||||
|
||||
impl ParseSess {
|
||||
|
@ -838,6 +838,12 @@ fn handle_result(
|
||||
|
||||
// Ignore LF and CRLF difference for Windows.
|
||||
if !string_eq_ignore_newline_repr(&fmt_text, &text) {
|
||||
if let Some(bless) = std::env::var_os("BLESS") {
|
||||
if bless != "0" {
|
||||
std::fs::write(file_name, fmt_text).unwrap();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE);
|
||||
assert!(
|
||||
!diff.is_empty(),
|
||||
|
Loading…
Reference in New Issue
Block a user