(t *testing.T)
| 2201 | } |
| 2202 | |
| 2203 | func TestUnmarshalNullURL(t *testing.T) { |
| 2204 | b := []byte(`null`) |
| 2205 | |
| 2206 | { |
| 2207 | var u URL |
| 2208 | err := json.Unmarshal(b, &u) |
| 2209 | require.NoError(t, err) |
| 2210 | require.Truef(t, isEmptyNonNilURL(u.URL), "`null` literal not properly unmarshaled from JSON as URL, got %#v", u.URL) |
| 2211 | } |
| 2212 | |
| 2213 | { |
| 2214 | var u URL |
| 2215 | err := yaml.Unmarshal(b, &u) |
| 2216 | require.NoError(t, err) |
| 2217 | // UnmarshalYAML is not called when parsing null literal. |
| 2218 | require.Nilf(t, u.URL, "`null` literal not properly unmarshaled from YAML as URL, got %#v", u.URL) |
| 2219 | } |
| 2220 | } |
| 2221 | |
| 2222 | func TestUnmarshalEmptyURL(t *testing.T) { |
| 2223 | b := []byte(`""`) |
nothing calls this directly
no test coverage detected