@@ -51,22 +51,37 @@ func TestOutStyle(t *testing.T) {
51
51
style string
52
52
envValue string
53
53
message string
54
+ params []interface {}
54
55
want string
55
56
}{
56
- {"happy" , "true" , "This is happy." , "😄 This is happy.\n " },
57
- {"Docker" , "true" , "This is Docker." , "🐳 This is Docker.\n " },
58
- {"option" , "true" , "This is option." , " ▪ This is option.\n " },
59
-
60
- {"happy" , "false" , "This is happy." , "o This is happy.\n " },
61
- {"Docker" , "false" , "This is Docker." , "- This is Docker.\n " },
62
- {"option" , "false" , "This is option." , " - This is option.\n " },
57
+ {"happy" , "true" , "This is happy." , nil , "😄 This is happy.\n " },
58
+ {"Docker" , "true" , "This is Docker." , nil , "🐳 This is Docker.\n " },
59
+ {"option" , "true" , "This is option." , nil , " ▪ This is option.\n " },
60
+ {
61
+ "option" ,
62
+ "true" ,
63
+ "Message with params: %s %s" ,
64
+ []interface {}{"encode '%' signs" , "%s%%%d" },
65
+ " ▪ Message with params: encode '%' signs %s%%%d\n " ,
66
+ },
67
+
68
+ {"happy" , "false" , "This is happy." , nil , "o This is happy.\n " },
69
+ {"Docker" , "false" , "This is Docker." , nil , "- This is Docker.\n " },
70
+ {"option" , "false" , "This is option." , nil , " - This is option.\n " },
71
+ {
72
+ "option" ,
73
+ "false" ,
74
+ "Message with params: %s %s" ,
75
+ []interface {}{"encode '%' signs" , "%s%%%d" },
76
+ " - Message with params: encode '%' signs %s%%%d\n " ,
77
+ },
63
78
}
64
79
for _ , tc := range tests {
65
80
t .Run (tc .style + "-" + tc .envValue , func (t * testing.T ) {
66
81
os .Setenv (OverrideEnv , tc .envValue )
67
82
f := newFakeFile ()
68
83
SetOutFile (f )
69
- if err := OutStyle (tc .style , tc .message ); err != nil {
84
+ if err := OutStyle (tc .style , tc .message , tc . params ... ); err != nil {
70
85
t .Errorf ("unexpected error: %q" , err )
71
86
}
72
87
got := f .String ()
0 commit comments