Skip to content

Instantly share code, notes, and snippets.

@haleyrc
Created April 3, 2020 17:33
Show Gist options
  • Save haleyrc/c093070d18390d169fd735fe4c45f08c to your computer and use it in GitHub Desktop.
Save haleyrc/c093070d18390d169fd735fe4c45f08c to your computer and use it in GitHub Desktop.
package demo_test
import (
"testing"
"github.com/frazercomputing/f4/demo"
)
func TestToUpper(t *testing.T) {
t.Parallel()
testcases := map[string]struct {
input string
want string
}{
"blank string": {input: "", want: ""},
"all lowercase": {input: "hello", want: "HELLO"},
"mixed case": {input: "hElLO", want: "HELLO"},
"all uppercase": {input: "HELLO", want: "HELLO"},
}
for name, tc := range testcases {
t.Run(name, func(t *testing.T) {
t.Parallel()
got := demo.ToUpper(tc.input)
if got != tc.want {
t.Errorf("demo.ToUpper(%s) = %s, wanted %s", tc.input, got, tc.want)
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment