mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-12 04:11:06 -05:00
Move JSON helpers to lib
This commit is contained in:
@@ -51,3 +51,18 @@ TEST_CASE("MatchJson", "[json-helpers]")
|
||||
result = advss::MatchJson("{\n \"test\": true\n}\n", "(", regex);
|
||||
REQUIRE(result == false);
|
||||
}
|
||||
|
||||
TEST_CASE("GetJsonField", "[utility]")
|
||||
{
|
||||
auto result = advss::GetJsonField("{}", "");
|
||||
REQUIRE_FALSE(result);
|
||||
|
||||
result = advss::GetJsonField("{}", "not there");
|
||||
REQUIRE_FALSE(result);
|
||||
|
||||
result = advss::GetJsonField("invalid json", "not there");
|
||||
REQUIRE_FALSE(result);
|
||||
|
||||
result = advss::GetJsonField("{ \"test\": 1 }", "test");
|
||||
REQUIRE(*result == "1");
|
||||
}
|
||||
Reference in New Issue
Block a user