Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: tml <tarantool-patches@dev.tarantool.org>
Subject: [Tarantool-patches] [PATCH 2/2] box/console: handle empty output format
Date: Wed, 25 Dec 2019 19:08:53 +0300	[thread overview]
Message-ID: <20191225160853.1407-3-gorcunov@gmail.com> (raw)
In-Reply-To: <20191225160853.1407-1-gorcunov@gmail.com>

In case if output format is not specified we should exit
with more readable error message.

Fixes #4638

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/lua/console.lua           | 3 +++
 test/app-tap/console-lua.test.lua | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua
index a4a36c625..17e2c91b2 100644
--- a/src/box/lua/console.lua
+++ b/src/box/lua/console.lua
@@ -126,6 +126,9 @@ end
 
 local function parse_output(value)
     local fmt, opts
+    if not value then
+        return 'Specify output format: lua or yaml.'
+    end
     if value:match("([^,]+),([^,]+)") ~= nil then
         fmt, opts = value:match("([^,]+),([^,]+)")
     else
diff --git a/test/app-tap/console-lua.test.lua b/test/app-tap/console-lua.test.lua
index d3271a369..837e8ea18 100755
--- a/test/app-tap/console-lua.test.lua
+++ b/test/app-tap/console-lua.test.lua
@@ -20,7 +20,7 @@ local EOL = ";"
 
 test = tap.test("console-lua")
 
-test:plan(7)
+test:plan(8)
 
 --
 -- Start console and connect to it
@@ -45,6 +45,12 @@ test:is(client:read(EOL), EOL, "declare array")
 client:write('1,2,nil,a\n')
 test:is(client:read(EOL), '1, 2, box.NULL, {1, 2, 3}' .. EOL, "multireturn numbers")
 
+--
+-- Try to setup empty output mode
+client:write('\\set output\n')
+test:is(client:read(EOL), '\"Specify output format: lua or yaml.\"' .. EOL,
+        "set empty output mode")
+
 --
 -- Disconect from console
 client:shutdown()
-- 
2.20.1

  parent reply	other threads:[~2019-12-25 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-25 16:08 [Tarantool-patches] [PATCH 0/2] box/console: Fixes for 2.3 series Cyrill Gorcunov
2019-12-25 16:08 ` [Tarantool-patches] [PATCH 1/2] box/console: handle multireturn in lua mode Cyrill Gorcunov
2020-01-14  0:54   ` Alexander Turenko
2020-01-14 20:27     ` Cyrill Gorcunov
2019-12-25 16:08 ` Cyrill Gorcunov [this message]
2020-01-09  9:36 ` [Tarantool-patches] [PATCH 0/2] box/console: Fixes for 2.3 series Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191225160853.1407-3-gorcunov@gmail.com \
    --to=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/2] box/console: handle empty output format' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox