1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-10 04:43:53 +02:00

Merge pull request #10602 from haenoe/json-infra-tests-misc

Json infra tests misc
This commit is contained in:
John Ericson 2024-04-25 16:53:51 -04:00 committed by GitHub
commit 4722b0c9e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 64 additions and 13 deletions

View file

@ -169,7 +169,19 @@ TEST(optionalValueAt, existing) {
TEST(optionalValueAt, empty) {
auto json = R"({})"_json;
ASSERT_EQ(optionalValueAt(json, "string2"), std::nullopt);
ASSERT_EQ(optionalValueAt(json, "string"), std::nullopt);
}
TEST(getNullable, null) {
auto json = R"(null)"_json;
ASSERT_EQ(getNullable(json), std::nullopt);
}
TEST(getNullable, empty) {
auto json = R"({})"_json;
ASSERT_EQ(getNullable(json), std::optional { R"({})"_json });
}
} /* namespace nix */