Make Unit Tests That Could Never Fail Check Real Behavior

Rework tests whose assertions held whatever the production code did: inverted or self-referential checks, checks on values the test had just set, branches that never ran, symmetric fixtures that hid the behavior under test, font paths that skipped silently, and Voronoi reproducers that only exercised boost. Each now asserts the behavior its name describes.
This commit is contained in:
Hanif Koh committed 2026-10-19 17:02:49 +08:00
1 parent d3699dd9f6
commit 32d92a55d3
18 files changed
+486 -285

No files matched your search

@@ -76,12 +76,12 @@ TEST_CASE("plugin latest version uses the authoritative catalog field", "[Plugin
{
PluginDescriptor descriptor;
descriptor.version = "1.3.0";
descriptor.latest_version = "1.3.0";
descriptor.latest_version = "1.4.0";
PluginChangelog changelog;
changelog.version = "1.2.0";
descriptor.changelog.push_back(changelog);
CHECK(descriptor.latest_available_version() == "1.3.0");
CHECK(descriptor.latest_available_version() == "1.4.0");
}
TEST_CASE("plugin latest version falls back to the descriptor version", "[PluginDescriptor]")