Tests: add user-defined literal ""_s for std::string

This commit is contained in:
Benoit Blanchon
2024-06-07 09:35:45 +02:00
parent 5b88b2c1f6
commit 45611924f3
55 changed files with 316 additions and 229 deletions

View File

@ -6,6 +6,8 @@
#include <stdio.h>
#include <catch.hpp>
#include "Literals.hpp"
static void check(const JsonObject object, const char* expected_data,
size_t expected_len) {
std::string expected(expected_data, expected_data + expected_len);
@ -77,7 +79,7 @@ TEST_CASE("serialize MsgPack object") {
}
SECTION("serialized(std::string)") {
object["hello"] = serialized(std::string("\xDB\x00\x01\x00\x00", 5));
object["hello"] = serialized("\xDB\x00\x01\x00\x00"_s);
check(object, "\x81\xA5hello\xDB\x00\x01\x00\x00");
}
}