Skip to content

Commit

Permalink
Fix cases where we call Object::create with illegal property names
Browse files Browse the repository at this point in the history
  • Loading branch information
jedelbo committed Aug 19, 2024
1 parent 6846ffe commit 135214a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions test/object-store/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ TEST_CASE("object") {
{"person",
{
{"_id", PropertyType::String, Property::IsPrimary{true}},
{"name", PropertyType::String},
{"age", PropertyType::Int},
{"scores", PropertyType::Array | PropertyType::Int},
{"assistant", PropertyType::Object | PropertyType::Nullable, "person"},
Expand Down Expand Up @@ -1180,7 +1181,6 @@ TEST_CASE("object") {
{"data", "olleh"s},
{"date", Timestamp(10, 20)},
{"object", AnyDict{{"_id", INT64_C(10)}, {"value", INT64_C(10)}}},
{"array", AnyVector{AnyDict{{"value", INT64_C(20)}}}},
{"object id", ObjectId("000000000000000000000001")},
{"decimal", Decimal128("1.23e45")},
{"uuid", UUID("3b241101-0000-0000-0000-4136c566a962")},
Expand Down Expand Up @@ -1532,7 +1532,6 @@ TEST_CASE("object") {
{"string array", AnyVec{"a"s, "b"s, "c"s}},
{"data array", AnyVec{"d"s, "e"s, "f"s}},
{"date array", AnyVec{}},
{"object array", AnyVec{AnyDict{{"_id", INT64_C(20)}, {"value", INT64_C(20)}}}},
{"object id array", AnyVec{ObjectId("000000000000000000000001")}},
{"decimal array", AnyVec{Decimal128("1.23e45")}},
{"uuid array", AnyVec{UUID("3b241101-1111-bbbb-cccc-4136c566a962")}},
Expand Down Expand Up @@ -1672,7 +1671,6 @@ TEST_CASE("object") {
{"data", "olleh"s},
{"date", Timestamp(10, 20)},
{"object", AnyDict{{"_id", INT64_C(10)}, {"value", INT64_C(10)}}},
{"array", AnyVector{AnyDict{{"value", INT64_C(20)}}}},
{"object id", ObjectId("000000000000000000000001")},
{"decimal", Decimal128("1.23e45")},
{"uuid", UUID("3b241101-aaaa-bbbb-cccc-4136c566a962")},
Expand All @@ -1688,7 +1686,6 @@ TEST_CASE("object") {
{"data", "olleh"s},
{"date", Timestamp(10, 20)},
{"object", AnyDict{{"_id", INT64_C(10)}, {"value", INT64_C(10)}}},
{"array", AnyVector{AnyDict{{"value", INT64_C(20)}}}},
{"object id", ObjectId("000000000000000000000001")},
{"decimal", Decimal128("1.23e45")},
{"uuid", UUID("3b241101-aaaa-bbbb-cccc-4136c566a962")},
Expand Down Expand Up @@ -1720,9 +1717,9 @@ TEST_CASE("object") {
obj = create(AnyDict{{"_id", d.null_value()}}, "nullable string pk");
REQUIRE(obj.get_obj().is_null(col_pk_str));

obj = create(AnyDict{{}}, "nullable int pk");
obj = create(AnyDict{}, "nullable int pk");
REQUIRE(obj.get_obj().get<util::Optional<Int>>(col_pk_int) == 10);
obj = create(AnyDict{{}}, "nullable string pk");
obj = create(AnyDict{}, "nullable string pk");
REQUIRE(obj.get_obj().get<String>(col_pk_str) == "value");
}

Expand Down

0 comments on commit 135214a

Please sign in to comment.