From 8257ab096aa04b3e281f80372d3d10dbf2c47e3f Mon Sep 17 00:00:00 2001 From: Allen Madsen Date: Wed, 25 Mar 2015 19:39:05 -0400 Subject: [PATCH] Fix (*Ulimit).String() function. Closes #11769. Signed-off-by: Allen Madsen --- ulimit/ulimit.go | 2 +- ulimit/ulimit_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ulimit/ulimit.go b/ulimit/ulimit.go index 2375315..eb2ae4e 100644 --- a/ulimit/ulimit.go +++ b/ulimit/ulimit.go @@ -102,5 +102,5 @@ func (u *Ulimit) GetRlimit() (*Rlimit, error) { } func (u *Ulimit) String() string { - return fmt.Sprintf("%s=%s:%s", u.Name, u.Soft, u.Hard) + return fmt.Sprintf("%s=%d:%d", u.Name, u.Soft, u.Hard) } diff --git a/ulimit/ulimit_test.go b/ulimit/ulimit_test.go index 419b5e0..593918a 100644 --- a/ulimit/ulimit_test.go +++ b/ulimit/ulimit_test.go @@ -39,3 +39,10 @@ func TestParseInvalidValueType(t *testing.T) { t.Fatal("expected error on bad value type") } } + +func TestStringOutput(t *testing.T) { + u := &Ulimit{"nofile", 1024, 512} + if s := u.String(); s != "nofile=512:1024" { + t.Fatal("expected String to return nofile=512:1024, but got", s) + } +}