(t *testing.T)
| 263 | } |
| 264 | |
| 265 | func TestConfigurationTOML(t *testing.T) { |
| 266 | tomlFile, ferr := os.CreateTemp("", "configuration.toml") |
| 267 | |
| 268 | if ferr != nil { |
| 269 | t.Fatal(ferr) |
| 270 | } |
| 271 | |
| 272 | defer func() { |
| 273 | tomlFile.Close() |
| 274 | time.Sleep(50 * time.Millisecond) |
| 275 | os.Remove(tomlFile.Name()) |
| 276 | }() |
| 277 | |
| 278 | tomlConfigurationContents := ` |
| 279 | DisablePathCorrectionRedirection = true |
| 280 | EnablePathEscape = false |
| 281 | FireMethodNotAllowed = true |
| 282 | EnableOptimizations = true |
| 283 | DisableBodyConsumptionOnUnmarshal = true |
| 284 | TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT" |
| 285 | Charset = "utf-8" |
| 286 | |
| 287 | RemoteAddrHeaders = ["X-Real-Ip", "X-Forwarded-For", "CF-Connecting-IP"] |
| 288 | |
| 289 | [Other] |
| 290 | # Indentation (tabs and/or spaces) is allowed but not required |
| 291 | MyServerName = "Iris: https://github.com/kataras/iris" |
| 292 | |
| 293 | ` |
| 294 | tomlFile.WriteString(tomlConfigurationContents) |
| 295 | filename := tomlFile.Name() |
| 296 | app := New().Configure(WithConfiguration(TOML(filename))) |
| 297 | |
| 298 | c := app.config |
| 299 | |
| 300 | if expected := false; c.DisablePathCorrection != expected { |
| 301 | t.Fatalf("error on TestConfigurationTOML: Expected DisablePathCorrection %v but got %v", expected, c.DisablePathCorrection) |
| 302 | } |
| 303 | |
| 304 | if expected := true; c.DisablePathCorrectionRedirection != expected { |
| 305 | t.Fatalf("error on TestConfigurationTOML: Expected DisablePathCorrectionRedirection %v but got %v", expected, c.DisablePathCorrectionRedirection) |
| 306 | } |
| 307 | |
| 308 | if expected := false; c.EnablePathEscape != expected { |
| 309 | t.Fatalf("error on TestConfigurationTOML: Expected EnablePathEscape %v but got %v", expected, c.EnablePathEscape) |
| 310 | } |
| 311 | |
| 312 | if expected := true; c.EnableOptimizations != expected { |
| 313 | t.Fatalf("error on TestConfigurationTOML: Expected EnableOptimizations %v but got %v", expected, c.EnablePathEscape) |
| 314 | } |
| 315 | |
| 316 | if expected := true; c.FireMethodNotAllowed != expected { |
| 317 | t.Fatalf("error on TestConfigurationTOML: Expected FireMethodNotAllowed %v but got %v", expected, c.FireMethodNotAllowed) |
| 318 | } |
| 319 | |
| 320 | if expected := true; c.DisableBodyConsumptionOnUnmarshal != expected { |
| 321 | t.Fatalf("error on TestConfigurationTOML: Expected DisableBodyConsumptionOnUnmarshal %v but got %v", expected, c.DisableBodyConsumptionOnUnmarshal) |
| 322 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…