From beda22f353be8fedcbba7f4913da0951b126348d Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Fri, 17 Nov 2023 15:43:22 +0800 Subject: [PATCH] chore: use String() instead of fmt.Sprintf --- actor/actor_test.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/actor/actor_test.go b/actor/actor_test.go index c6431157..8d8031b7 100644 --- a/actor/actor_test.go +++ b/actor/actor_test.go @@ -1,7 +1,6 @@ package actor import ( - "fmt" "testing" . "gopkg.in/check.v1" @@ -16,29 +15,29 @@ type IDSuite struct{} var _ = Suite(&IDSuite{}) func (s *IDSuite) TestRootID(c *C) { - c.Assert(fmt.Sprintf("%s", Root()), Equals, "") + c.Assert(Root().String(), Equals, "") } func (s *IDSuite) TestNewChild(c *C) { id1 := root.NewChild("foo") - c.Assert("/foo.0", Equals, fmt.Sprintf("%s", id1)) + c.Assert("/foo.0", Equals, id1.String()) id2 := id1.NewChild("bar") - c.Assert("/foo.0/bar.0", Equals, fmt.Sprintf("%s", id2)) + c.Assert("/foo.0/bar.0", Equals, id2.String()) id3 := id1.NewChild("bar") - c.Assert("/foo.0/bar.1", Equals, fmt.Sprintf("%s", id3)) + c.Assert("/foo.0/bar.1", Equals, id3.String()) id4 := id1.NewChild("bazz") - c.Assert("/foo.0/bazz.0", Equals, fmt.Sprintf("%s", id4)) + c.Assert("/foo.0/bazz.0", Equals, id4.String()) id5 := id4.NewChild("blah") - c.Assert("/foo.0/bazz.0/blah.0", Equals, fmt.Sprintf("%s", id5)) + c.Assert("/foo.0/bazz.0/blah.0", Equals, id5.String()) id6 := root.NewChild("foo") - c.Assert("/foo.1", Equals, fmt.Sprintf("%s", id6)) + c.Assert("/foo.1", Equals, id6.String()) id7 := id6.NewChild("bar") - c.Assert("/foo.1/bar.0", Equals, fmt.Sprintf("%s", id7)) + c.Assert("/foo.1/bar.0", Equals, id7.String()) id8 := id6.NewChild("bar") - c.Assert("/foo.1/bar.1", Equals, fmt.Sprintf("%s", id8)) + c.Assert("/foo.1/bar.1", Equals, id8.String()) id9 := id6.NewChild("bar") - c.Assert("/foo.1/bar.2", Equals, fmt.Sprintf("%s", id9)) + c.Assert("/foo.1/bar.2", Equals, id9.String()) } func (s *IDSuite) TestNewChildEmpty(c *C) {