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

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Core: Other
    • None
    • 8
    • 1145e1709 (dev), eb3df4edb (dev), 4a352937e (6.9), 8d984800f (6.8), dc894e316 (tqtc/lts-6.5)
    • Foundation Sprint 123, Foundation Sprint 124, Foundation Sprint 125, Foundation Sprint 126, Foundation Sprint 127, Foundation Sprint 128, Foundation Sprint 129, Foundation Sprint 130

    Description

      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().

      Attachments

        Issue Links

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

          Activity

            People

              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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes