Portable tst suites (awk trim instead of GNU tac) for macOS compatibility
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,7 @@ bold=$'\033[1m'
|
||||
reset=$'\033[0m'
|
||||
|
||||
# strip leading/trailing blank lines and surrounding whitespace
|
||||
trim() { sed -e 's/[[:space:]]*$//' | sed -e '/./,$!d' | tac | sed -e '/./,$!d' | tac; }
|
||||
trim() { awk '{ sub(/[ \t\r]+$/, "") } { line[NR]=$0 } END { f=1; while (f<=NR && line[f]=="") f++; l=NR; while (l>=1 && line[l]=="") l--; for (i=f;i<=l;i++) print line[i] }'; }
|
||||
|
||||
# check_eq TEST_NAME EXPECTED KTEXT_ARGS...
|
||||
# Runs ktext, expects exit status 0, and compares trimmed stdout to EXPECTED.
|
||||
|
||||
Reference in New Issue
Block a user