From 9cfda79202c9c7955a1100861ed2135506302921 Mon Sep 17 00:00:00 2001 From: Maximilian Goldstein Date: Thu, 1 Oct 2020 09:41:16 +0200 Subject: qmlformat: Fix formatting of for...of loops using array variables Fixes: QTBUG-86980 Pick-to: 5.15 Change-Id: Id27350821051709894c7645a362cfdf7ce0d279c Reviewed-by: Ulf Hermann --- tests/auto/qml/qmlformat/data/forOf.formatted.qml | 9 +++++++++ tests/auto/qml/qmlformat/data/forOf.qml | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/auto/qml/qmlformat/data/forOf.formatted.qml create mode 100644 tests/auto/qml/qmlformat/data/forOf.qml (limited to 'tests/auto/qml/qmlformat/data') diff --git a/tests/auto/qml/qmlformat/data/forOf.formatted.qml b/tests/auto/qml/qmlformat/data/forOf.formatted.qml new file mode 100644 index 0000000000..fa29f16b81 --- /dev/null +++ b/tests/auto/qml/qmlformat/data/forOf.formatted.qml @@ -0,0 +1,9 @@ +import QtQml 2.0 + +QtObject { + Component.onCompleted: { + var list = [[1, 2], [3, 4], [5, 6]]; + for (const [x, y] of list) console.log("X: " + x + "; Y: " + y) + for (let [x, y] of list) console.log("X: " + x + "; Y: " + y) + } +} diff --git a/tests/auto/qml/qmlformat/data/forOf.qml b/tests/auto/qml/qmlformat/data/forOf.qml new file mode 100644 index 0000000000..0c3be0d2a2 --- /dev/null +++ b/tests/auto/qml/qmlformat/data/forOf.qml @@ -0,0 +1,12 @@ +import QtQml 2.0 + +QtObject { + Component.onCompleted: { + var list = [[1,2],[3,4],[5,6]]; + + for (const [x,y] of list) + console.log("X: "+x+"; Y: "+y); + for (let [x,y] of list) + console.log("X: "+x+"; Y: "+y); + } +} -- cgit v1.2.3