aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/date.test16
-rw-r--r--tests/touch.test23
2 files changed, 19 insertions, 20 deletions
diff --git a/tests/date.test b/tests/date.test
index a317d35b..5c490b02 100644
--- a/tests/date.test
+++ b/tests/date.test
@@ -9,26 +9,26 @@
tz=Europe/Berlin
# Unix date parsing.
-testing "-d @0" "TZ=$tz date -d @0 2>&1" "Thu Jan 1 01:00:00 CET 1970\n" "" ""
+testing "-d @0" "TZ=$tz date -d @0" "Thu Jan 1 01:00:00 CET 1970\n" "" ""
testing "-d @0x123 invalid" "TZ=$tz date -d @0x123 2>/dev/null || echo expected error" "expected error\n" "" ""
# POSIX format with 2- and 4-digit years.
# All SKIP_HOST=1 because coreutils rejects POSIX format dates supplied to -d.
# These expected values are from running on the host without -d (not as root!).
SKIP_HOST=1 testing "-d MMDDhhmm" \
- "TZ=$tz date -d 06021234 2>&1" "Sun Jun 2 12:34:00 CEST $(date +%Y)\n" "" ""
+ "TZ=$tz date -d 06021234" "Sun Jun 2 12:34:00 CEST $(date +%Y)\n" "" ""
SKIP_HOST=1 testing "-d MMDDhhmmYY.SS" \
- "TZ=$tz date -d 1110143115.30 2>&1" "Tue Nov 10 14:31:30 CET 2015\n" "" ""
+ "TZ=$tz date -d 1110143115.30" "Tue Nov 10 14:31:30 CET 2015\n" "" ""
# busybox thinks this is the year 603 (ISO time 0602-12-34 19:82 with out of range fields normalized).
SKIP_HOST=1 testing "-d MMDDhhmmCCYY" \
- "TZ=$tz date -d 060212341982 2>&1" "Wed Jun 2 12:34:00 CEST 1982\n" "" ""
+ "TZ=$tz date -d 060212341982" "Wed Jun 2 12:34:00 CEST 1982\n" "" ""
SKIP_HOST=1 testing "-d MMDDhhmmCCYY.SS" \
- "TZ=$tz date -d 111014312015.30 2>&1" "Tue Nov 10 14:31:30 CET 2015\n" "" ""
+ "TZ=$tz date -d 111014312015.30" "Tue Nov 10 14:31:30 CET 2015\n" "" ""
# ISO date format.
-testing "-d 1980-01-02" "TZ=$tz date -d 1980-01-02 2>&1" "Wed Jan 2 00:00:00 CET 1980\n" "" ""
-testing "-d 1980-01-02 12:34" "TZ=$tz date -d '1980-01-02 12:34' 2>&1" "Wed Jan 2 12:34:00 CET 1980\n" "" ""
-testing "-d 1980-01-02 12:34:56" "TZ=$tz date -d '1980-01-02 12:34:56' 2>&1" "Wed Jan 2 12:34:56 CET 1980\n" "" ""
+testing "-d 1980-01-02" "TZ=$tz date -d 1980-01-02" "Wed Jan 2 00:00:00 CET 1980\n" "" ""
+testing "-d 1980-01-02 12:34" "TZ=$tz date -d '1980-01-02 12:34'" "Wed Jan 2 12:34:00 CET 1980\n" "" ""
+testing "-d 1980-01-02 12:34:56" "TZ=$tz date -d '1980-01-02 12:34:56'" "Wed Jan 2 12:34:56 CET 1980\n" "" ""
# Reject Unix times without a leading @.
testing "Unix time missing @" "TZ=$tz date 1438053157 2>/dev/null || echo no" \
diff --git a/tests/touch.test b/tests/touch.test
index da6fe99a..b010f7d3 100644
--- a/tests/touch.test
+++ b/tests/touch.test
@@ -32,10 +32,10 @@ testing "-t seconds" \
"touch -t 201201231234.56 walrus && date -r walrus +%Y%m%d-%H%M%S.%N" \
"20120123-123456.000000000\n" "" ""
-testing "-t -" "touch -t 200109081946.40 - > walrus && date -r walrus +%s" \
- "1000000000\n" "" ""
+testing "-t -" "TZ=utc touch -t 200109090146.40 - > walrus && TZ=utc date -r walrus +%s" \
+ "1000000000\n" "" ""
-testing "-t nanoseconds" \
+SKIP_HOST=1 testing "-t nanoseconds" \
"touch -t 201201231234.56123456789 walrus && date -r walrus +%Y%m%d-%H%M%S.%N" \
"20120123-123456.123456789\n" "" ""
@@ -66,13 +66,12 @@ testing "-t CCMMDDhhmm" \
testing "-a" "touch -t 197101020304 walrus &&
touch -t 197203040506 -a walrus && stat -c '%X %Y' walrus" \
- "68562360 31662240\n" "" ""
-testing "-m" "touch -t 197101020304 walrus &&
- touch -t 197203040506 -m walrus && stat -c '%X %Y' walrus" \
- "31662240 68562360\n" "" ""
-testing "-am" "touch -t 197101020304 walrus &&
- touch -t 197203040506 -am walrus && stat -c '%X %Y' walrus" \
- "68562360 68562360\n" "" ""
-
-#testing "-t"
+ "68555160 31655040\n" "" ""
+testing "-m" "TZ=utc touch -t 197101020304 walrus &&
+ TZ=utc touch -t 197203040506 -m walrus && TZ=utc stat -c '%X %Y' walrus" \
+ "31633440 68533560\n" "" ""
+testing "-am" "TZ=utc touch -t 197101020304 walrus &&
+ TZ=utc touch -t 197203040506 -am walrus && TZ=utc stat -c '%X %Y' walrus" \
+ "68533560 68533560\n" "" ""
+
rm walrus walrus2