summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-09-28 15:12:48 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-12-09 20:54:25 +0100
commit37bc11e707d3f29fa81675bcc41610ab65c2b314 (patch)
tree8706fcaec5e287425fb70d047febe7ebaceffc12 /tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
parentb67c367e0eb81a9062009abb6d5893e91719ca3e (diff)
Refactor QTEST*_MAIN() implementations
The various variants duplicated some rather complex code around varying setup in the middle. Rework in terms of a macro that defines main() and takes the setup code as a parameter. That setup code also had some common structure, so package that in a setup macro that takes the class to be used. Reworked various testlib selftests that were using QTEST_MAIN_IMPL(); change to use the new QTEST_MAIN_WRAPPER() and TEST_MAIN_SETUP(). These might be better dealt with by supporting a second form of the initMain() test-setup function in the test classes, that takes references for argc and argv, to let a test massage its command-line options. Change-Id: I7fb16b38d51c80ba2f5c9c82f3b7a37ffc636795 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp')
-rw-r--r--tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
index e94bec3b64..417df9aedb 100644
--- a/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
+++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -88,14 +88,11 @@ void tst_PrintDataTagsWithGlobalTags::c() const
{
}
-int main(int argc, char *argv[])
-{
+QTEST_MAIN_WRAPPER(tst_PrintDataTagsWithGlobalTags,
std::vector<const char*> args(argv, argv + argc);
args.push_back("-datatags");
argc = int(args.size());
argv = const_cast<char**>(&args[0]);
-
- QTEST_MAIN_IMPL(tst_PrintDataTagsWithGlobalTags)
-}
+ QTEST_MAIN_SETUP())
#include "tst_printdatatagswithglobaltags.moc"