After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787581 - tests: Add tests for g_slist_copy() and g_slist_copy_deep()
tests: Add tests for g_slist_copy() and g_slist_copy_deep()
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-09-12 11:04 UTC by Philip Withnall
Modified: 2017-09-13 12:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: Add tests for g_slist_copy() and g_slist_copy_deep() (2.86 KB, patch)
2017-09-12 11:04 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2017-09-12 11:04:44 UTC
Fairly trivial patch.
Comment 1 Philip Withnall 2017-09-12 11:04:48 UTC
Created attachment 359613 [details] [review]
tests: Add tests for g_slist_copy() and g_slist_copy_deep()

This gives us 100% coverage of GSList (when running `make lcov`).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 2 Bastien Nocera 2017-09-13 12:34:47 UTC
Review of attachment 359613 [details] [review]:

Looks good.

::: glib/tests/slist.c
@@ +336,3 @@
+  /* Copy and test a many-element list. */
+  for (i = 0; i < 10; i++)
+    slist = g_slist_append (slist, &nums[i]);

GUINT_TO_POINTER()?
Comment 3 Philip Withnall 2017-09-13 12:36:22 UTC
(In reply to Bastien Nocera from comment #2)
> Review of attachment 359613 [details] [review] [review]:
> 
> Looks good.
> 
> ::: glib/tests/slist.c
> @@ +336,3 @@
> +  /* Copy and test a many-element list. */
> +  for (i = 0; i < 10; i++)
> +    slist = g_slist_append (slist, &nums[i]);
> 
> GUINT_TO_POINTER()?

Thanks for the review! Using GUINT_TO_POINTER() here doesn’t really matter — we still end up with some unique pointers for comparison. I went with this approach since that’s what the rest of the test suite uses. I think consistency trumps having readable integers.
Comment 4 Philip Withnall 2017-09-13 12:37:38 UTC
Attachment 359613 [details] pushed as a2cf480 - tests: Add tests for g_slist_copy() and g_slist_copy_deep()