File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,21 @@ void test_vector_from_string() {
149149 assert (std::string_view (e.what ()) == " Malformed vector literal" );
150150 }
151151
152+ try {
153+ auto unused = pqxx::from_string<pgvector::Vector>(" [" );
154+ assert (false );
155+ } catch (const pqxx::conversion_error& e) {
156+ assert (std::string_view (e.what ()) == " Malformed vector literal" );
157+ }
158+
159+ // TODO change to no error?
160+ try {
161+ auto unused = pqxx::from_string<pgvector::Vector>(" []" );
162+ assert (false );
163+ } catch (const std::invalid_argument& e) {
164+ assert (true );
165+ }
166+
152167 // TODO change to pqxx::conversion_error
153168 try {
154169 auto unused = pqxx::from_string<pgvector::Vector>(" [hello]" );
@@ -180,6 +195,21 @@ void test_halfvec_from_string() {
180195 assert (std::string_view (e.what ()) == " Malformed halfvec literal" );
181196 }
182197
198+ try {
199+ auto unused = pqxx::from_string<pgvector::HalfVector>(" [" );
200+ assert (false );
201+ } catch (const pqxx::conversion_error& e) {
202+ assert (std::string_view (e.what ()) == " Malformed halfvec literal" );
203+ }
204+
205+ // TODO change to no error?
206+ try {
207+ auto unused = pqxx::from_string<pgvector::HalfVector>(" []" );
208+ assert (false );
209+ } catch (const std::invalid_argument& e) {
210+ assert (true );
211+ }
212+
183213 // TODO change to pqxx::conversion_error
184214 try {
185215 auto unused = pqxx::from_string<pgvector::HalfVector>(" [hello]" );
You can’t perform that action at this time.
0 commit comments