luatest icon indicating copy to clipboard operation
luatest copied to clipboard

Please, provide `tap` fixture or helper

Open unera opened this issue 3 years ago • 1 comments

It would be nice to have tap helper or fixture.

That can help us to migrate from taptest to luatest.

example:

function g.test_foobar()
   tap = g.tap(2, 'Foobar test')   -- plan: 2, name: 'Foobar test'
   tap:ok(bar, 'bar is true')
   tap:eq(baz, baz, 'bar and baz are the same')
end

Or:

function g.test_foobar()
   g.tap.test('Foobar test', function(tap)
       tap:plan(2)
       tap:ok(bar, 'bar is true')
       tap:is(bar, baz, 'bar and baz are the same')
   end)
end

Or even:

function g.taptest_foobar(tap)
    tap:plan(2)
    tap:ok(bar, 'bar is true')
    tap:is(bar, baz, 'bar and baz are the same')
end
  • plan is optional
  • it doesn't need to call tap:check() (the call have to be touched after test callback)
  • it would be nice to have a way to watch full log with tap log inside tests (luatest option or something else)

unera avatar Aug 16 '21 11:08 unera

I'd rephrase the issue: essentially you need a way to rewrite tap tests (in core repo only) with the minimal diff. There're a lot of possibilities to do that. I don't want it to be a part of luatest. No other repos are interested in it. I guess it can be implemented in test helpers, don't make this feature generic.

Examples are ok for me.

rosik avatar Aug 16 '21 13:08 rosik