@@ -103,3 +103,44 @@ func TestSetFormattingStyleWithCaseModification(t *testing.T) {
103103 })
104104 }
105105}
106+
107+ func TestGetFormattingStyleOptions (t * testing.T ) {
108+ for name , test := range map [string ]struct {
109+ style string
110+ expectedStyle stringFormatter.FormattingStyle
111+ expectedFirstSymbolCase stringFormatter.CaseSetting
112+ expectedTextCase stringFormatter.CaseSetting
113+ }{
114+ "snake-lower-case-style" : {
115+ style : "snake" ,
116+ expectedStyle : stringFormatter .Snake ,
117+ expectedFirstSymbolCase : stringFormatter .ToLower ,
118+ expectedTextCase : stringFormatter .ToLower ,
119+ },
120+ "snake-upper-case-style" : {
121+ style : "SNAKE" ,
122+ expectedStyle : stringFormatter .Snake ,
123+ expectedFirstSymbolCase : stringFormatter .ToUpper ,
124+ expectedTextCase : stringFormatter .ToUpper ,
125+ },
126+ "kebab-lower-case-style" : {
127+ style : "kebab" ,
128+ expectedStyle : stringFormatter .Kebab ,
129+ expectedFirstSymbolCase : stringFormatter .ToLower ,
130+ expectedTextCase : stringFormatter .ToLower ,
131+ },
132+ "kebab-upper-case-style" : {
133+ style : "KEBAB" ,
134+ expectedStyle : stringFormatter .Kebab ,
135+ expectedFirstSymbolCase : stringFormatter .ToUpper ,
136+ expectedTextCase : stringFormatter .ToUpper ,
137+ },
138+ } {
139+ t .Run (name , func (t * testing.T ) {
140+ actualStyle , actualFirstSymbolCase , actualTextCase := stringFormatter .GetFormattingStyleOptions (test .style )
141+ assert .Equal (t , test .expectedStyle , actualStyle )
142+ assert .Equal (t , test .expectedFirstSymbolCase , actualFirstSymbolCase )
143+ assert .Equal (t , test .expectedTextCase , actualTextCase )
144+ })
145+ }
146+ }
0 commit comments