From 6539e106ea55e534d7afcc04df6828c7de9d4e8f Mon Sep 17 00:00:00 2001 From: Pablo Mazzini Date: Fri, 3 Aug 2018 11:09:40 +0200 Subject: OptTFTPServerName: fix String() --- dhcpv4/option_tftp_server_name.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dhcpv4/option_tftp_server_name.go') diff --git a/dhcpv4/option_tftp_server_name.go b/dhcpv4/option_tftp_server_name.go index b4029e1..886208d 100644 --- a/dhcpv4/option_tftp_server_name.go +++ b/dhcpv4/option_tftp_server_name.go @@ -28,7 +28,7 @@ func (op *OptTFTPServerName) Length() int { } func (op *OptTFTPServerName) String() string { - return fmt.Sprintf("OptTFTPServerName{TFTPServerName=%s}", op.TFTPServerName) + return fmt.Sprintf("TFTP Server Name -> %v", op.TFTPServerName) } // ParseOptTFTPServerName returns a new OptTFTPServerName fomr a byte stream or error if any -- cgit v1.2.3 From 0edcc4a6721ffa792bbdc095134ac77e473510ee Mon Sep 17 00:00:00 2001 From: Pablo Mazzini Date: Fri, 3 Aug 2018 11:44:57 +0200 Subject: OptTFTPServerName and OptBootfileName test String --- dhcpv4/option_bootfile_name.go | 2 +- dhcpv4/option_bootfile_name_test.go | 5 +++++ dhcpv4/option_tftp_server_name.go | 2 +- dhcpv4/option_tftp_server_name_test.go | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) (limited to 'dhcpv4/option_tftp_server_name.go') diff --git a/dhcpv4/option_bootfile_name.go b/dhcpv4/option_bootfile_name.go index 5f1020a..ca9317b 100644 --- a/dhcpv4/option_bootfile_name.go +++ b/dhcpv4/option_bootfile_name.go @@ -28,7 +28,7 @@ func (op *OptBootfileName) Length() int { } func (op *OptBootfileName) String() string { - return fmt.Sprintf("Bootfile Name -> %v", op.BootfileName) + return fmt.Sprintf("Bootfile Name -> %s", op.BootfileName) } diff --git a/dhcpv4/option_bootfile_name_test.go b/dhcpv4/option_bootfile_name_test.go index 1f66807..0c7c200 100644 --- a/dhcpv4/option_bootfile_name_test.go +++ b/dhcpv4/option_bootfile_name_test.go @@ -58,3 +58,8 @@ func TestParseOptBootfileNameShortLength(t *testing.T) { require.NoError(t, err) require.Equal(t, []byte("linu"), opt.BootfileName) } + +func TestOptBootfileNameString(t *testing.T) { + o := OptBootfileName{BootfileName: []byte("testy test")} + require.Equal(t, "Bootfile Name -> testy test", o.String()) +} diff --git a/dhcpv4/option_tftp_server_name.go b/dhcpv4/option_tftp_server_name.go index 886208d..19dde21 100644 --- a/dhcpv4/option_tftp_server_name.go +++ b/dhcpv4/option_tftp_server_name.go @@ -28,7 +28,7 @@ func (op *OptTFTPServerName) Length() int { } func (op *OptTFTPServerName) String() string { - return fmt.Sprintf("TFTP Server Name -> %v", op.TFTPServerName) + return fmt.Sprintf("TFTP Server Name -> %s", op.TFTPServerName) } // ParseOptTFTPServerName returns a new OptTFTPServerName fomr a byte stream or error if any diff --git a/dhcpv4/option_tftp_server_name_test.go b/dhcpv4/option_tftp_server_name_test.go index caddf95..812210f 100644 --- a/dhcpv4/option_tftp_server_name_test.go +++ b/dhcpv4/option_tftp_server_name_test.go @@ -58,3 +58,8 @@ func TestParseOptTFTPServerNameShortLength(t *testing.T) { require.NoError(t, err) require.Equal(t, []byte("linu"), opt.TFTPServerName) } + +func TestOptTFTPServerNameString(t *testing.T) { + o := OptTFTPServerName{TFTPServerName: []byte("testy test")} + require.Equal(t, "TFTP Server Name -> testy test", o.String()) +} -- cgit v1.2.3