aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-05-31 15:29:05 +0200
committerEike Ziller <eike.ziller@qt.io>2019-06-03 06:46:52 +0000
commit23c222f61b260b56c10775197d6100f130d558b4 (patch)
tree513c9d0f65d9f7f9ec4884c64db7f92f858beaa2 /tests/auto
parentd73c27125952bcce920a2abd55c7c3758e850ac0 (diff)
Fix C++ Library wizard when compiled with Qt < 5.12
Only Qt 5.12 got true ECMA Script capabilities, so arrow function expressions are not supported before that. To be able to use "regular" inline functions, we allow usage of } by escaping with backslash. For variables that do not start with "JS:" we already supported backslash for escaping. Fixes: QTCREATORBUG-22336 Change-Id: I9fc638e64d2757a21fffc16355635e2fcff87a36 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/utils/stringutils/tst_stringutils.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/utils/stringutils/tst_stringutils.cpp b/tests/auto/utils/stringutils/tst_stringutils.cpp
index 8e51c89300..98e04185ab 100644
--- a/tests/auto/utils/stringutils/tst_stringutils.cpp
+++ b/tests/auto/utils/stringutils/tst_stringutils.cpp
@@ -68,6 +68,14 @@ public:
*ret = "bar";
return true;
}
+ if (name == "JS:with } inside") {
+ *ret = "yay";
+ return true;
+ }
+ if (name == "JS:literal%{") {
+ *ret = "hurray";
+ return true;
+ }
return false;
}
};
@@ -158,7 +166,9 @@ void tst_StringUtils::testMacroExpander_data()
{"%{hihi//./c}", "ccc"},
{"%{hihi/(.)(.)r/\\2\\1c}", "abc"}, // no escape for capture groups
{"%{hihi/b/c/d}", "c/dar"},
- {"%{hihi/a/e{\\}e}", "be{}er"}, // escape closing brace
+ {"%{hihi/a/e{\\}e}", "be{}er"}, // escape closing brace
+ {"%{JS:with \\} inside}", "yay"}, // escape closing brace also in JS:
+ {"%{JS:literal%\\{}", "hurray"},
{"%{slash/o\\/b/ol's c}", "fool's car"},
{"%{sl\\/sh/(.)(a)(.)/\\2\\1\\3as}", "salsash"}, // escape in variable name
{"%{JS:foo/b/c}", "%{JS:foo/b/c}"}, // No replacement for JS (all considered varName)