mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 15:26:17 +02:00
add tests for optionalValueAt
This commit is contained in:
parent
bb939d3772
commit
ff4c286e80
1 changed files with 12 additions and 0 deletions
|
@ -160,4 +160,16 @@ TEST(getBoolean, wrongAssertions) {
|
|||
ASSERT_THROW(getBoolean(valueAt(json, "int")), Error);
|
||||
}
|
||||
|
||||
TEST(optionalValueAt, existing) {
|
||||
auto json = R"({ "string": "ssh-rsa" })"_json;
|
||||
|
||||
ASSERT_EQ(optionalValueAt(json, "string"), std::optional { "ssh-rsa" });
|
||||
}
|
||||
|
||||
TEST(optionalValueAt, empty) {
|
||||
auto json = R"({})"_json;
|
||||
|
||||
ASSERT_EQ(optionalValueAt(json, "string2"), std::nullopt);
|
||||
}
|
||||
|
||||
} /* namespace nix */
|
||||
|
|
Loading…
Reference in a new issue