Skip to content

Commit

Permalink
Add shtesting of timegm and timelocal
Browse files Browse the repository at this point in the history
  • Loading branch information
nicowilliams committed Aug 29, 2023
1 parent 38e657a commit ab0b905
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/shtest
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ab0b905

Please sign in to comment.