difftreelog
test re-enable structural matching
in: master
4 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -283,12 +283,6 @@
]
[[package]]
-name = "difflib"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
-
-[[package]]
name = "digest"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -807,17 +801,6 @@
dependencies = [
"once_cell",
"wasm-bindgen",
-]
-
-[[package]]
-name = "json-structural-diff"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e878e36a8a44c158505c2c818abdc1350413ad83dcb774a0459f6a7ef2b65cbf"
-dependencies = [
- "difflib",
- "regex",
- "serde_json",
]
[[package]]
@@ -1448,7 +1431,6 @@
"jrsonnet-evaluator",
"jrsonnet-gcmodule",
"jrsonnet-stdlib",
- "json-structural-diff",
"serde",
"serde_json",
]
Cargo.tomldiffbeforeafterboth85regex = "1.12"85regex = "1.12"86lru = "0.16.3"86lru = "0.16.3"878788json-structural-diff = "0.2.0"89syn-dissect-closure = "0.1.0"88syn-dissect-closure = "0.1.0"908991[workspace.lints.rust]90[workspace.lints.rust]tests/Cargo.tomldiffbeforeafterboth--- a/tests/Cargo.toml
+++ b/tests/Cargo.toml
@@ -19,7 +19,6 @@
jrsonnet-gcmodule.workspace = true
jrsonnet-stdlib.workspace = true
serde.workspace = true
-json-structural-diff.workspace = true
serde_json.workspace = true
[dev-dependencies]
tests/tests/cpp_test_suite.rsdiffbeforeafterboth--- a/tests/tests/cpp_test_suite.rs
+++ b/tests/tests/cpp_test_suite.rs
@@ -144,31 +144,6 @@
"pow6.jsonnet",
// golang escapes "e" yaml key, does it think it is float?
"builtin_manifestYamlDoc.jsonnet",
- // Wtf?..
- // Result
- // [
- // {},
- // {},
- // []
- // ]
- // and golden
- // [
- // {},
- // {},
- // []
- // ]
- // did not match structurally:
- // [
- // ...
- // - {
- // - }
- // + {
- // + }
- // [
- // ]
- // ]
- "empty_object_comp.jsonnet",
- "object_hidden.jsonnet",
// multi output is a CLI part, not an interpreter.
"multi.jsonnet",
"multi_no_newline.jsonnet",
@@ -183,9 +158,6 @@
"number_leading_zero.jsonnet",
// Jrsonnet has this overload
"number_times_string.jsonnet",
- // Jrsonnet has stricter implementations, this is a dumb thing that the filter value might not be
- // evaluated anyway...
- "std.filter7.jsonnet",
// Golang fails with max stack frames exceeded error
"std.makeArray_recursive_evalutation_order_matters.jsonnet",
// Jrsonnet has this overload
@@ -196,8 +168,6 @@
#[test]
fn cpp_test_suite() -> io::Result<()> {
- use json_structural_diff::JsonDiff;
-
for root_dir in ["cpp_test_suite", "go_testdata"] {
let root_tests = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let root = root_tests.join(root_dir);
@@ -261,7 +231,7 @@
#[cfg(not(feature = "ir-parser"))]
let update_golden_path = &golden_override;
- match (serde_json::from_str(&result), serde_json::from_str(&golden)) {
+ match (serde_json::from_str::<serde_json::Value>(&result), serde_json::from_str::<serde_json::Value>(&golden)) {
(Err(_), Ok(_)) => panic!(
"unexpected error for golden {}:\n<got>\n{result}\n</got>\n<golden>\n{golden}\n</golden>",
entry.path().display()
@@ -270,17 +240,15 @@
"expected error for golden {}:\n<got>\n{result}\n</got>\n<golden>\n{golden}\n</golden>",
entry.path().display()
),
- (Ok(result_v), Ok(golden)) => {
- // Show diff relative to golden`.
- let diff = JsonDiff::diff_string(&golden, &result_v, false);
- if let Some(diff) = diff {
+ (Ok(result_v), Ok(golden_v)) => {
+ if result_v != golden_v {
if env::var_os("UPDATE_GOLDEN").is_some() {
fs::write(update_golden_path, result)?;
} else {
panic!(
"Result \n{result_v:#}\n\
- and golden \n{golden:#}\n\
- did not match structurally:\n{diff:#}\n\
+ and golden \n{golden_v:#}\n\
+ did not match structurally\n\
for golden {}",
entry.path().display()
);