Merge pull request 'Make 'run' print the command output' (#12) from print-run-output into main
Reviewed-on: https://codeberg.org/svenvanheugten/git-check-assertions/pulls/12
This commit is contained in:
commit
d90e2eebc3
2 changed files with 11 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ run() {
|
||||||
output="$("$@" 2>&1)"
|
output="$("$@" 2>&1)"
|
||||||
status=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
|
printf '%s\n' "$output"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
assert_success() {
|
assert_success() {
|
||||||
|
|
|
||||||
|
|
@ -305,3 +305,13 @@ commit_with_assertion() {
|
||||||
assert_output --partial "Expected output to contain: xyz"
|
assert_output --partial "Expected output to contain: xyz"
|
||||||
assert_output --partial "Actual output: hello"
|
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"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue