--- 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", ] --- a/Cargo.toml +++ b/Cargo.toml @@ -85,7 +85,6 @@ regex = "1.12" lru = "0.16.3" -json-structural-diff = "0.2.0" syn-dissect-closure = "0.1.0" [workspace.lints.rust] --- 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] --- 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::(&result), serde_json::from_str::(&golden)) { (Err(_), Ok(_)) => panic!( "unexpected error for golden {}:\n\n{result}\n\n\n{golden}\n", entry.path().display() @@ -270,17 +240,15 @@ "expected error for golden {}:\n\n{result}\n\n\n{golden}\n", 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() );