| 23 | using namespace std; |
| 24 | |
| 25 | TEST(str_map, json) { |
| 26 | map<string,string> str_map; |
| 27 | stringstream ss; |
| 28 | // well formatted |
| 29 | ASSERT_EQ(0, get_json_str_map("{\"key\": \"value\"}", ss, &str_map)); |
| 30 | ASSERT_EQ("value", str_map["key"]); |
| 31 | // well formatted but not a JSON object |
| 32 | ASSERT_EQ(-EINVAL, get_json_str_map("\"key\"", ss, &str_map)); |
| 33 | ASSERT_NE(string::npos, ss.str().find("must be a JSON object")); |
| 34 | } |
| 35 | |
| 36 | TEST(str_map, plaintext) { |
| 37 | { |
nothing calls this directly
no test coverage detected