Example #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, utils.UnderscoreToCamelCase(test.in), "%#v", test)
	}
}
Example #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 = utils.UnderscoreToCamelCase("_catalog__product_entity")
	}
}