MCPcopy Index your code
hub / github.com/kataras/iris / TestConfigurationOptions

Function TestConfigurationOptions

configuration_test.go:44–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestConfigurationOptions(t *testing.T) {
45 charset := "MYCHARSET"
46 disableBodyConsumptionOnUnmarshal := true
47 disableBanner := true
48
49 app := New().Configure(WithCharset(charset), WithoutBodyConsumptionOnUnmarshal, WithoutBanner)
50
51 if got := app.config.Charset; got != charset {
52 t.Fatalf("Expected configuration Charset to be: %s but got: %s", charset, got)
53 }
54
55 if got := app.config.DisableBodyConsumptionOnUnmarshal; got != disableBodyConsumptionOnUnmarshal {
56 t.Fatalf("Expected configuration DisableBodyConsumptionOnUnmarshal to be: %#v but got: %#v", disableBodyConsumptionOnUnmarshal, got)
57 }
58
59 if got := app.config.DisableStartupLog; got != disableBanner {
60 t.Fatalf("Expected configuration DisableStartupLog to be: %#v but got: %#v", disableBanner, got)
61 }
62
63 // now check if other default values are set (should be set automatically)
64
65 expected := DefaultConfiguration()
66 expected.Charset = charset
67 expected.DisableBodyConsumptionOnUnmarshal = disableBodyConsumptionOnUnmarshal
68 expected.DisableStartupLog = disableBanner
69
70 has := *app.config
71 if !reflect.DeepEqual(has, expected) {
72 t.Fatalf("Default configuration is not the same after New expected:\n %#v \ngot:\n %#v", expected, has)
73 }
74}
75
76func TestConfigurationOptionsDeep(t *testing.T) {
77 charset := "MYCHARSET"

Callers

nothing calls this directly

Calls 6

WithCharsetFunction · 0.85
FatalfMethod · 0.80
DeepEqualMethod · 0.80
NewFunction · 0.70
DefaultConfigurationFunction · 0.70
ConfigureMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…