Change assertion functions to accept a function returning a string as the message parameter

XMLWordPrintableJSON

    • Fully Compatible
    • TIG 2018-02-26
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-32497 and SERVER-32778 are two recent cases where accidentally calling tojson() in a loop impacts performance negatively enough to cause tests to fail. We could avoid this issue by changing the assertion functions to accept a function returning a string as the message parameter and only lazily calling the function if doassert() would be called. Note: The doassert() functions attempts to handle when the message parameter is a function; however, it is defeated by the assertion functions prefixing a string to the intended assertion message.

      As part of this ticket, we should also update existing tests that define an object with a "toString" property as a way to define a function for getting the assertion message to just pass the function directly instead.

              Assignee:
              David Bradford (Inactive)
              Reporter:
              Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: