Skip to content

Commit

Permalink
Switch from text-diff to similar for content diffing.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnunley committed Dec 22, 2024
1 parent 73ca20d commit 12112fa
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 60 deletions.
115 changes: 60 additions & 55 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ num-traits = "0.2"
oneshot = { version = "0.1", default-features = false, features = ["std"] }
semver = "1.0.24"
strum = { version = "0.26", features = ["derive"] }
text-diff = "0.4"
similar = "*"
similar-asserts = "*"
ustr = "1.0"
uuid = { version = "1.11", features = ["v4"] }
xml-rs = "0.8.24"
Expand Down
3 changes: 2 additions & 1 deletion crates/kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ eyre.workspace = true
pretty_assertions.workspace = true
test-case.workspace = true
test_each_file.workspace = true
text-diff.workspace = true
similar.workspace = true
similar-asserts.workspace = true
tracing.workspace = true

[[test]]
Expand Down
6 changes: 3 additions & 3 deletions crates/kernel/tests/textdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mod test {
use std::io::{BufReader, Read};
use std::path::PathBuf;
use std::sync::Arc;
use text_diff::assert_diff;
use similar_asserts;

use moor_compiler::Program;
use moor_db::loader::LoaderInterface;
Expand Down Expand Up @@ -183,7 +183,7 @@ mod test {
let input = String::from_utf8(br.bytes().map(|b| b.unwrap()).collect())
.expect("Failed to convert input to string");

assert_diff(&input, &output, "", 0);
similar_asserts::assert_eq!(&input, &output, "");
}

/// Actually load a textdump into an actual *database* and confirm that it has the expected contents.
Expand Down Expand Up @@ -256,7 +256,7 @@ mod test {

let output = write_textdump(db, "** LambdaMOO Database, Format Version 1 **");

assert_diff(&input, &output, "", 0);
similar_asserts::assert_eq!(&input, &output,"");
}

#[test]
Expand Down

0 comments on commit 12112fa

Please sign in to comment.