diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2023-07-19 20:08:21 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2023-07-26 14:06:36 +0200 |
commit | 201db1a82736f6bca7cd16e82a1390fcce365f93 (patch) | |
tree | 2bcfe8576528a69b60cbada60202a1ccc98e103e /tests/auto/qml/qqmlecmascript | |
parent | 886f4e70d1124ab4e1917ce53a2c738e4a4b7ee9 (diff) |
Tweak a test to produce clearer output on invalid Date
If the Date is a NaN, there's no point reporting on the rest of its
failure to match the expected value.
Add a missing semicolon as a drive-by.
Change-Id: I9613d590c5ad9463b4b1b0b76f8b3877dead659c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/date.qml | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/date.qml b/tests/auto/qml/qqmlecmascript/data/date.qml index 8e190b1f8f..33644b604d 100644 --- a/tests/auto/qml/qqmlecmascript/data/date.qml +++ b/tests/auto/qml/qqmlecmascript/data/date.qml @@ -26,8 +26,12 @@ Item { function check_value(date, tag, qdt) { var result = true; + if (isNaN(date)) { + console.warn("Invalid Date"); + return false; + } if (date.getFullYear() != 2014) { - console.warn("Wrong year (" + tag + "):", date.getFullYear(), "!= 2014") + console.warn("Wrong year (" + tag + "):", date.getFullYear(), "!= 2014"); result = false; } // July; JS's months are Jan 0 to 11 Dec, vs. Qt's 1 to 12. |