mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-12-24 12:58:37 +00:00
switch assert_log
to a better debug library
This commit is contained in:
parent
1ab8d1a64e
commit
ce24850c3d
2 changed files with 6 additions and 10 deletions
|
@ -18,5 +18,5 @@ log = "0.4.5"
|
|||
smallvec = "0.6.5"
|
||||
|
||||
[dev-dependencies]
|
||||
difference = "2.0"
|
||||
diff = "0.1.0"
|
||||
env_logger = "0.5.13"
|
|
@ -19,8 +19,6 @@ pub(crate) struct TestContextImpl {
|
|||
|
||||
impl TestContextImpl {
|
||||
pub(crate) fn assert_log(&self, expected_log: &[&str]) {
|
||||
use difference::{Changeset, Difference};
|
||||
|
||||
let expected_text = &format!("{:#?}", expected_log);
|
||||
let actual_text = &format!("{:#?}", self.log().take());
|
||||
|
||||
|
@ -28,13 +26,11 @@ impl TestContextImpl {
|
|||
return;
|
||||
}
|
||||
|
||||
let Changeset { diffs, .. } = Changeset::new(expected_text, actual_text, "\n");
|
||||
|
||||
for i in 0..diffs.len() {
|
||||
match &diffs[i] {
|
||||
Difference::Same(x) => println!(" {}", x),
|
||||
Difference::Add(x) => println!("+{}", x),
|
||||
Difference::Rem(x) => println!("-{}", x),
|
||||
for diff in diff::lines(expected_text, actual_text) {
|
||||
match diff {
|
||||
diff::Result::Left(l) => println!("-{}", l),
|
||||
diff::Result::Both(l, _) => println!(" {}", l),
|
||||
diff::Result::Right(r) => println!("+{}", r),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue