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

Function TestConfigurationStatic

configuration_test.go:14–42  ·  view source on GitHub ↗

$ go test -v -run TestConfiguration*

(t *testing.T)

Source from the content-addressed store, hash-verified

12// $ go test -v -run TestConfiguration*
13
14func TestConfigurationStatic(t *testing.T) {
15 def := DefaultConfiguration()
16
17 app := New()
18 afterNew := *app.config
19
20 if !reflect.DeepEqual(def, afterNew) {
21 t.Fatalf("Default configuration is not the same after New expected:\n %#v \ngot:\n %#v", def, afterNew)
22 }
23
24 afterNew.Charset = "changed"
25
26 if reflect.DeepEqual(def, afterNew) {
27 t.Fatalf("Configuration should be not equal, got: %#v", afterNew)
28 }
29
30 app = New().Configure(WithConfiguration(Configuration{DisableBodyConsumptionOnUnmarshal: true}))
31
32 afterNew = *app.config
33
34 if !app.config.DisableBodyConsumptionOnUnmarshal {
35 t.Fatalf("Passing a Configuration field as Option fails, expected DisableBodyConsumptionOnUnmarshal to be true but was false")
36 }
37
38 app = New() // empty , means defaults so
39 if !reflect.DeepEqual(def, *app.config) {
40 t.Fatalf("Default configuration is not the same after New expected:\n %#v \ngot:\n %#v", def, *app.config)
41 }
42}
43
44func TestConfigurationOptions(t *testing.T) {
45 charset := "MYCHARSET"

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…