Skip to content

Instantly share code, notes, and snippets.

@pvinis
Created September 1, 2013 10:52
Show Gist options
  • Select an option

  • Save pvinis/6403704 to your computer and use it in GitHub Desktop.

Select an option

Save pvinis/6403704 to your computer and use it in GitHub Desktop.
package stringcase
import "testing"
func equal(a, b []string) bool {
if len(a) != len(b) {
return false
}
for i, v := range a {
if v != b[i] {
return false
}
}
return true
}
func TestParse(t *testing.T) {
const s, c = "hello-there-dash", Dash
out := []string{"hello", "there", "dash"}
if x := Parse(s, c); equal(x, out) {
t.Errorf("Parse(%v, %v) = %v, want %v", s, c, x, out)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment