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

Introduce unittest::assertGet(StatusWith<T>) method to facilitate testing functions that return StatusWith

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7.3
    • Affects Version/s: None
    • Component/s: Testing Infrastructure
    • None

      Per the summary, it is often convenient to write tests that assert both that a method returning StatusWith<T> succeeds and checks the value of the returned T. assertGet(StatusWith<T> swt) should ASSERT_OK(swt.getStatus()) and then return swt.getValue(), so that you can write:

      ASSERT_EQUALS(someVal, unittest::assertGet(someStatusWithMethod())
      

            Assignee:
            schwerin@mongodb.com Andy Schwerin
            Reporter:
            schwerin@mongodb.com Andy Schwerin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: