From fe00d258677e45d1f05473557e57bdfe865370fc Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Sat, 7 Jan 2023 12:06:10 +0100 Subject: [PATCH] Add test for multi-line commit messages --- tests/git-auto-commit.bats | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/git-auto-commit.bats b/tests/git-auto-commit.bats index 9ca1014..179a5c7 100644 --- a/tests/git-auto-commit.bats +++ b/tests/git-auto-commit.bats @@ -1092,3 +1092,23 @@ cat_github_output() { assert_failure; assert_line "::error::git-auto-commit could not find git binary. Please make sure git is available." } + +@test "It creates multi-line commit messages" { + touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt + + COMMIT_MESSAGE=$(cat <<-END + this commit message + has multiple lines +END +) + + INPUT_COMMIT_MESSAGE=$COMMIT_MESSAGE + + run git_auto_commit + + assert_success + + # Assert last commit was signed off + run git log -n 1 + assert_output --partial $COMMIT_MESSAGE +}