From 68024507e8131c890d8dcbdd82cf47718f6ee1fa Mon Sep 17 00:00:00 2001 From: Slug-Boi Date: Tue, 17 Jun 2025 21:28:49 +0200 Subject: [PATCH] test: add new bool to func call --- src/cmd/utils/util_test.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/cmd/utils/util_test.go b/src/cmd/utils/util_test.go index d8a8db7..16f2676 100644 --- a/src/cmd/utils/util_test.go +++ b/src/cmd/utils/util_test.go @@ -166,6 +166,7 @@ func Test_FindAuthorFilePanic(t *testing.T) { os.Setenv("author_file", "") os.Setenv("HOME", "") os.Setenv("XDG_CONFIG_HOME", "") + utils.ConfigVar.Settings.AuthorFile = "" utils.Find_authorfile() } @@ -178,14 +179,10 @@ func Test_FindAuthorFileEnv(t *testing.T) { defer func() { os.Setenv("author_file", originalAuthorFile) - - if r := recover(); r == nil { - t.Errorf("Find_authorfile() did not panic") - } }() - // Set an invalid environment variable to trigger panic - os.Setenv("author_file", "") + os.Setenv("author_file", "author_file_test") + utils.ConfigVar.Settings.AuthorFile = "" utils.Find_authorfile() } @@ -652,7 +649,7 @@ func Test_CommitAppender(t *testing.T) { message := strings.TrimSpace(string(out)) commit := utils.Commit("", authors) - err, appendedMessage := utils.GitCommitAppender(commit, "", nil, true, true) + err, appendedMessage := utils.GitCommitAppender(commit, "", nil, true, true, true) if err != nil { t.Errorf("GitCommitAppender() returned error: %v", err) } @@ -665,7 +662,7 @@ func Test_CommitAppender(t *testing.T) { // check inverted commit authors = []string{"^te"} commit = utils.Commit("", authors) - err, appendedMessage = utils.GitCommitAppender(commit, "", nil, true, true) + err, appendedMessage = utils.GitCommitAppender(commit, "", nil, true, true, true) if err != nil { t.Errorf("GitCommitAppender() returned error: %v", err) } @@ -678,7 +675,7 @@ func Test_CommitAppender(t *testing.T) { // Test CommitAppender with multiple authors authors = []string{"te", "testtest"} commit = utils.Commit("", authors) - err, appendedMessage = utils.GitCommitAppender(commit, "", nil, true, true) + err, appendedMessage = utils.GitCommitAppender(commit, "", nil, true, true, true) if err != nil { t.Errorf("GitCommitAppender() returned error: %v", err) } @@ -690,7 +687,7 @@ func Test_CommitAppender(t *testing.T) { // Test CommitAppender with all authors authors = []string{"all"} commit = utils.Commit("", authors) - err, appendedMessage = utils.GitCommitAppender(commit, "", nil, true, true) + err, appendedMessage = utils.GitCommitAppender(commit, "", nil, true, true, true) if err != nil { t.Errorf("GitCommitAppender() returned error: %v", err) } @@ -704,7 +701,7 @@ func Test_CommitAppender(t *testing.T) { // Test CommitAppender with group authors authors = []string{"gr1"} commit = utils.Commit("", authors) - err, appendedMessage = utils.GitCommitAppender(commit, "", nil, true, true) + err, appendedMessage = utils.GitCommitAppender(commit, "", nil, true, true, true) if err != nil { t.Errorf("GitCommitAppender() returned error: %v", err) }