Exemplo n.º 1
0
func TestUnderscoreToCamelCase(t *testing.T) {
	tests := []struct {
		in  string
		out string
	}{
		{"catalog_product_entity", "CatalogProductEntity"},
		{"_catalog__product_entity", "CatalogProductEntity"},
		{"catalog_____product_entity_", "CatalogProductEntity"},
	}
	for _, test := range tests {
		assert.Equal(t, test.out, util.UnderscoreToCamelCase(test.in), "%#v", test)
	}
}
Exemplo n.º 2
0
// BenchmarkUnderscoreToCamelCase-4    	 1000000	      1457 ns/op	     192 B/op	       6 allocs/op
func BenchmarkUnderscoreToCamelCase(b *testing.B) {
	b.ReportAllocs()
	for i := 0; i < b.N; i++ {
		benchCases = util.UnderscoreToCamelCase("_catalog__product_entity")
	}
}