Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #30968
Closed (moved) (moved)
Open
Issue created Jun 25, 2019 by teor@teor

Refactor unit test asserts so they log context

In #30721 (moved), I created some complex macros to preserve line numbers when the unit tests fail.

We could refactor these macros into functions, if the tiny test assertions supported context.

catalyst suggests allowing file and line numbers (and functions?):

I think I see that the problem is buried in the TT_DECLARE() macro in tinytest_macros.h. I think it's possible to work around it, but it might be nontrivial. (Rough sketch: redefine TT_DECLARE() in helper functions to read file and line info from function parameters, and make file and line numbers explicit parameters to helper functions.)

I suggest allowing a format string, which could also print the data that we're testing. (For the tor_addr_port_lookup() tests, the best context is the address string.)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking