More date-related xtests

• Displaying accessed and modified dates
• Displaying dates in the distant past and far future (#557)
This commit is contained in:
Benjamin Sago 2020-10-17 21:26:24 +01:00
parent ef7bb43dbb
commit d8b21a33b5
7 changed files with 72 additions and 12 deletions

View File

@ -190,22 +190,26 @@ echo -e "\033[1m[ 8/13]\033[0m Creating date and time testcases"
# theres no way to touch the created date of a file... # theres no way to touch the created date of a file...
# so we have to do this the old-fashioned way! # so we have to do this the old-fashioned way!
# (and make sure these don't actually get listed) # (and make sure these don't actually get listed)
touch -t $OLD_DATE "$TEST_ROOT/dates/peach"; sleep 1 touch -t $FIXED_OLD_DATE "$TEST_ROOT/dates/peach"; sleep 1
touch -t $MED_DATE "$TEST_ROOT/dates/plum"; sleep 1 touch -t $FIXED_MED_DATE "$TEST_ROOT/dates/plum"; sleep 1
touch -t $NEW_DATE "$TEST_ROOT/dates/pear" touch -t $FIXED_NEW_DATE "$TEST_ROOT/dates/pear"
# modified dates # modified dates
touch -t $OLD_DATE -m "$TEST_ROOT/dates/pear" touch -t $FIXED_OLD_DATE -m "$TEST_ROOT/dates/pear"
touch -t $MED_DATE -m "$TEST_ROOT/dates/peach" touch -t $FIXED_MED_DATE -m "$TEST_ROOT/dates/peach"
touch -t $NEW_DATE -m "$TEST_ROOT/dates/plum" touch -t $FIXED_NEW_DATE -m "$TEST_ROOT/dates/plum"
# accessed dates # accessed dates
touch -t $OLD_DATE -a "$TEST_ROOT/dates/plum" touch -t $FIXED_OLD_DATE -a "$TEST_ROOT/dates/plum"
touch -t $MED_DATE -a "$TEST_ROOT/dates/pear" touch -t $FIXED_MED_DATE -a "$TEST_ROOT/dates/pear"
touch -t $NEW_DATE -a "$TEST_ROOT/dates/peach" touch -t $FIXED_NEW_DATE -a "$TEST_ROOT/dates/peach"
sudo chown $FIXED_USER:$FIXED_USER -R "$TEST_ROOT/dates" sudo chown $FIXED_USER:$FIXED_USER -R "$TEST_ROOT/dates"
mkdir "$TEST_ROOT/far-dates"
touch -t $FIXED_PAST_DATE "$TEST_ROOT/far-dates/the-distant-past"
touch -t $FIXED_FUTURE_DATE "$TEST_ROOT/far-dates/beyond-the-future"
# Awkward extended attribute testcases. # Awkward extended attribute testcases.
# We need to test combinations of various numbers of files *and* # We need to test combinations of various numbers of files *and*

View File

@ -34,6 +34,10 @@ export FIXED_LONG_USER="antidisestablishmentarienism"
# A couple of dates, for date-time testing. # A couple of dates, for date-time testing.
export OLD_DATE='200303030000.00' export FIXED_OLD_DATE='200303030000.00'
export MED_DATE='200606152314.29' # the june gets used for fr_FR locale tests export FIXED_MED_DATE='200606152314.29' # the june gets used for fr_FR locale tests
export NEW_DATE='200912221038.53' # and the december for ja_JP local tests export FIXED_NEW_DATE='200912221038.53' # and the december for ja_JP local tests
# Dates that extend beyond 32-bit timespace.
export FIXED_PAST_DATE='170001010000.00'
export FIXED_FUTURE_DATE='230001010000.00'

View File

@ -1,3 +1,41 @@
# various date fields
[[cmd]]
name = "exa -lh produces a table using the modified time field"
shell = "exa -lh /testcases/dates"
stdout = { file = "outputs/dates_long_time_modified.ansitxt" }
stderr = { empty = true }
status = 0
tags = [ 'long', 'header', 'time' ]
[[cmd]]
name = "exa -lh --time=modified produces a table using the modified time field"
shell = "exa -lh --time=modified /testcases/dates"
stdout = { file = "outputs/dates_long_time_modified.ansitxt" }
stderr = { empty = true }
status = 0
tags = [ 'long', 'header', 'time' ]
[[cmd]]
name = "exa -lh --time=accessed produces a table using the accessed time field"
shell = "exa -lh --time=accessed /testcases/dates"
stdout = { file = "outputs/dates_long_time_accessed.ansitxt" }
stderr = { empty = true }
status = 0
tags = [ 'long', 'header', 'time' ]
# distant past and far future dates
[[cmd]]
name = "exa -l handles dates far past and future dates"
shell = "exa -l /testcases/far-dates"
stdout = { file = "outputs/far_dates_long.ansitxt" }
stderr = { empty = true }
status = 0
tags = [ 'long', 'time' ]
# alternate date formats # alternate date formats
[[cmd]] [[cmd]]

View File

@ -0,0 +1,4 @@
Permissions Size User Date Accessed Name
.rw-rw-r-- 0 cassowary 22 Dec 2009 peach
.rw-rw-r-- 0 cassowary 15 Jun 2006 pear
.rw-rw-r-- 0 cassowary  3 Mar 2003 plum

View File

@ -0,0 +1,4 @@
Permissions Size User Date Created Name
.rw-rw-r-- 0 cassowary 17 Oct 14:27 peach
.rw-rw-r-- 0 cassowary 17 Oct 14:27 pear
.rw-rw-r-- 0 cassowary 17 Oct 14:27 plum

View File

@ -0,0 +1,4 @@
Permissions Size User Date Modified Name
.rw-rw-r-- 0 cassowary 15 Jun 2006 peach
.rw-rw-r-- 0 cassowary  3 Mar 2003 pear
.rw-rw-r-- 0 cassowary 22 Dec 2009 plum

View File

@ -0,0 +1,2 @@
.rw-rw-r-- 0 vagrant  1 Jan 2300 beyond-the-future
.rw-rw-r-- 0 vagrant  1 Jan 1700 the-distant-past