(t *testing.T)
| 1699 | } |
| 1700 | |
| 1701 | func TestUnmarshalNullURL(t *testing.T) { |
| 1702 | b := []byte(`null`) |
| 1703 | |
| 1704 | { |
| 1705 | var u URL |
| 1706 | err := json.Unmarshal(b, &u) |
| 1707 | if err != nil { |
| 1708 | t.Fatal(err) |
| 1709 | } |
| 1710 | if !isEmptyNonNilURL(u.URL) { |
| 1711 | t.Fatalf("`null` literal not properly unmarshaled from JSON as URL, got %#v", u.URL) |
| 1712 | } |
| 1713 | } |
| 1714 | |
| 1715 | { |
| 1716 | var u URL |
| 1717 | err := yaml.Unmarshal(b, &u) |
| 1718 | if err != nil { |
| 1719 | t.Fatal(err) |
| 1720 | } |
| 1721 | if u.URL != nil { // UnmarshalYAML is not called when parsing null literal. |
| 1722 | t.Fatalf("`null` literal not properly unmarshaled from YAML as URL, got %#v", u.URL) |
| 1723 | } |
| 1724 | } |
| 1725 | } |
| 1726 | |
| 1727 | func TestUnmarshalEmptyURL(t *testing.T) { |
| 1728 | b := []byte(`""`) |
nothing calls this directly
no test coverage detected