aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/profilewriter
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-01-23 17:30:52 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2019-01-24 15:31:53 +0000
commita420374976a691fee6483c9419e78250a3a30b28 (patch)
tree222333d32d4cc9b823009f8c5d3f4a2c7e67155f /tests/auto/profilewriter
parent809416c993afe9a9c7dac3c2cad784864f39a2cd (diff)
QmakePM: Do a "sorted insert" when adding files
Don't blindly append to the end of the list, but try to put files into the right place with regards to lexicographical order. We do not re-sort existing file lists, nor do we attempt to be fancy with strangely formatted project files. But lists conforming to our own style will stay sorted, in particular lists that have only ever been touched by Qt Creator. Fixes: QTCREATORBUG-553 Fixes: QTCREATORBUG-21807 Change-Id: I15db0e867a2d477fcf95e008f98ba468dcd83e45 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/profilewriter')
-rw-r--r--tests/auto/profilewriter/tst_profilewriter.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/profilewriter/tst_profilewriter.cpp b/tests/auto/profilewriter/tst_profilewriter.cpp
index 0e927e1e9a..b820d6fdcf 100644
--- a/tests/auto/profilewriter/tst_profilewriter.cpp
+++ b/tests/auto/profilewriter/tst_profilewriter.cpp
@@ -208,6 +208,34 @@ void tst_ProFileWriter::adds_data()
},
{
PW::AppendValues|PW::AppendOperator|PW::MultiLine,
+ "insert at end", f_foo_bar, 0,
+ "SOURCES = some files",
+ "SOURCES = some files \\\n"
+ " bar \\\n"
+ " foo"
+ },
+ {
+ PW::AppendValues|PW::AppendOperator|PW::MultiLine,
+ "insert into empty", f_foo_bar, 0,
+ "SOURCES =",
+ "SOURCES = \\\n"
+ " bar \\\n"
+ " foo"
+ },
+ {
+ PW::AppendValues|PW::AppendOperator|PW::MultiLine,
+ "insert into middle", f_foo_bar, 0,
+ "SOURCES = some files \\\n"
+ " aargh \\\n"
+ " zoo",
+ "SOURCES = some files \\\n"
+ " aargh \\\n"
+ " bar \\\n"
+ " foo \\\n"
+ " zoo"
+ },
+ {
+ PW::AppendValues|PW::AppendOperator|PW::MultiLine,
"add to existing after comment (wrong operator)", f_foo, 0,
"SOURCES = some files # comment",
"SOURCES = some files \\ # comment\n"