Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-70815

extend ASSERT macros to stringify literally anything

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Service Arch 2022-10-31

      To use enum class when asserting in unit tests using ASSERT_EQ (or anything built on ASSERT_COMPARE) you also need to define an operator<< for your enum class type.

      It would be nice if the assertion macros had a fallback for enum class that explicitly casts to the underlying type so the user does not have to add operator<< (or explicitly casting in unit tests)

      Another workaround exists which is to useĀ ASSERT_THAT(..., Eq(...)); which is also clunky.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            henrik.edin@mongodb.com Henrik Edin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: