mirror of
https://github.com/chronotope/chrono.git
synced 2025-09-28 13:31:35 +00:00
Use similar-asserts to show bindgen diff
This commit is contained in:
parent
d0f8b599b7
commit
bf1973ccc7
@ -63,6 +63,7 @@ android-tzdata = { version = "0.1.1", optional = true }
|
||||
[dev-dependencies]
|
||||
serde_json = { version = "1" }
|
||||
serde_derive = { version = "1", default-features = false }
|
||||
similar-asserts = { version = "1.6.1" }
|
||||
bincode = { version = "1.3.0" }
|
||||
|
||||
[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies]
|
||||
|
@ -14,7 +14,14 @@ fn gen_bindings() {
|
||||
// Check the output is the same as before.
|
||||
// Depending on the git configuration the file may have been checked out with `\r\n` newlines or
|
||||
// with `\n`. Compare line-by-line to ignore this difference.
|
||||
let new = fs::read_to_string(output).unwrap();
|
||||
let mut new = fs::read_to_string(output).unwrap();
|
||||
if existing.contains("\r\n") && !new.contains("\r\n") {
|
||||
new = new.replace("\n", "\r\n");
|
||||
} else if !existing.contains("\r\n") && new.contains("\r\n") {
|
||||
new = new.replace("\r\n", "\n");
|
||||
}
|
||||
|
||||
similar_asserts::assert_eq!(existing, new);
|
||||
if !new.lines().eq(existing.lines()) {
|
||||
panic!("generated file `{}` is changed.", output);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user