diff --git a/devtools/dev-create-test-filesystem.sh b/devtools/dev-create-test-filesystem.sh index 3541a39..da691f4 100755 --- a/devtools/dev-create-test-filesystem.sh +++ b/devtools/dev-create-test-filesystem.sh @@ -190,22 +190,26 @@ echo -e "\033[1m[ 8/13]\033[0m Creating date and time testcases" # there’s no way to touch the created date of a file... # so we have to do this the old-fashioned way! # (and make sure these don't actually get listed) -touch -t $OLD_DATE "$TEST_ROOT/dates/peach"; sleep 1 -touch -t $MED_DATE "$TEST_ROOT/dates/plum"; sleep 1 -touch -t $NEW_DATE "$TEST_ROOT/dates/pear" +touch -t $FIXED_OLD_DATE "$TEST_ROOT/dates/peach"; sleep 1 +touch -t $FIXED_MED_DATE "$TEST_ROOT/dates/plum"; sleep 1 +touch -t $FIXED_NEW_DATE "$TEST_ROOT/dates/pear" # modified dates -touch -t $OLD_DATE -m "$TEST_ROOT/dates/pear" -touch -t $MED_DATE -m "$TEST_ROOT/dates/peach" -touch -t $NEW_DATE -m "$TEST_ROOT/dates/plum" +touch -t $FIXED_OLD_DATE -m "$TEST_ROOT/dates/pear" +touch -t $FIXED_MED_DATE -m "$TEST_ROOT/dates/peach" +touch -t $FIXED_NEW_DATE -m "$TEST_ROOT/dates/plum" # accessed dates -touch -t $OLD_DATE -a "$TEST_ROOT/dates/plum" -touch -t $MED_DATE -a "$TEST_ROOT/dates/pear" -touch -t $NEW_DATE -a "$TEST_ROOT/dates/peach" +touch -t $FIXED_OLD_DATE -a "$TEST_ROOT/dates/plum" +touch -t $FIXED_MED_DATE -a "$TEST_ROOT/dates/pear" +touch -t $FIXED_NEW_DATE -a "$TEST_ROOT/dates/peach" 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. # We need to test combinations of various numbers of files *and* diff --git a/devtools/dev-fixtures.sh b/devtools/dev-fixtures.sh index 50c69a5..34256b6 100644 --- a/devtools/dev-fixtures.sh +++ b/devtools/dev-fixtures.sh @@ -34,6 +34,10 @@ export FIXED_LONG_USER="antidisestablishmentarienism" # A couple of dates, for date-time testing. -export OLD_DATE='200303030000.00' -export 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_OLD_DATE='200303030000.00' +export FIXED_MED_DATE='200606152314.29' # the june gets used for fr_FR locale 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' diff --git a/xtests/details-view-dates.toml b/xtests/details-view-dates.toml index 9fe3e10..50c2646 100644 --- a/xtests/details-view-dates.toml +++ b/xtests/details-view-dates.toml @@ -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 [[cmd]] diff --git a/xtests/outputs/dates_long_time_accessed.ansitxt b/xtests/outputs/dates_long_time_accessed.ansitxt new file mode 100644 index 0000000..f0f56bd --- /dev/null +++ b/xtests/outputs/dates_long_time_accessed.ansitxt @@ -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 diff --git a/xtests/outputs/dates_long_time_created.ansitxt b/xtests/outputs/dates_long_time_created.ansitxt new file mode 100644 index 0000000..141a672 --- /dev/null +++ b/xtests/outputs/dates_long_time_created.ansitxt @@ -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 diff --git a/xtests/outputs/dates_long_time_modified.ansitxt b/xtests/outputs/dates_long_time_modified.ansitxt new file mode 100644 index 0000000..7ffbb9d --- /dev/null +++ b/xtests/outputs/dates_long_time_modified.ansitxt @@ -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 diff --git a/xtests/outputs/far_dates_long.ansitxt b/xtests/outputs/far_dates_long.ansitxt new file mode 100644 index 0000000..71c4d67 --- /dev/null +++ b/xtests/outputs/far_dates_long.ansitxt @@ -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