diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-22 18:06:01 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-04-13 01:36:06 +0200 |
commit | c68f8db62b3492074a73e754d4668c2d693cdafa (patch) | |
tree | 7d0745947604684855c4bb03fcd3e88deed1f66c /tests/auto/corelib/io/qfile/stdinprocess/main.cpp | |
parent | 223b92490edfd4e3e75e634831258c54d5b0a501 (diff) |
Tests: make some QFile::open calls fail
In some cases calls to QFile::open are made outside of a testfunction
(so we can't use QVERIFY), or even in standalone executables that are
executed by tests. Make them fail "visibly".
Change-Id: Iec4d56f6d874be16aa2e9ad6974eeec2a98caa3f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/io/qfile/stdinprocess/main.cpp')
-rw-r--r-- | tests/auto/corelib/io/qfile/stdinprocess/main.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/corelib/io/qfile/stdinprocess/main.cpp b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp index dbcd00bb0a..0f92ba2670 100644 --- a/tests/auto/corelib/io/qfile/stdinprocess/main.cpp +++ b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp @@ -16,13 +16,16 @@ int main(int argc, char *argv[]) QFile file; if (strcmp(argv[1], "all") == 0) { - file.open(stdin, QFile::ReadWrite); + if (!file.open(stdin, QFile::ReadWrite)) + return 1; printf("%s", file.readAll().constData()); } else if (strcmp(argv[1], "line") == 0) { if (strcmp(argv[2], "0") == 0) { - file.open(stdin, QFile::ReadWrite); + if (!file.open(stdin, QFile::ReadWrite)) + return 1; } else { - file.open(0, QFile::ReadWrite); + if (!file.open(0, QFile::ReadWrite)) + return 1; } char line[1024]; |