tarantool / tarantool/tarantool
Wrap tap subtests with pcall
Open
Nobody has claimed this yet.
discussion
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 419
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 88
Description
For example, when we write test:test with subtests, for example:
test:test("Chunked index with filter", function(test)
local res = mock.run( test, 3, 'correct', 'data')
test:is(res.ctl, 'customer', "Controller found")
test:is(#res.index, 1, "Key detected")
test:is(res.filter, "pers_data.name_first", "Filter detected")
end)
If data res is nil, the we'll get exception
[001] +2017-08-30 15:25:13.512 [22183] main/101/single.test.lua F> single.test.lua:100: attempt to index global 'res' (a nil value)
And tests'll be stopped. Better to wrap it with pcall/xpcall, catch exception and provide it (with stacktrace) in tap metadata.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin at the test:test subtest entry point and inspect how TAP metadata is emitted. Reproduce the nil res failure from the example, then trace pcall/xpcall handling and verify that the exception and stack trace are reported as TAP metadata without stopping later subtests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100