func TestReverse(t *testing.T) { testCase := []Words{ {"Hello World!", "!dlroW olleH"}, {"Hello Golang", "gnaloG olleH"}, {"", ""}, } for _, c := range testCase { got := stringutil.Reverse(c.in) if got != c.want { t.Errorf("stringutil.Reverse(%q) == %q, want %q", c.in, got, c.want) } } }
/** * Created by Dynastymasra * Name : Dimas Ragil T * Email : [email protected] * LinkedIn : http://www.linkedin.com/in/dynastymasra * Mobile and Backend Developer */ func main() { fmt.Println("Hello World!") fmt.Println(stringutil.Reverse("Hello World!")) }