From 495f6757ddf38928df1637cf750a5be95dcc91ec Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Fri, 6 Mar 2026 05:17:56 +0100 Subject: [PATCH] Make 'run' print the command output ```git-check-assertions run test/git-check-assertions.bats assert_success git checkout HEAD~1 bin run test/git-check-assertions.bats assert_failure ``` --- bin/git-check-assertions | 1 + test/git-check-assertions.bats | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/bin/git-check-assertions b/bin/git-check-assertions index b634c09..a30b992 100755 --- a/bin/git-check-assertions +++ b/bin/git-check-assertions @@ -30,6 +30,7 @@ run() { output="$("$@" 2>&1)" status=$? set -e + printf '%s\n' "$output" return 0 } assert_success() { diff --git a/test/git-check-assertions.bats b/test/git-check-assertions.bats index 6a152bd..7d13337 100755 --- a/test/git-check-assertions.bats +++ b/test/git-check-assertions.bats @@ -305,3 +305,13 @@ commit_with_assertion() { assert_output --partial "Expected output to contain: xyz" assert_output --partial "Actual output: hello" } + +@test "run should print command output" { + git checkout -b feature + commit_with_assertion $'run sh -c "echo -n hello; echo -n world"\nassert_success' + + run git-check-assertions + + assert_success + assert_output --partial "helloworld" +}