summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2020-07-14 15:26:23 +0200
committerTopi Reiniƶ <topi.reinio@qt.io>2020-07-15 08:59:05 +0000
commit87fdeb7f99e08c5f670298fafa7e5a19ce8e71b8 (patch)
tree533c186b03d81ac32363f71568533d57c46c4f2b /tests
parent399d0f91633db9407d08bd083a6aca835be4386e (diff)
QDoc: Config: Allow in-place expansion of environment variables
With the new alternate syntax for referencing environment variables in .qdocconf files, change also the behavior to expand in-place and process the content as part of the qdocconf. This allows use cases where env. variables contain syntax recognized by QDoc, most notably lists with elements separated by whitespace. [ChangeLog][qdoc] Environment variables can now be expanded in-place when processing configuration files. Fixes: QTBUG-67362 Change-Id: I5dee84c1c42d76416f3dff6ccf0a9a1448709c6a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qdoc/config/testdata/configs/expandvars.qdocconf3
-rw-r--r--tests/auto/qdoc/config/tst_config.cpp2
2 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/qdoc/config/testdata/configs/expandvars.qdocconf b/tests/auto/qdoc/config/testdata/configs/expandvars.qdocconf
index 9f8512f2e..ace4ab13b 100644
--- a/tests/auto/qdoc/config/testdata/configs/expandvars.qdocconf
+++ b/tests/auto/qdoc/config/testdata/configs/expandvars.qdocconf
@@ -8,3 +8,6 @@ expanded1 = $data
expanded2 = ${data1,,}
expanded3 = "${data1,} ${data2,}"
literally = \$data \${data}
+
+listdata = ${QDOC_TSTCONFIG_LIST}
+csvlist = ${listdata,,}
diff --git a/tests/auto/qdoc/config/tst_config.cpp b/tests/auto/qdoc/config/tst_config.cpp
index 00630316a..668150540 100644
--- a/tests/auto/qdoc/config/tst_config.cpp
+++ b/tests/auto/qdoc/config/tst_config.cpp
@@ -169,12 +169,14 @@ void::tst_Config::getExampleProjectFile()
void::tst_Config::expandVars()
{
+ qputenv("QDOC_TSTCONFIG_LIST", QByteArray("a b c"));
auto &config = initConfig("/testdata/configs/expandvars.qdocconf");
QCOMPARE(config.getString("expanded1"), "foo");
QCOMPARE(config.getString("expanded2"), "foo,bar");
QCOMPARE(config.getString("expanded3"), "foobar foobar baz");
QCOMPARE(config.getString("literally"), "$data ${data}");
+ QCOMPARE(config.getString("csvlist"), "a,b,c");
}
QTEST_APPLESS_MAIN(tst_Config)