Atlas › Test

CamelCase

Exact test identity: go.temporal.io/server/common/util/TestConvertPathToCamel/CamelCase

Package
go.temporal.io/server/common/util
Suite / test hierarchy
TestConvertPathToCamel/CamelCase
Test
CamelCase
Introduced at
proto.go ×5 Frontier kind: Joint frontier
Covered ranges
5
Covered lines
18
Covered files
1

Co-introduced tests

4 other tests enter at the same concept.

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/util/proto.go 18 covered LOC · 5 ranges

Open complete file

9 )
10
11 > func ConvertPathToCamel(input string) []string { proto.go
12 > var pathParts []string
13 > for path := range strings.SplitSeq(input, ".") {
14 > // Split by "_" and convert each word to Title Case (CamelCase)
15 > var b strings.Builder
16 > j := 0
17 > for word := range strings.SplitSeq(path, "_") {
18 > if j > 0 {
19 b.WriteString(cases.Title(language.Und).String(strings.ToLower(word)))
20 > } else { proto.go
21 > // lowercase the first letter
22 > if len(word) > 0 {
23 > b.WriteString(strings.ToLower(word[:1]))
24 > if len(word) > 1 {
25 > b.WriteString(word[1:])
26 > }
27 }
28 }
29 > j++ proto.go
30 }
31 // Join the words into a CamelCase substring
32 > pathParts = append(pathParts, b.String()) proto.go
33 }
34 // Join all CamelCase substrings back with "."
35 > return pathParts proto.go
36 }
37