Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 861
    • Issues 861
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 57
    • Merge requests 57
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !2215

gtestutils: Add more convenience functions

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Simon McVittie requested to merge wip/test-fail-convenience into main Aug 05, 2021
  • Overview 6
  • Commits 4
  • Pipelines 3
  • Changes 9

Based on !2216 (merged) (without which the tests added here will fail), please review that first.

  • gtestutils: Allow failing a test with a printf-style message

    This allows a pattern like

      g_test_message ("cannot reticulate splines: %s", error->message);
      g_test_fail ();

    to be replaced by the simpler

      g_test_fail_message ("cannot reticulate splines: %s", error->message);

    with the secondary benefit of making the message available to TAP consumers as part of the "not ok" message.

  • tests: Make use of g_test_fail_message()

  • gtestutils: Allow skipping tests with a printf-style message

    Forming the g_test_skip() message from printf-style arguments seems common enough to deserve a convenience function.

    g_test_incomplete() is mechanically almost equivalent to g_test_skip() (the semantics are different but the implementation is very similar), so give it a similar mechanism for symmetry.

  • tests: Use g_test_skip_printf()

Edited Aug 05, 2021 by Simon McVittie
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: wip/test-fail-convenience