github.com/xiaq/elvish@v0.12.0/util/camel_to_dashed_test.go (about)

     1  package util
     2  
     3  import "testing"
     4  
     5  var tests = []struct {
     6  	camel string
     7  	want  string
     8  }{
     9  	{"CamelCase", "camel-case"},
    10  	{"camelCase", "-camel-case"},
    11  	{"123", "123"},
    12  	{"你好", "你好"},
    13  }
    14  
    15  func TestCamelToDashed(t *testing.T) {
    16  	for _, test := range tests {
    17  		camel, want := test.camel, test.want
    18  		dashed := CamelToDashed(camel)
    19  		if dashed != want {
    20  			t.Errorf("CamelToDashed(%q) => %q, want %q", camel, dashed, want)
    21  		}
    22  	}
    23  }