Merge pull request #8195 from Icinga/feature/terminate-pretty-json-output-w-n-8194

JsonEncode(): suffix pretty JSON w/ \n
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-11-13 17:08:46 +01:00 committed by GitHub
commit 5f3b5934fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -193,7 +193,7 @@ String icinga::JsonEncode(const Value& value, bool pretty_print)
Encode(stateMachine, value);
return stateMachine.GetResult();
return stateMachine.GetResult() + "\n";
} else {
JsonEncoder<false> stateMachine;

View File

@ -36,7 +36,8 @@ BOOST_AUTO_TEST_CASE(encode)
"string": "LF\nTAB\tAUml\u00e4Ill\ufffd",
"true": true,
"uint": 23.0
})EOF");
}
)EOF");
BOOST_CHECK(JsonEncode(input, true) == output);
@ -59,7 +60,8 @@ BOOST_AUTO_TEST_CASE(decode)
"string": "LF\nTAB\tAUmlIll",
"true": true,
"uint": 23.0
})EOF");
}
)EOF");
boost::algorithm::replace_all(input, "AUml", "AUml\xC3\xA4");
boost::algorithm::replace_all(input, "Ill", "Ill\xC3");