From: Aki Tuomi Date: Mon, 29 Oct 2018 08:42:36 +0000 (+0200) Subject: auth: test-lua - Fix unit test to handle errors X-Git-Tag: 2.3.4~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9d8d0023a7754e2aa8e28d3d95553138ef1ded30;p=thirdparty%2Fdovecot%2Fcore.git auth: test-lua - Fix unit test to handle errors --- diff --git a/src/auth/test-lua.c b/src/auth/test-lua.c index ec41999753..a87a97933a 100644 --- a/src/auth/test-lua.c +++ b/src/auth/test-lua.c @@ -32,13 +32,14 @@ static void test_db_lua_auth_verify(void) test_begin("auth db lua passdb_verify"); test_assert(dlua_script_create_string(luascript, &script, NULL, &error) == 0); - test_assert(auth_lua_script_init(script, &error) == 0); if (script != NULL) { + test_assert(auth_lua_script_init(script, &error) == 0); test_assert(auth_lua_call_password_verify(script, req, "password", &error) == 1); - if (error != NULL) - i_debug("error = %s", error); + dlua_script_unref(&script); + } + if (error != NULL) { + i_error("Test failed: %s", error); } - dlua_script_unref(&script); i_free(req->passdb); auth_request_unref(&req); @@ -68,11 +69,14 @@ static void test_db_lua_auth_lookup(void) test_begin("auth db lua passdb_lookup"); test_assert(dlua_script_create_string(luascript, &script, NULL, &error) == 0); - test_assert(auth_lua_script_init(script, &error) == 0); if (script != NULL) { + test_assert(auth_lua_script_init(script, &error) == 0); test_assert(auth_lua_call_passdb_lookup(script, req, &scheme, &pass, &error) == 1); + dlua_script_unref(&script); + } + if (error != NULL) { + i_error("Test failed: %s", error); } - dlua_script_unref(&script); i_free(req->passdb); auth_request_unref(&req);