Announcing googletest-json-serde: expressive JSON matchers for Rust tests

⚓ Rust    📅 2025-11-11    👤 surdeus    👁️ 7      

surdeus

I’ve released googletest-json-serde, a crate extending googletest-rust with matchers for serde_json::Value.

It follows the same ergonomics and naming style as googletest-rust, so existing users can use it immediately without learning new syntax.

It lets you write readable, expressive JSON assertions , mixing direct values and native googletest matchers :

use googletest::prelude::*;
use googletest_json_serde::json;
use serde_json::json as j;

verify_that!(
    j!({"name": "Alice", "age": 30, "verified": true, "ignored":"buh"}),
    json::pat!({
        "name": starts_with("Ali"),  // native googletest matcher
        "age": 18,                   // direct literal value
        "verified": json::is_true(), // built-in JSON type matcher
        .. // ignores remaining fields
    })
);

Crate: crates.io/googletest-json-serde
Docs: docs.rs/googletest-json-serde
Repo: github.com/chege/googletest-json-serde

Feedback, suggestions, and contributions are welcome — and more matchers are on the way.

1 post - 1 participant

Read full topic

🏷️ Rust_feed