Skip to content

Commit e93bc09

Browse files
committed
golden: r6-touch-date-relative no longer depends on the second boundary between touch and date (the third figure is rounded with an hour of slack)
1 parent a8faa41 commit e93bc09

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎web/test/fixtures/shell/golden/cases/round6.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const CASES = [
8383
['r6-date-mon-dd-yyyy', r`for d in Jul-04-2024 Jul-4-2024 July-4-2024 jul-04-24 Dec-31-2024 Feb-29-2024 Sep-1-2024 'Jul-04-2024 10:00' '10:00 Jul-04-2024' 'Jul-04-2024 +1 day' 'Jul-04-2024 next week' 'Jul-04-2024 10:00:30 EST' Jul-04-99 Jul-04-69 Jul-04-68 Jul-04-100 Jul-04-20; do TZ=UTC date -d "$d" '+%F %T'; done; export LC_ALL=C; for d in Jul-04 Jul-04- Jul-04-2024-05 'Jul 04-2024' 'Jul-04 2024' Jul-4,2024 Jul-32-2024 2024-Jul-04 Jul-0-2024; do TZ=UTC date -d "$d" '+%F' 2>&1; done`],
8484

8585
// ---- touch -d with the whole grammar of date -d, and -r with a relative -d
86-
['r6-touch-date-relative', r`touch -d '1 day ago' a; touch -d yesterday b; touch -d 'next week' c; touch -d '2 hours ago' f; touch -d 'tomorrow 10:00' g; touch -d '3 days ago 12:00' k; touch -cd '1 day ago' l; [ -e l ] || echo 'no l'; [ a -nt c ] || echo "a older than c"; [ c -nt a ] && echo "c newer than a"; [ f -nt a ] && echo "f newer than a"; [ g -nt f ] && echo "g newer than f"; [ k -nt a ] || echo "k older than a"; echo $(( ($(date +%s) - $(stat -c %Y a)) / 3600 )) $(( ($(date +%s) - $(stat -c %Y f)) / 3600 )) $(( ($(stat -c %Y c) - $(date +%s)) / 86400 ))`],
86+
['r6-touch-date-relative', r`touch -d '1 day ago' a; touch -d yesterday b; touch -d 'next week' c; touch -d '2 hours ago' f; touch -d 'tomorrow 10:00' g; touch -d '3 days ago 12:00' k; touch -cd '1 day ago' l; [ -e l ] || echo 'no l'; [ a -nt c ] || echo "a older than c"; [ c -nt a ] && echo "c newer than a"; [ f -nt a ] && echo "f newer than a"; [ g -nt f ] && echo "g newer than f"; [ k -nt a ] || echo "k older than a"; echo $(( ($(date +%s) - $(stat -c %Y a)) / 3600 )) $(( ($(date +%s) - $(stat -c %Y f)) / 3600 )) $(( ($(stat -c %Y c) - $(date +%s) + 3600) / 86400 ))`],
8787
['r6-touch-date-anchored', r`touch -d '2024-03-05 +1 week' d; stat -c '%n %Y' d; touch -d '@86400' h; stat -c '%n %Y' h; touch -d '2024-01-02' i; stat -c '%n %Y' i; touch -d '2024-01-02 03:04:05' j; stat -c '%n %Y' j; touch -d '2024-03-05 10:00' x; touch -r x y -d '+1 day'; stat -c '%n %Y' x y; touch -r x z -d 'yesterday'; stat -c '%n %Y' z`],
8888
['r6-touch-invalid-dates', r`export LC_ALL=C; touch -d 'xyz' m; echo rc=$?; touch -t 2024 q; echo rc=$?; touch -t 1 q; echo rc=$?; touch -t 202401011230.45 ok; stat -c '%n %Y' ok; ls`],
8989

‎web/test/fixtures/shell/golden/golden.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14633,7 +14633,7 @@
1463314633
"name": "r6-touch-date-relative",
1463414634
"source": "round6",
1463514635
"fixture": false,
14636-
"script": "touch -d '1 day ago' a; touch -d yesterday b; touch -d 'next week' c; touch -d '2 hours ago' f; touch -d 'tomorrow 10:00' g; touch -d '3 days ago 12:00' k; touch -cd '1 day ago' l; [ -e l ] || echo 'no l'; [ a -nt c ] || echo \"a older than c\"; [ c -nt a ] && echo \"c newer than a\"; [ f -nt a ] && echo \"f newer than a\"; [ g -nt f ] && echo \"g newer than f\"; [ k -nt a ] || echo \"k older than a\"; echo $(( ($(date +%s) - $(stat -c %Y a)) / 3600 )) $(( ($(date +%s) - $(stat -c %Y f)) / 3600 )) $(( ($(stat -c %Y c) - $(date +%s)) / 86400 ))",
14636+
"script": "touch -d '1 day ago' a; touch -d yesterday b; touch -d 'next week' c; touch -d '2 hours ago' f; touch -d 'tomorrow 10:00' g; touch -d '3 days ago 12:00' k; touch -cd '1 day ago' l; [ -e l ] || echo 'no l'; [ a -nt c ] || echo \"a older than c\"; [ c -nt a ] && echo \"c newer than a\"; [ f -nt a ] && echo \"f newer than a\"; [ g -nt f ] && echo \"g newer than f\"; [ k -nt a ] || echo \"k older than a\"; echo $(( ($(date +%s) - $(stat -c %Y a)) / 3600 )) $(( ($(date +%s) - $(stat -c %Y f)) / 3600 )) $(( ($(stat -c %Y c) - $(date +%s) + 3600) / 86400 ))",
1463714637
"stdout": "no l\na older than c\nc newer than a\nf newer than a\ng newer than f\nk older than a\n24 2 7\n",
1463814638
"stderr": "",
1463914639
"exit": 0,

0 commit comments

Comments
 (0)