(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func 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 | |
| 76 | func TestConfigurationOptionsDeep(t *testing.T) { |
| 77 | charset := "MYCHARSET" |
nothing calls this directly
no test coverage detected
searching dependent graphs…