Skip to content

Commit 264c7e3

Browse files
committed
Change up comparison test used for leak detection
Update writer test for compat w/ all versions of clang
1 parent 4b8d7d3 commit 264c7e3

File tree

2 files changed

+77
-69
lines changed

2 files changed

+77
-69
lines changed

test/unittest/schematest.cpp

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5664,82 +5664,82 @@ TEST(SchemaCompare, AllOf) {
56645664
"}");
56655665
}
56665666
TEST(SchemaCompare, AnyOf) {
5667-
COMPARE("{"
5668-
" \"type\": \"string\""
5669-
"}",
5670-
"{"
5671-
" \"anyOf\": ["
5672-
" { \"type\": \"string\" },"
5673-
" { \"maxLength\": 5 }"
5674-
" ]"
5675-
"}");
56765667
// TODO: Re-enable these once leak is fixed
56775668
// COMPARE("{"
5678-
// " \"anyOf\": ["
5679-
// " { \"type\": \"string\" },"
5680-
// " { \"maxLength\": 5 }"
5681-
// " ]"
5669+
// " \"type\": \"string\""
56825670
// "}",
56835671
// "{"
56845672
// " \"anyOf\": ["
56855673
// " { \"type\": \"string\" },"
56865674
// " { \"maxLength\": 5 }"
56875675
// " ]"
56885676
// "}");
5689-
// INVALID_COMPARE("{"
5690-
// " \"anyOf\": ["
5691-
// " { \"type\": \"boolean\" },"
5692-
// " { \"type\": \"string\","
5693-
// " \"maxLength\": 5 }"
5694-
// " ]"
5695-
// "}",
5696-
// "{"
5697-
// " \"anyOf\": ["
5698-
// " { \"type\": \"string\","
5699-
// " \"maxLength\": 3 }"
5700-
// " ]"
5701-
// "}",
5702-
// "{"
5703-
// " \"anyOf\": {"
5704-
// " \"errors\": ["
5705-
// " {"
5706-
// " \"anyOf\": {"
5707-
// " \"errors\": [{"
5708-
// " \"compare\": {"
5709-
// " \"property\": \"type\","
5710-
// " \"expected\": [\"boolean\"],"
5711-
// " \"actual\": [\"string\"],"
5712-
// " \"errorCode\": 45,"
5713-
// " \"schemaIteratorRef\": \"#/anyOf/0\","
5714-
// " \"schemaHandlerRef\": \"#/anyOf/0\""
5715-
// " }"
5716-
// " }],"
5717-
// " \"errorCode\": 24,"
5718-
// " \"schemaIteratorRef\": \"#/anyOf/0\","
5719-
// " \"schemaHandlerRef\": \"#\""
5720-
// " }"
5721-
// " },"
5722-
// " {"
5723-
// " \"anyOf\": {"
5724-
// " \"errors\": [{"
5725-
// " \"compare\": {"
5726-
// " \"property\": \"maxLength\","
5727-
// " \"expected\": 5, \"actual\": 3,"
5728-
// " \"errorCode\": 45,"
5729-
// " \"schemaIteratorRef\": \"#/anyOf/1\","
5730-
// " \"schemaHandlerRef\": \"#/anyOf/0\""
5731-
// " }"
5732-
// " }],"
5733-
// " \"errorCode\": 24,"
5734-
// " \"schemaIteratorRef\": \"#/anyOf/1\","
5735-
// " \"schemaHandlerRef\": \"#\""
5736-
// " }"
5737-
// " }"
5738-
// " ],"
5739-
// " \"errorCode\": 24,"
5740-
// " \"schemaIteratorRef\": \"#\""
5741-
// " }"
5742-
// "}");
5677+
COMPARE("{"
5678+
" \"anyOf\": ["
5679+
" { \"type\": \"string\" },"
5680+
" { \"maxLength\": 5 }"
5681+
" ]"
5682+
"}",
5683+
"{"
5684+
" \"anyOf\": ["
5685+
" { \"type\": \"string\" },"
5686+
" { \"maxLength\": 5 }"
5687+
" ]"
5688+
"}");
5689+
INVALID_COMPARE("{"
5690+
" \"anyOf\": ["
5691+
" { \"type\": \"boolean\" },"
5692+
" { \"type\": \"string\","
5693+
" \"maxLength\": 5 }"
5694+
" ]"
5695+
"}",
5696+
"{"
5697+
" \"anyOf\": ["
5698+
" { \"type\": \"string\","
5699+
" \"maxLength\": 3 }"
5700+
" ]"
5701+
"}",
5702+
"{"
5703+
" \"anyOf\": {"
5704+
" \"errors\": ["
5705+
" {"
5706+
" \"anyOf\": {"
5707+
" \"errors\": [{"
5708+
" \"compare\": {"
5709+
" \"property\": \"type\","
5710+
" \"expected\": [\"boolean\"],"
5711+
" \"actual\": [\"string\"],"
5712+
" \"errorCode\": 45,"
5713+
" \"schemaIteratorRef\": \"#/anyOf/0\","
5714+
" \"schemaHandlerRef\": \"#/anyOf/0\""
5715+
" }"
5716+
" }],"
5717+
" \"errorCode\": 24,"
5718+
" \"schemaIteratorRef\": \"#/anyOf/0\","
5719+
" \"schemaHandlerRef\": \"#\""
5720+
" }"
5721+
" },"
5722+
" {"
5723+
" \"anyOf\": {"
5724+
" \"errors\": [{"
5725+
" \"compare\": {"
5726+
" \"property\": \"maxLength\","
5727+
" \"expected\": 5, \"actual\": 3,"
5728+
" \"errorCode\": 45,"
5729+
" \"schemaIteratorRef\": \"#/anyOf/1\","
5730+
" \"schemaHandlerRef\": \"#/anyOf/0\""
5731+
" }"
5732+
" }],"
5733+
" \"errorCode\": 24,"
5734+
" \"schemaIteratorRef\": \"#/anyOf/1\","
5735+
" \"schemaHandlerRef\": \"#\""
5736+
" }"
5737+
" }"
5738+
" ],"
5739+
" \"errorCode\": 24,"
5740+
" \"schemaIteratorRef\": \"#\""
5741+
" }"
5742+
"}");
57435743
}
57445744
TEST(SchemaCompare, OneOf) {
57455745
COMPARE("{"

test/unittest/writertest.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,15 +494,23 @@ TEST(Writer, InvalidEncoding) {
494494
StringBuffer buffer;
495495
Writer<StringBuffer, UTF32<> > writer(buffer);
496496
static const UTF32<>::Ch s[] = { 0x110000, 0 }; // Out of U+0000 to U+10FFFF
497-
EXPECT_FALSE(writer.String(s));
497+
// langmm: To allow compat w/ FreeBSD libc++ which dropped
498+
// std::char_traits<> for types other than
499+
// char, wchar_t, char8_t, char16_t, char32_t
500+
EXPECT_FALSE(writer.String(s, 2));
501+
// EXPECT_FALSE(writer.String(s));
498502
}
499503

500504
// Fail in unicode escaping in ASCII output
501505
{
502506
StringBuffer buffer;
503507
Writer<StringBuffer, UTF32<>, ASCII<> > writer(buffer);
504508
static const UTF32<>::Ch s[] = { 0x110000, 0 }; // Out of U+0000 to U+10FFFF
505-
EXPECT_FALSE(writer.String(s));
509+
// langmm: To allow compat w/ FreeBSD libc++ which dropped
510+
// std::char_traits<> for types other than
511+
// char, wchar_t, char8_t, char16_t, char32_t
512+
EXPECT_FALSE(writer.String(s, 2));
513+
// EXPECT_FALSE(writer.String(s));
506514
}
507515
}
508516

0 commit comments

Comments
 (0)