Go newbie here, I have written a simple main_test.go file to run some test cases for main.go, when I run go test it says testing: warning: no tests to run
PASS
ok Solution 0.878s
my main.go:
package main
func normalizePhoneNum(phoneNumber string) string {
return ""
}
func main() {
}
main_test.go:
package main
import (
"testing"
)
func testNormalizePhoneNum(t *testing.T) {
testCase := []struct {
input string
output string
}{
{"1234567890", "1234567890"},
{"123 456 7891", "123 456 7891"},
{"(123) 456 7892", "(123) 456 7892"},
{"(123) 456-7893", "(123) 456-7893"},
{"123-456-7894", "123-456-7894"},
{"123-456-7890", "123-456-7890"},
{"1234567892", "1234567892"},
{"(123)456-7892", "(123)456-7892"},
}
for _, tc := range testCase {
t.Run(tc.input, func(t *testing.T) {
actual := normalizePhoneNum(tc.input)
if actual != tc.output {
t.Errorf("for %s: got %s, expected %s", tc.input, actual, tc.output)
}
})
}
}
Can anyone please tell, why it's not running the test cases?