Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-2470

test_util for matching exceptions should produce clearer explanation

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 3.7.0
    • Affects Version/s: None
    • Component/s: Testing
    • Labels:
      None

      Our current Catch2 helper for matching against an expected exception message produces this output on failure:

      with expansion:
      Failed to resolve doesnotexist.invalid: generic server error mongocxx::
      exception contains message: "parse error"

      While certainly useful, it is misleading: the exception does NOT contain the message "parse error". Instead, that is the message it was /expected/ to contain:

      std::string describe() const override

      { return std::string("mongocxx::exception contains message: \"") + expected_msg + "\""; }

      If the reader of the test message trusts the explanation, this can cause some real head-scratching.

      This should be corrected so that the intent and output match, something like:

      exception was expected to contain: "parse error"

            Assignee:
            jesse.williamson@mongodb.com Jesse Williamson (Inactive)
            Reporter:
            jesse.williamson@mongodb.com Jesse Williamson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: