mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-16 23:27:17 +02:00
add unit tests for getNullable
This commit is contained in:
parent
4ff7f5aa9c
commit
c73172e986
1 changed files with 13 additions and 1 deletions
|
@ -169,7 +169,19 @@ TEST(optionalValueAt, existing) {
|
||||||
TEST(optionalValueAt, empty) {
|
TEST(optionalValueAt, empty) {
|
||||||
auto json = R"({})"_json;
|
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 */
|
} /* namespace nix */
|
||||||
|
|
Loading…
Add table
Reference in a new issue