@@ -67,5 +67,39 @@ func TestSetFormattingStyleWithoutCaseModification(t *testing.T) {
6767}
6868
6969func TestSetFormattingStyleWithCaseModification (t * testing.T ) {
70-
70+ for name , test := range map [string ]struct {
71+ text string
72+ expected string
73+ newStyle stringFormatter.FormattingStyle
74+ firstSymbolCase stringFormatter.CaseSetting
75+ textCase stringFormatter.CaseSetting
76+ }{
77+ "snake-to-kebab-upper-case" : {
78+ text : "my_super_func" ,
79+ expected : "MY-SUPER-FUNC" ,
80+ newStyle : stringFormatter .Kebab ,
81+ firstSymbolCase : stringFormatter .ToUpper ,
82+ textCase : stringFormatter .ToUpper ,
83+ },
84+ "snake-to-camel-starting-from-lower-case" : {
85+ text : "my_super_func" ,
86+ expected : "mySuperFunc" ,
87+ newStyle : stringFormatter .Camel ,
88+ firstSymbolCase : stringFormatter .ToLower ,
89+ textCase : stringFormatter .NoChanges ,
90+ },
91+ "camel-to-upper-case-snake" : {
92+ text : "mySuperFunc" ,
93+ expected : "MY_SUPER_FUNC" ,
94+ newStyle : stringFormatter .Snake ,
95+ firstSymbolCase : stringFormatter .ToUpper ,
96+ textCase : stringFormatter .ToUpper ,
97+ },
98+ } {
99+ t .Run (name , func (t * testing.T ) {
100+ actual := stringFormatter .SetStyle (& test .text , test .newStyle , test .firstSymbolCase ,
101+ test .textCase )
102+ assert .Equal (t , test .expected , actual )
103+ })
104+ }
71105}
0 commit comments