diff options
author | Richard Weickelt <richard@weickelt.de> | 2021-02-13 16:00:25 +0100 |
---|---|---|
committer | Richard Weickelt <richard@weickelt.de> | 2021-02-15 21:38:33 +0000 |
commit | f8c18f9a4e2906330638f17f612ee62325a88dc0 (patch) | |
tree | f7810768d3fa17da54c15d77d1db5f469f11bc53 /tests/auto/blackbox/testdata/path-probe | |
parent | 91c2a99b81c2c3fc6a22787c3b471a47515abf00 (diff) |
Test for array-like objects with instanceof Array
Array.isArray() seemed to work for arrays created in scripts as well as
for QStringList and QVariantList created in C++ when using QtScript.
QJSEngine is more strict (see the comments in QTBUG-45018). One way to
work around that problem is to use instanceof Array instead.
Change-Id: I0f1c8757a5ab2f82e26eff19a8b5ecf667bb04b1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata/path-probe')
-rw-r--r-- | tests/auto/blackbox/testdata/path-probe/BaseApp.qbs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs b/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs index acafdb52b..62871698e 100644 --- a/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs +++ b/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs @@ -61,7 +61,7 @@ Product { if (lhs.length !== rhs.length) return false; for (var i = 0; i < lhs.length; ++i) { - if (Array.isArray(lhs[i]) && Array.isArray(rhs[i])) { + if ((lhs[i] instanceof Array) && (rhs[i] instanceof Array)) { if (!compareArrays(lhs[i], rhs[i])) return false; } else if (FileInfo.resolvePath(path, lhs[i]) !== FileInfo.resolvePath(path, rhs[i])) { |