[PATCH v3 4/6] box: export registered functions in box.func folder

Vladimir Davydov vdavydov.dev at gmail.com
Tue Jun 18 19:11:52 MSK 2019


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.



More information about the Tarantool-patches mailing list