From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 18 Jun 2019 19:11:52 +0300 From: Vladimir Davydov Subject: Re: [PATCH v3 4/6] box: export registered functions in box.func folder Message-ID: <20190618161152.gdy2vbl76lzliokc@esperanza> References: <81d7293c993369d7d4e984391c8854bdf5b16818.1560433806.git.kshcherbatov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81d7293c993369d7d4e984391c8854bdf5b16818.1560433806.git.kshcherbatov@tarantool.org> To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org List-ID: On Thu, Jun 13, 2019 at 05:08:24PM +0300, Kirill Shcherbatov wrote: > diff --git a/test/box/function1.result b/test/box/function1.result > index cadeb0467..331bd466a 100644 > --- a/test/box/function1.result > +++ b/test/box/function1.result > @@ -57,6 +57,25 @@ c:call('function1.args', { 15 }) > --- > - [[15, 'hello']] > ... > +box.func["function1.args"] > +--- > +- language: C > + setuid: false > + name: function1.args > + id: 2 > +... > +box.func["function1.args"]:call() > +--- > +- error: Use func:call(...) > +... > +box.func["function1.args"]:call({ "xx" }) > +--- > +- error: first tuple field must be uint > +... > +box.func["function1.args"]:call({ 15 }) > +--- > +- [15, 'hello'] > +... > box.schema.func.drop("function1.args") > --- > ... > @@ -299,3 +318,189 @@ test_run:cmd("setopt delimiter ''"); > c:close() > --- > ... > +-- Test registered functions interface. > +function divide(a, b) return a / b end > +--- > +... > +box.schema.func.create("divide") > +--- > +... > +func = box.func.divide > +--- > +... > +func.call({4, 2}) > +--- > +- error: 'builtin/box/schema.lua:2197: Use func:call(...) instead of func.call(...)' > +... > +func:call(4, 2) > +--- > +- error: 'builtin/box/schema.lua:2212: Use func:call(table)' > +... We'll have to patch this result file every time we update schema.lua. Let's please add a filter. Take a look at how engine/savepoint.test.lua handles it.