ソースを参照

More date-related xtests

• Displaying accessed and modified dates
• Displaying dates in the distant past and far future (#557)
Benjamin Sago 5 年 前
コミット
d8b21a33b5

+ 13 - 9
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*

+ 7 - 3
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'

+ 38 - 0
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]]

+ 4 - 0
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

+ 4 - 0
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

+ 4 - 0
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

+ 2 - 0
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