From 55ffac1c334b15c08e153b881f9f2a6fba6c9111 Mon Sep 17 00:00:00 2001 From: Demian Date: Wed, 7 Jul 2021 12:52:28 +0300 Subject: [PATCH] context: clarify --- context.go | 6 +++--- context_test.go | 12 +++++++----- sendable.go | 3 +-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/context.go b/context.go index c51a7ff..f1a54d1 100644 --- a/context.go +++ b/context.go @@ -261,11 +261,11 @@ func (c *nativeContext) Data() string { func (c *nativeContext) Args() []string { if c.message != nil { - message := strings.Trim(c.message.Payload, " ") - if message == "" { + payload := strings.Trim(c.message.Payload, " ") + if payload == "" { return nil } - return strings.Split(message, " ") + return strings.Split(payload, " ") } if c.callback != nil { return strings.Split(c.callback.Data, "|") diff --git a/context_test.go b/context_test.go index 08970e4..d372ec5 100644 --- a/context_test.go +++ b/context_test.go @@ -8,9 +8,11 @@ import ( var _ Context = (*nativeContext)(nil) -func TestContextStore(t *testing.T) { - var c Context - c = new(nativeContext) - c.Set("name", "Jon Snow") - assert.Equal(t, "Jon Snow", c.Get("name")) +func TestContext(t *testing.T) { + t.Run("Get,Set", func(t *testing.T) { + var c Context + c = new(nativeContext) + c.Set("name", "Jon Snow") + assert.Equal(t, "Jon Snow", c.Get("name")) + }) } diff --git a/sendable.go b/sendable.go index 2273d5b..db03a61 100644 --- a/sendable.go +++ b/sendable.go @@ -10,8 +10,7 @@ import ( // Recipient is any possible endpoint you can send // messages to: either user, group or a channel. type Recipient interface { - // Must return legit Telegram chat_id or username - Recipient() string + Recipient() string // must return legit Telegram chat_id or username } // Sendable is any object that can send itself.