Fixed invalid conversion in operator|(Variant, char*) (fixes #1432)

This commit is contained in:
Benoit Blanchon committed 2020-11-09 09:21:19 +01:00
1 parent bcdf5b7e52
commit 30da920135
3 files changed
+30 -3

No files matched your search

+14
View File
@@ -137,6 +137,20 @@ TEST_CASE("JsonVariant::operator|()") {
REQUIRE(result == "not default");
}
SECTION("const char* | char*") {
char dflt[] = "default";
variant.set("not default");
std::string result = variant | dflt;
REQUIRE(result == "not default");
}
SECTION("int | char*") {
char dflt[] = "default";
variant.set(42);
std::string result = variant | dflt;
REQUIRE(result == "default");
}
SECTION("const char* | int") {
variant.set("not default");
int result = variant | 42;