commit: b776b074b347d8f6e1da4a8205a13e3b8d78e37e
parent 590f14ac6dd5c9e2f2cf73e39659ce11646077c0
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 17 Jan 2025 08:14:51 +0100
test-cmd/shuf.sh: new
Diffstat:
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/test-cmd/shuf.sh b/test-cmd/shuf.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
+# SPDX-License-Identifier: MPL-2.0
+
+WD="$(dirname "$0")"
+target="${WD}/../cmd/shuf"
+plans=6
+. "$(dirname "$0")/tap.sh"
+
+t --input='' noargs '' ''
+
+t --input='foo' stdin '' 'foo'
+t --input='foo' stdin_dash '-' 'foo'
+
+t devnull '/dev/null' ''
+
+t_seq_shuf_wc() {
+ seq $seq | "$target" "$@" | wc -l
+}
+
+seq=20
+t_cmd seq20_n10 '10
+' t_seq_shuf_wc -n 10
+
+seq=7
+t_cmd seq7_n10 '7
+' t_seq_shuf_wc -n 10