2025-11-03 15:37:45 +00:00
|
|
|
package poindexter
|
|
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
|
|
func TestVersion(t *testing.T) {
|
|
|
|
|
version := Version()
|
|
|
|
|
if version == "" {
|
|
|
|
|
t.Error("Version should not be empty")
|
|
|
|
|
}
|
2025-11-03 18:51:23 +00:00
|
|
|
if version != "0.3.0" {
|
|
|
|
|
t.Errorf("Expected version 0.3.0, got %s", version)
|
2025-11-03 15:37:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestHello(t *testing.T) {
|
|
|
|
|
tests := []struct {
|
|
|
|
|
name string
|
|
|
|
|
input string
|
|
|
|
|
expected string
|
|
|
|
|
}{
|
|
|
|
|
{"empty name", "", "Hello, World!"},
|
|
|
|
|
{"with name", "Poindexter", "Hello, Poindexter!"},
|
|
|
|
|
{"another name", "Go", "Hello, Go!"},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, tt := range tests {
|
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
|
result := Hello(tt.input)
|
|
|
|
|
if result != tt.expected {
|
|
|
|
|
t.Errorf("Hello(%q) = %q, want %q", tt.input, result, tt.expected)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|