From ab0b90524aab8342c6a0534a3ad8c87c56f45280 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Mon, 28 Aug 2023 17:53:57 -0500 Subject: [PATCH] Add shtesting of timegm and timelocal --- tests/shtest | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/shtest b/tests/shtest index 52a82190d0..43ef5f91c5 100755 --- a/tests/shtest +++ b/tests/shtest @@ -561,4 +561,19 @@ if ! $VALGRIND $Q $JQ -n -f "$JQTESTDIR/yes-main-program.jq" > $d/out 2>&1; then exit 1 fi +# #2863 +if ! TZ=CST+6CDT $VALGRIND $Q $JQ -cne ' + 1693243637 + | localtime + | (.[9] |= if .==null then -18000 else . end) + | (.[10] |= if .==null then "CDT" else . end) + | [.,mktime,timegm,timelocal,timegm - timelocal] + | debug + | (.[1] == .[2]) + and + (. == [[2023,7,28,12,27,17,1,239,true,-18000,"CDT"],1693225637,1693225637,1693243637,-18000])'; then + echo "Time functions not working correctly" + exit 1 +fi + exit 0