aboutsummaryrefslogtreecommitdiffstats
path: root/tools/snippets_translate/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-12-13 16:42:17 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-12-14 14:09:36 +0100
commit4315cfb44eaa8abd57c685390c6b9d3aff09ba0f (patch)
tree2bad10449cc23dd4b01d6846c33ca280abac1477 /tools/snippets_translate/tests
parent4816f9e23b2ddb457fa4f110a391f4c217e628f2 (diff)
snippets_translate: Improve handling of string literals
Add QStringLiteral and others and handle multiple occurrences per line better by making the patterns more discriminative. Pick-to: 6.4 6.2 Task-number: PYSIDE-2151 Task-number: PYSIDE-1106 Change-Id: I37589dfafe27d69480db665363d5900d163014da Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'tools/snippets_translate/tests')
-rw-r--r--tools/snippets_translate/tests/test_converter.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/snippets_translate/tests/test_converter.py b/tools/snippets_translate/tests/test_converter.py
index 4cf614d1e..1be9af553 100644
--- a/tools/snippets_translate/tests/test_converter.py
+++ b/tools/snippets_translate/tests/test_converter.py
@@ -368,7 +368,12 @@ def test_ternary_operator():
def test_useless_qt_classes():
assert st('result += QLatin1String("; ");') == 'result += "; "'
+ assert st('result += QString::fromLatin1("; ");') == 'result += "; "'
+ assert (
+ st('result = QStringLiteral("A") + QStringLiteral("B");')
+ == 'result = "A" + "B"')
assert st("<< QLatin1Char('\0') << endl;") == "print('\0')"
+ assert st('result = "A"_s;') == 'result = "A"'
def test_special_cases():