From 039e5d997abd518b82c62caf3578f59d639164de Mon Sep 17 00:00:00 2001 From: dev-kojo-cmd Date: Sat, 18 Apr 2026 15:41:41 +0000 Subject: [PATCH 1/3] feat: update go workflow --- .github/workflows/ci-cd.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index 77956b1..86b111b 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -1,11 +1,19 @@ name: Test CI/CD Pipeline -on: push +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] jobs: tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: '1.20' - name: Run tests - run: echo "Running tests..." + run: go test -v ./... From 0f598e386642c925521e885939b7c52c1784dd00 Mon Sep 17 00:00:00 2001 From: dev-kojo-cmd Date: Sat, 18 Apr 2026 15:45:14 +0000 Subject: [PATCH 2/3] update go version --- .github/workflows/ci-cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index 86b111b..08b257a 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -12,7 +12,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v6 with: - go-version: '1.20' + go-version: '1.25.4' - name: Run tests run: go test -v ./... From b366ca60b803feb8d2a638ba0a8513c3c924a072 Mon Sep 17 00:00:00 2001 From: dev-kojo-cmd Date: Sat, 18 Apr 2026 15:51:17 +0000 Subject: [PATCH 3/3] feat: add unit tests --- mathops.go | 4 ++++ mathops_test.go | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/mathops.go b/mathops.go index d372526..d9d42fc 100644 --- a/mathops.go +++ b/mathops.go @@ -14,3 +14,7 @@ func Multiply(a, b int) int { func IsEven(n int) bool { return n%2 == 0 } + +func displayName(name string) string { + return "Hello, " + name + "!" +} diff --git a/mathops_test.go b/mathops_test.go index 40191d7..a27c705 100644 --- a/mathops_test.go +++ b/mathops_test.go @@ -66,3 +66,23 @@ func TestIsEven(t *testing.T) { }) } } + +func TestDisplayName(t *testing.T) { + tests := []struct { + name string + input string + want string + }{ + {name: "regular name", input: "Alice", want: "Hello, Alices!"}, + {name: "empty name", input: "", want: "Hello, !"}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := displayName(tt.input) + if got != tt.want { + t.Fatalf("displayName(%q) = %q, want %q", tt.input, got, tt.want) + } + }) + } +}