@@ -79,6 +79,8 @@ Y_UNIT_TEST_SUITE(TJsonFilterTests) {
79
79
Filter->Push ({6 }, {{" 101" }, {" hello2" }});
80
80
UNIT_ASSERT_VALUES_EQUAL (1 , result.size ());
81
81
UNIT_ASSERT_VALUES_EQUAL (R"( {"a1":"hello2","a2":101})" , result[6 ]);
82
+ UNIT_ASSERT_EXCEPTION_CONTAINS (Filter->Push ({7 }, {{" 102" }, {std::string_view ()}}), yexception, " Failed to unwrap empty optional" );
83
+ UNIT_ASSERT_EXCEPTION_CONTAINS (Filter->Push ({8 }, {{" str" }, {" hello3" }}), yexception, " Failed to unwrap empty optional" );
82
84
}
83
85
84
86
Y_UNIT_TEST_F (ManyValues, TFixture) {
@@ -98,18 +100,19 @@ Y_UNIT_TEST_SUITE(TJsonFilterTests) {
98
100
Y_UNIT_TEST_F (NullValues, TFixture) {
99
101
TMap<ui64, TString> result;
100
102
MakeFilter (
101
- {" a1" },
102
- {" Optional<String> " },
103
+ {" a1" , " a2 " },
104
+ {" Optional<UInt64> " , " String " },
103
105
" where a1 is null" ,
104
106
[&](ui64 offset, const TString& json) {
105
107
result[offset] = json;
106
108
});
107
- Filter->Push ({5 }, {{std::string_view ()}});
109
+ Filter->Push ({5 }, {{std::string_view ()}, { " str " } });
108
110
UNIT_ASSERT_VALUES_EQUAL (1 , result.size ());
109
- UNIT_ASSERT_VALUES_EQUAL (R"( {"a1":null})" , result[5 ]);
111
+ UNIT_ASSERT_VALUES_EQUAL (R"( {"a1":null,"a2":"str"})" , result[5 ]);
112
+ UNIT_ASSERT_EXCEPTION_CONTAINS (Filter->Push ({5 }, {{" hello1" }, {" str" }}), yexception, " Failed to unwrap empty optional" );
110
113
}
111
114
112
- Y_UNIT_TEST_F (ThrowExceptionByError, TFixture) {
115
+ Y_UNIT_TEST_F (ThrowExceptionByError, TFixture) {
113
116
MakeFilter (
114
117
{" a1" , " a2" },
115
118
{" String" , " UInt64" },
@@ -120,4 +123,3 @@ Y_UNIT_TEST_SUITE(TJsonFilterTests) {
120
123
}
121
124
122
125
}
123
-
0 commit comments