Created
April 3, 2020 17:33
-
-
Save haleyrc/c093070d18390d169fd735fe4c45f08c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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