Skip to content
Snippets Groups Projects
  • Oleg Chaplashkin's avatar
    98dd8e69
    test: fix import and usage luatest module · 98dd8e69
    Oleg Chaplashkin authored
    After adding the autorequiring luatest [1,2], there is no need to use
    the following approach now:
    
    ```
    local t = require('luatest')
    local g = t.group()
    
    server:exec(function()
        local t = require('luatest') -- duplicate
        t.assert(...)
    end)
    ```
    
    Modern approach looks like:
    
    ```
    local t = require('luatest')
    local g = t.group()
    
    -- `t` already available in the remote server
    server:exec(function() t.assert(...) end)
    
    -- also it works with any variable
    local my_custom_t = require('luatest')
    
    server:exec(function()
        my_custom_t.assert(...) -- already available
    end)
    ```
    
    [1] tarantool/luatest#277
    [2] tarantool/luatest#289
    
    Part of tarantool/luatest#233
    
    NO_DOC=test fix
    NO_TEST=test fix
    NO_CHANGELOG=test fix
    98dd8e69
    History
    test: fix import and usage luatest module
    Oleg Chaplashkin authored
    After adding the autorequiring luatest [1,2], there is no need to use
    the following approach now:
    
    ```
    local t = require('luatest')
    local g = t.group()
    
    server:exec(function()
        local t = require('luatest') -- duplicate
        t.assert(...)
    end)
    ```
    
    Modern approach looks like:
    
    ```
    local t = require('luatest')
    local g = t.group()
    
    -- `t` already available in the remote server
    server:exec(function() t.assert(...) end)
    
    -- also it works with any variable
    local my_custom_t = require('luatest')
    
    server:exec(function()
        my_custom_t.assert(...) -- already available
    end)
    ```
    
    [1] tarantool/luatest#277
    [2] tarantool/luatest#289
    
    Part of tarantool/luatest#233
    
    NO_DOC=test fix
    NO_TEST=test fix
    NO_CHANGELOG=test fix