summaryrefslogtreecommitdiffstats
path: root/tests/common/mmin.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-06-04 13:54:16 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-06-04 13:54:16 -0400
commitd6c2c94896c4e9f49e187f6c7b0f0d376a2d02ac (patch)
tree78c3259aa45898c490cb67c68ce8bdfdfbbe986e /tests/common/mmin.sh
parentc6bb003b8882e9a16941f5803d072ec1cb728318 (diff)
downloadbfs-d6c2c94896c4e9f49e187f6c7b0f0d376a2d02ac.tar.xz
tests/common: Add tests for -[am]{min,time}
Diffstat (limited to 'tests/common/mmin.sh')
-rw-r--r--tests/common/mmin.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/common/mmin.sh b/tests/common/mmin.sh
new file mode 100644
index 0000000..38e3337
--- /dev/null
+++ b/tests/common/mmin.sh
@@ -0,0 +1,15 @@
+cd "$TEST"
+
+now=$(epoch_time)
+
+"$XTOUCH" -mt "@$((now - 60 * 60))" one_hour_ago
+"$XTOUCH" -mt "@$((now - 121))" two_minutes_ago
+"$XTOUCH" -mt "@$((now - 61))" one_minute_ago
+"$XTOUCH" -mt "@$((now - 30))" thirty_seconds_ago
+"$XTOUCH" -mt "@$((now + 60))" in_one_minute
+"$XTOUCH" -mt "@$((now + 60 * 60))" in_one_hour
+
+bfs_diff -mindepth 1 \
+ \( -mmin -1 -exec printf -- '-mmin -1: %s\n' {} \; -o -true \) \
+ \( -mmin 1 -exec printf -- '-mmin 1: %s\n' {} \; -o -true \) \
+ \( -mmin +1 -exec printf -- '-mmin +1: %s\n' {} \; -o -true \)