Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -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.25.4'
- name: Run tests
run: echo "Running tests..."
run: go test -v ./...


4 changes: 4 additions & 0 deletions mathops.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "!"
}
20 changes: 20 additions & 0 deletions mathops_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}
}
Loading