(t *testing.T)
| 208 | } |
| 209 | |
| 210 | func TestLoggerV2PrintFuncAllCombinations(t *testing.T) { |
| 211 | const ( |
| 212 | print int = iota |
| 213 | printf |
| 214 | println |
| 215 | ) |
| 216 | |
| 217 | type testDiscard struct { |
| 218 | discardInf bool |
| 219 | discardWarn bool |
| 220 | discardErr bool |
| 221 | |
| 222 | printType int |
| 223 | formatJSON bool |
| 224 | } |
| 225 | |
| 226 | discardName := func(td testDiscard) string { |
| 227 | strs := []string{} |
| 228 | if td.discardInf { |
| 229 | strs = append(strs, "discardInfo") |
| 230 | } |
| 231 | if td.discardWarn { |
| 232 | strs = append(strs, "discardWarn") |
| 233 | } |
| 234 | if td.discardErr { |
| 235 | strs = append(strs, "discardErr") |
| 236 | } |
| 237 | if len(strs) == 0 { |
| 238 | strs = append(strs, "noDiscard") |
| 239 | } |
| 240 | return strings.Join(strs, " ") |
| 241 | } |
| 242 | var printName = []string{ |
| 243 | print: "print", |
| 244 | printf: "printf", |
| 245 | println: "println", |
| 246 | } |
| 247 | var jsonName = map[bool]string{ |
| 248 | true: "json", |
| 249 | false: "noJson", |
| 250 | } |
| 251 | |
| 252 | discardTests := []testDiscard{} |
| 253 | for _, di := range []bool{true, false} { |
| 254 | for _, dw := range []bool{true, false} { |
| 255 | for _, de := range []bool{true, false} { |
| 256 | for _, pt := range []int{print, printf, println} { |
| 257 | for _, fj := range []bool{true, false} { |
| 258 | discardTests = append(discardTests, testDiscard{discardInf: di, discardWarn: dw, discardErr: de, printType: pt, formatJSON: fj}) |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | for _, discardTest := range discardTests { |
| 266 | testName := fmt.Sprintf("%v %v %v", jsonName[discardTest.formatJSON], printName[discardTest.printType], discardName(discardTest)) |
| 267 | t.Run(testName, func(t *testing.T) { |
nothing calls this directly
no test coverage detected