Import VX multicall utility and applets

This commit is contained in:
2026-03-16 22:06:27 -05:00
parent 9a477cd852
commit 696cb27313
201 changed files with 35660 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
# tests/test_xargs.sh - Tests for xargs applet
_test_name="xargs"
. "$(dirname "$0")/harness.sh"
setup_tmpdir
XARGS="$VX xargs"
echo "Running xargs tests..."
out="$(printf 'a\nb\n' | $XARGS echo ITEM:)"
check_eq "$out" "ITEM: a b" "basic: appends stdin items"
out="$(printf 'a\nb\nc\n' | $XARGS -n 2 echo CHUNK:)"
check_eq "$out" "CHUNK: a b
CHUNK: c" "nflag: max args"
out="$(printf 'one\ntwo\n' | $XARGS -I '{}' echo X{}Y)"
check_eq "$out" "XoneY
XtwoY" "Iflag: replacement"
out="$(printf 'one\ntwo\n' | $XARGS -J '{}' echo PRE POST '{}')"
check_eq "$out" "PRE POST one two" "Jflag: replacement at custom position"
printf 'aa\0bb cc\0' > nul
out="$(cat nul | $XARGS -0 echo Z:)"
check_eq "$out" "Z: aa bb cc" "0flag: NUL-delimited input"
out="$(printf 'a\nb\n' | $XARGS -L 1 echo LINE:)"
check_eq "$out" "LINE: a
LINE: b" "Lflag: one line per command"
check_exit "exit: bad option exits 1" 1 $XARGS --definitely-not-a-real-option
summary