summaryrefslogtreecommitdiff
path: root/src/tests/eina/eina_test_promise.c
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2016-06-06 02:54:18 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-06 03:09:40 -0300
commit47dea6abc184823df29f4ce0bcdac59aac637bf8 (patch)
tree3ece6c03245ddcc49b0dd5e52cacce36e4206083 /src/tests/eina/eina_test_promise.c
parent2a3d7860dbc11458425e162cd69ee399e9025251 (diff)
eina: Avoid promise early deletion when cancelled.
Cancelling a promise will fulfill it but won't actually free the memory. This memory is under custody of the owner, who must either call value_set or error_set to finish it.
Diffstat (limited to '')
-rw-r--r--src/tests/eina/eina_test_promise.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_promise.c b/src/tests/eina/eina_test_promise.c
index e2ef1f3651..4629869d2c 100644
--- a/src/tests/eina/eina_test_promise.c
+++ b/src/tests/eina/eina_test_promise.c
@@ -201,6 +201,14 @@ START_TEST(eina_test_promise_cancel_promise)
201 eina_promise_cancel(promise); 201 eina_promise_cancel(promise);
202 202
203 ck_assert(cancel_ran && ran); 203 ck_assert(cancel_ran && ran);
204 ck_assert(eina_promise_owner_cancelled_is(owner));
205 ck_assert(!eina_promise_pending_is(promise));
206 ck_assert_int_eq(EINA_ERROR_PROMISE_CANCEL, eina_promise_error_get(promise));
207
208 // Finally free the owner
209 eina_promise_owner_value_set(owner, NULL, NULL);
210
211 ck_assert(ran);
204 212
205 eina_shutdown(); 213 eina_shutdown();
206} 214}
@@ -505,6 +513,14 @@ START_TEST(eina_test_pointer_promise_cancel_promise)
505 eina_promise_cancel(promise); 513 eina_promise_cancel(promise);
506 514
507 ck_assert(cancel_ran && ran); 515 ck_assert(cancel_ran && ran);
516 ck_assert(eina_promise_owner_cancelled_is(owner));
517 ck_assert(!eina_promise_pending_is(promise));
518 ck_assert_int_eq(EINA_ERROR_PROMISE_CANCEL, eina_promise_error_get(promise));
519
520 // Free the owner
521 eina_promise_owner_value_set(owner, NULL, NULL);
522
523 ck_assert(ran);
508 524
509 eina_shutdown(); 525 eina_shutdown();
510} 526}