@@ -251,19 +251,22 @@ TEST_F(ApiTest, PrepareWithSkipLimitError) {
251
251
auto prepared = conn->prepare (" MATCH (p:person) RETURN p.ID skip $sp" );
252
252
auto result = conn->execute (prepared.get ());
253
253
ASSERT_FALSE (result->isSuccess ());
254
- ASSERT_EQ (result->toString (), " Runtime exception: Cannot evaluate $sp as a valid skip number." );
254
+ ASSERT_EQ (result->toString (), " Parameter sp not found." );
255
+
256
+ result = conn->execute (prepared.get (), std::make_pair (std::string (" sp" ), " abc" ));
257
+ ASSERT_FALSE (result->isSuccess ());
258
+ ASSERT_EQ (result->toString (),
259
+ " Runtime exception: The number of rows to skip/limit must be a non-negative integer." );
255
260
256
261
prepared = conn->prepare (" MATCH (p:person) RETURN p.ID limit $sp" );
257
262
result = conn->execute (prepared.get ());
258
263
ASSERT_FALSE (result->isSuccess ());
259
- ASSERT_EQ (result->toString (),
260
- " Runtime exception: Cannot evaluate $sp as a valid limit number." );
264
+ ASSERT_EQ (result->toString (), " Parameter sp not found." );
261
265
262
266
prepared = conn->prepare (" MATCH (p:person) RETURN p.ID skip $s limit $sp" );
263
267
result = conn->execute (prepared.get (), std::make_pair (std::string (" s" ), 3 ));
264
268
ASSERT_FALSE (result->isSuccess ());
265
- ASSERT_EQ (result->toString (),
266
- " Runtime exception: Cannot evaluate $sp as a valid limit number." );
269
+ ASSERT_EQ (result->toString (), " Parameter sp not found." );
267
270
268
271
prepared = conn->prepare (" MATCH (p:person) RETURN p.ID skip $s" );
269
272
result = conn->execute (prepared.get (), std::make_pair (std::string (" s" ), 3.4 ));
@@ -316,8 +319,16 @@ TEST_F(ApiTest, MissingParam) {
316
319
std::unordered_map<std::string, std::unique_ptr<Value>> params;
317
320
params[" val1" ] = std::make_unique<Value>(Value::createValue (3 ));
318
321
auto prep = conn->prepareWithParams (" RETURN $val1 + $val2" , std::move (params));
319
- ASSERT_FALSE (prep->isSuccess ());
320
- ASSERT_STREQ (" Parameter val1 not found." , prep->getErrorMessage ().c_str ());
322
+ ASSERT_TRUE (prep->isSuccess ());
323
+ auto result = conn->execute (prep.get (), std::make_pair (std::string (" s" ), 3 ));
324
+ ASSERT_FALSE (result->isSuccess ());
325
+ ASSERT_STREQ (" Parameter val2 not found." , result->getErrorMessage ().c_str ());
326
+ result = conn->execute (prep.get (), std::make_pair (std::string (" val2" ), 1.1 ));
327
+ ASSERT_TRUE (result->isSuccess ());
328
+ ASSERT_STREQ (" 4.100000\n " , result->getNext ()->toString ().c_str ());
329
+ result = conn->execute (prep.get (), std::make_pair (std::string (" val2" ), 1.1 ), std::make_pair (std::string (" val1" ), 1.1 ));
330
+ ASSERT_TRUE (result->isSuccess ());
331
+ ASSERT_STREQ (" 2.200000\n " , result->getNext ()->toString ().c_str ());
321
332
}
322
333
323
334
TEST_F (ApiTest, CloseDatabaseBeforeQueryResultAndConnection) {
0 commit comments