diff --git a/CHANGELOG.md b/CHANGELOG.md index b7239cdd..03777d97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - `--jobs auto` / `-j auto` caps parallel concurrency at the CPU core count (portable across Linux/macOS/BSD); the default stays unlimited (#766) ### Changed +- Faster test runs: listing all defined functions uses the `compgen -A function` builtin instead of forking `declare -F | awk` (three call sites; 5 -> 3 `awk` forks per test file). No behaviour change - Faster test runs: ordering a file's test functions by definition line is pure bash now instead of an `awk | sort | awk` pipeline that ran twice per file, and the duplicate-function check sorts its (usually empty) result inside awk instead of piping through `sort` (9 -> 5 forks per test file). No behaviour change - Faster failure rendering: the "Source:" assert-line context of a failing test reads the test-function body in a single pass instead of forking `sed` per line and `grep` per line to find the closing brace (a 20-line body dropped from ~46 to ~2 forks here). No behaviour change - Faster test runs: each test's subshell result payload is emitted with `printf` (a builtin) instead of a `cat <> \"$count_file\"" + echo "exec \"$real_awk\" \"\$@\"" + } >"$dir/awk" + chmod +x "$dir/awk" + + local fixture="$dir/awk_budget_test.sh" + printf 'function test_ok() { assert_true true; }\n' >"$fixture" + + PATH="$dir:$PATH" ./bashunit --no-parallel "$fixture" >/dev/null 2>&1 + + local awk_forks=0 + if [ -f "$count_file" ]; then + awk_forks="$(grep -c . "$count_file" || true)" + fi + + assert_less_or_equal_than 3 "$awk_forks" +}