diff --git a/Cargo.lock b/Cargo.lock index 9dd57ef..c0f00d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -412,6 +412,12 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + [[package]] name = "digest" version = "0.10.7" @@ -887,6 +893,16 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "pretty_assertions" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" +dependencies = [ + "diff", + "yansi", +] + [[package]] name = "proc-macro-crate" version = "3.2.0" @@ -1179,6 +1195,7 @@ dependencies = [ "async-graphql-value", "indexmap", "nom", + "pretty_assertions", "serde_json", "serde_json_borrow", ] @@ -1447,3 +1464,9 @@ checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] + +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" diff --git a/tailcall-jq/Cargo.toml b/tailcall-jq/Cargo.toml index 698f0f2..9c238aa 100644 --- a/tailcall-jq/Cargo.toml +++ b/tailcall-jq/Cargo.toml @@ -11,3 +11,6 @@ indexmap = { workspace = true } serde_json_borrow = { workspace = true } nom = { workspace = true } anyhow = { workspace = true } + +[dev-dependencies] +pretty_assertions = "1.4.1" diff --git a/tailcall-jq/src/jsonlike/json_like.rs b/tailcall-jq/src/jsonlike/json_like.rs index b5d48e4..ebccd30 100644 --- a/tailcall-jq/src/jsonlike/json_like.rs +++ b/tailcall-jq/src/jsonlike/json_like.rs @@ -44,6 +44,7 @@ pub trait JsonObjectLike<'obj>: Sized { #[cfg(test)] mod tests { use crate::jsonlike::group_by_key; + use pretty_assertions::assert_eq; use serde_json::json; use super::super::gather_path_matches; diff --git a/tailcall-jq/src/mustache/parse.rs b/tailcall-jq/src/mustache/parse.rs index b699809..9031572 100644 --- a/tailcall-jq/src/mustache/parse.rs +++ b/tailcall-jq/src/mustache/parse.rs @@ -85,6 +85,8 @@ fn parse_mustache(input: &str) -> IResult<&str, Mustache> { #[cfg(test)] mod tests { + use pretty_assertions::assert_eq; + use crate::mustache::mustache::{Mustache, Segment}; #[test]