ozontech / allure-go

Complete Allure provider in Go which doesn't overload the interface usage
https://t.me/allure_go_chat
Apache License 2.0
306 stars 33 forks source link

Wrong using defer in example #77

Closed KolesnikDmitriy closed 23 hours ago

KolesnikDmitriy commented 11 months ago

Describe the bug Incorrect example with defer. Require my stops test execution when a test result fails, and defer stack will not fill.

To Reproduce Steps to reproduce the behavior: look through example: https://github.com/ozontech/allure-go/blob/master/examples/suite_demo/setup_test.go#L92

Expected behavior defer should executed right after context declaration

siller174 commented 11 months ago

what is a main idea of this MR?

KolesnikDmitriy commented 11 months ago

The main idea is fix documentation to avoid confusion of newcomers. They may start using defer after t.Require

koodeex commented 11 months ago

In common case it make sense but in that example the reason why defer stay there is to highlight semantic of WithTearDown function

It looks like common sense to me that you need to put it in the begging of Test

Let me think day or two about that

KolesnikDmitriy commented 23 hours ago

fixed in https://github.com/ozontech/allure-go/pull/78