From 201db1a82736f6bca7cd16e82a1390fcce365f93 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 19 Jul 2023 20:08:21 +0200 Subject: 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 --- tests/auto/qml/qqmlecmascript/data/date.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/auto/qml/qqmlecmascript') 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. -- cgit v1.2.3