summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorDavid Faure <faure+bluesystems@kde.org>2013-01-12 10:12:47 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-07 01:22:40 +0100
commit574e5cf9c510fb28781c8006a1184ca158ee859f (patch)
tree906590d16dd8d54cc6e6d1ba443fe96c66262aac /tests/auto
parentee317360e305c75b8a0050b9344895eb6990cfff (diff)
Add qunsetenv(), next to qputenv() and friends.
The existing tst_qgetputenv shows that qputenv with an empty value doesn't lead to the same result on Windows and on Unix, and there was no way to fully delete an env var on Unix (which is needed for some env vars where not-set and empty are different, such as TZ, see `man tzset`). This is also why qglobal has qEnvironmentVariableIsSet() vs qEnvironmentVariableIsEmpty(), on the getter side. Qt4's ifdefs around unsetenv in qapplication_x11.cpp show that this is needed within Qt too (although this particular startup notification code has to be re-imported into Qt5 still). Change-Id: I631c8cddbcf933d4b9008f11aefc59f5a3c7c866 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
index a4aca82aa9..ef41ef8801 100644
--- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
+++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
@@ -75,6 +75,13 @@ void tst_QGetPutEnv::getSetCheck()
QVERIFY(result == "supervalue");
qputenv(varName,QByteArray());
+
+ // Now test qunsetenv
+ QVERIFY(qunsetenv(varName));
+ QVERIFY(!qEnvironmentVariableIsSet(varName));
+ QVERIFY(qEnvironmentVariableIsEmpty(varName));
+ result = qgetenv(varName);
+ QCOMPARE(result, QByteArray());
}
QTEST_MAIN(tst_QGetPutEnv)