summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-04-21 18:32:36 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-10 12:54:52 +0200
commit4212ee7ec7f9ac77a4acd0796e56dbdd1e2c7baa (patch)
treefb53c250df21b57c82b1fcb8043f7386471c70f7 /tests
parent3ab236d77ba47d7cbf332d12596564bce21ac6a7 (diff)
make QProcessEnvironment on Windows preserve variable name case
while windows itself does not care which case the variable names are in, they may be passed to unix tools which *do* care. note that this uses true case folding for string comparisons while windows uses uppercasing. this means that "ess" and "eß" will be considered the same by us, while not by windows. this is not expected to have real-world impact, particularly because non-ascii variable names are not used much. Task-number: QTCREATORBUG-3110 Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit f3db5603871928ebed43a085a496397e65952b39)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp
index 1c26343e74..98d48900a5 100644
--- a/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp
+++ b/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -43,10 +43,6 @@
#include <QObject>
#include <QProcessEnvironment>
-// Note:
-// in cross-platform tests, ALWAYS use UPPERCASE variable names
-// That's because on Windows, the variables are uppercased
-
class tst_QProcessEnvironment: public QObject
{
Q_OBJECT
@@ -214,7 +210,7 @@ void tst_QProcessEnvironment::caseSensitivity()
e.insert("foo", "bar");
#ifdef Q_OS_WIN
- // on Windows, it's uppercased
+ // Windows is case-insensitive, but case-preserving
QVERIFY(e.contains("foo"));
QVERIFY(e.contains("FOO"));
QVERIFY(e.contains("FoO"));
@@ -223,8 +219,12 @@ void tst_QProcessEnvironment::caseSensitivity()
QCOMPARE(e.value("FOO"), QString("bar"));
QCOMPARE(e.value("FoO"), QString("bar"));
+ // Per Windows, this overwrites the value, but keeps the name's original capitalization
+ e.insert("Foo", "Bar");
+
QStringList list = e.toStringList();
- QCOMPARE(list.at(0), QString("FOO=bar"));
+ QCOMPARE(list.length(), 1);
+ QCOMPARE(list.at(0), QString("foo=Bar"));
#else
// otherwise, it's case sensitive
QVERIFY(e.contains("foo"));
@@ -236,6 +236,7 @@ void tst_QProcessEnvironment::caseSensitivity()
QCOMPARE(e.value("foo"), QString("bar"));
QStringList list = e.toStringList();
+ QCOMPARE(list.length(), 2);
QVERIFY(list.contains("foo=bar"));
QVERIFY(list.contains("FOO=baz"));
#endif