diff options
author | Chris Koch <chrisko@google.com> | 2023-02-18 20:31:32 -0800 |
---|---|---|
committer | Chris K <c@chrisko.ch> | 2023-02-19 22:39:16 -0800 |
commit | 336d4b9bd652b2bf0bc1bd0feae3f2f51009c13f (patch) | |
tree | 9c99ebb8f3067a39981d8bea07109fd7e7ba0d17 /dhcpv6/option_domainsearchlist_test.go | |
parent | 1e0fe5ce427973ca92a0dfb1a06a252ddb0dd4be (diff) |
dhcpv6: convert every Parse function to FromBytes
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_domainsearchlist_test.go')
-rw-r--r-- | dhcpv6/option_domainsearchlist_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/dhcpv6/option_domainsearchlist_test.go b/dhcpv6/option_domainsearchlist_test.go index 433f710..c03759c 100644 --- a/dhcpv6/option_domainsearchlist_test.go +++ b/dhcpv6/option_domainsearchlist_test.go @@ -12,7 +12,8 @@ func TestParseOptDomainSearchList(t *testing.T) { 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 3, 'c', 'o', 'm', 0, 6, 's', 'u', 'b', 'n', 'e', 't', 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 3, 'o', 'r', 'g', 0, } - opt, err := parseOptDomainSearchList(data) + var opt optDomainSearchList + err := opt.FromBytes(data) require.NoError(t, err) require.Equal(t, OptionDomainSearchList, opt.Code()) require.Equal(t, 2, len(opt.DomainSearchList.Labels)) @@ -42,6 +43,7 @@ func TestParseOptDomainSearchListInvalidLength(t *testing.T) { 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 3, 'c', 'o', 'm', 0, 6, 's', 'u', 'b', 'n', 'e', 't', 7, 'e', // truncated } - _, err := parseOptDomainSearchList(data) + var opt optDomainSearchList + err := opt.FromBytes(data) require.Error(t, err, "A truncated OptDomainSearchList should return an error") } |