Repository navigation
test(libfetchers): cover throwing comparisons in a set - #16786
Merged
Merged
Conversation
xokdvium
approved these changes
Nov 8, 2026
Comment on lines
+10
to
+21
| /* The left operand's operator does the comparison, so check both orders. */ | ||
| #define EXPECT_EQ_SYMMETRICALLY(a, b) \ | ||
| do { \ | ||
| EXPECT_EQ(a, b); \ | ||
| EXPECT_EQ(b, a); \ | ||
| } while (0) | ||
|
|
||
| #define EXPECT_NE_SYMMETRICALLY(a, b) \ | ||
| do { \ | ||
| EXPECT_NE(a, b); \ | ||
| EXPECT_NE(b, a); \ | ||
| } while (0) |
Contributor
There was a problem hiding this comment.
Maybe worth moving to libutil-test-support header?
Comparing lazy attributes forces them, so a comparison can throw. As Sergei points out, it is not obvious that std::set behaves under a comparator that throws (NixOS#16430 (comment)). The input cache, a std::map keyed by Input, looks up and inserts with such comparisons. Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo> Assisted-by: Claude Code (Claude Opus 5.5)
roberth
force-pushed
the
attr-comparison-tests
branch
from
November 9, 2026 09:15
23d7bcb to
8b3e3aa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extending #16731 tests, not exactly as requested - thank you @xokdvium for handling the PR.
Here's some small additions to consider.
Motivation
The input cache, a std::map keyed by Input, looks up and inserts with
such comparisons.
Implementation
×
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.