summaryrefslogtreecommitdiffstats
path: root/util/cmake/tests
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-07-15 15:38:47 +0200
committerLeander Beernaert <leander.beernaert@qt.io>2019-07-18 07:26:01 +0000
commit341ccc3b590d0a06157f29ce9237bc111e8cebf8 (patch)
tree3fe33c7eea11a5b0be96d81b226b61d90a8559b6 /util/cmake/tests
parent48fd425ea8bbb79fad9800db7b8dbb1b35196142 (diff)
Enable recursive expansion of simple qmake variables
Allow _expand_value to expand variables that may have more than one level of expansion when the regular expression covers all of the input. E.g.: A = Foo B = $$A/Bar scope.expand('$$B') While the original code was able to expand the string '$$B/source.cpp' to 'Foo/Bar/source.cpp', it could not expand the string '$$B' completely. The latter would always return '$$A/Bar' instead of the expected 'Foo/Bar' string. A test case has been added which coveres the above example. Change-Id: Ie3b5739c24ecbeb67d408dd204b0f54bab1d0f3f Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util/cmake/tests')
-rwxr-xr-xutil/cmake/tests/test_scope_handling.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/cmake/tests/test_scope_handling.py b/util/cmake/tests/test_scope_handling.py
index c0b553fabd..14fd266c9c 100755
--- a/util/cmake/tests/test_scope_handling.py
+++ b/util/cmake/tests/test_scope_handling.py
@@ -336,3 +336,11 @@ def test_qstandardpaths_scopes():
assert scope10.total_condition == 'UNIX AND NOT APPLE_OSX AND (ANDROID_EMBEDDED OR NOT ANDROID)'
assert scope11.total_condition == 'HAIKU AND (ANDROID_EMBEDDED OR NOT ANDROID)'
assert scope12.total_condition == 'UNIX AND NOT APPLE_OSX AND NOT HAIKU AND (ANDROID_EMBEDDED OR NOT ANDROID)'
+
+def test_recursive_expansion():
+ scope = _new_scope(A='Foo',B='$$A/Bar')
+ assert scope.get_string('A') == 'Foo'
+ assert scope.get_string('B') == '$$A/Bar'
+ assert scope._expand_value('$$B/Source.cpp') == ['Foo/Bar/Source.cpp']
+ assert scope._expand_value('$$B') == ['Foo/Bar']
+