Skip to content

use diff crate for compile-fail test diagnostics #41474 #41588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/tools/compiletest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ log = "0.3"
env_logger = { version = "0.4", default-features = false }
rustc-serialize = "0.3"
filetime = "0.1"
diff = "0.1.10"
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extern crate rustc_serialize;
extern crate log;
extern crate env_logger;
extern crate filetime;
extern crate diff;

use std::env;
use std::ffi::OsString;
Expand All @@ -49,7 +50,6 @@ pub mod runtest;
pub mod common;
pub mod errors;
mod raise_fd_limit;
mod uidiff;

fn main() {
env_logger::init().unwrap();
Expand Down
11 changes: 8 additions & 3 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use common::Config;
use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind};
use common::{Codegen, DebugInfoLldb, DebugInfoGdb, Rustdoc, CodegenUnits};
use common::{Incremental, RunMake, Ui, MirOpt};
use diff;
use errors::{self, ErrorKind, Error};
use filetime::FileTime;
use json;
use header::TestProps;
use header;
use procsrv;
use test::TestPaths;
use uidiff;
use util::logv;

use std::collections::HashSet;
Expand Down Expand Up @@ -2569,8 +2569,13 @@ actual:\n\
println!("normalized {}:\n{}\n", kind, actual);
println!("expected {}:\n{}\n", kind, expected);
println!("diff of {}:\n", kind);
for line in uidiff::diff_lines(actual, expected) {
println!("{}", line);

for diff in diff::lines(actual, expected) {
match diff {
diff::Result::Left(l) => println!("+{}", l),
diff::Result::Both(l, _) => println!(" {}", l),
diff::Result::Right(r) => println!("-{}", r),
}
}

let output_file = self.output_base_name().with_extension(kind);
Expand Down
73 changes: 0 additions & 73 deletions src/tools/compiletest/src/uidiff.rs

This file was deleted.