Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-98965

As a Qt developer, I would like to test Q_ASSERTions without having to spin a separate process

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • None
    • Core: Other
    • None
    • 8
    • 1145e1709 (dev), eb3df4edb (dev), 4a352937e (6.9), 8d984800f (6.8), dc894e316 (tqtc/lts-6.5)
    • Foundation PM Staging, Foundation Sprint 123, Foundation Sprint 124, Foundation Sprint 125, Foundation Sprint 126, Foundation Sprint 127, Foundation Sprint 128, Foundation Sprint 129, Foundation Sprint 130, Foundation Sprint 131, Foundation Sprint 132, Foundation Sprint 133, Foundation Sprint 134, Foundation Sprint 135, Foundation Sprint 136, Foundation Sprint 137

      I'm developing for and with Qt, and I'm unsure whether every Q_ASSERT I put in my code is actually correct. So I would like to test them, which is easy for the positive case (assertion passed), of course, because the function-under-test returns normally. For the negative case, though, where an assertion would fail, I need to place the test into a separate executable, compile and run it, and verify that it exited abnormally (and even then I could just hit an unrelated crash, so I'd also need to parse the output of the executable to look for the assertion failure signature).

      It would be nice if there was a mode where Q_ASSERT would just throw an exception, say QAssertionFailed, instead of calling std::abort().

        For Gerrit Dashboard: QTBUG-98965
        # Subject Branch Project Status CR V

            cnn Qt Core & Network
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes