From 63f5dd003843ea34f09737140db4656f02a7e9c1 Mon Sep 17 00:00:00 2001 From: Dima Kolesnik Date: Tue, 26 Sep 2023 21:33:44 +0300 Subject: [PATCH] [ISSUE-77] example fixed --- examples/suite_demo/setup_test.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/suite_demo/setup_test.go b/examples/suite_demo/setup_test.go index aea8a0e..9b15cf2 100644 --- a/examples/suite_demo/setup_test.go +++ b/examples/suite_demo/setup_test.go @@ -70,6 +70,14 @@ func (s *SetupSuite) TableTestMyTest(t provider.T, example *Example) { year int ctx context.Context ) + + defer t.WithTestTeardown(func(t provider.T) { + t.WithNewStep("Close ctx", func(sCtx provider.StepCtx) { + ctx.Done() + sCtx.WithNewParameters("ctx", ctx) + }) + }) + t.WithTestSetup(func(t provider.T) { t.WithNewStep("init country", func(sCtx provider.StepCtx) { country = example.country @@ -88,13 +96,6 @@ func (s *SetupSuite) TableTestMyTest(t provider.T, example *Example) { t.Require().NotEqual("PonyCountry", country, "No magic countries in the list") t.Require().NotEqual(2007, year, "No one returned to 2007") t.Require().NotNil(ctx, "Not empty context") - - defer t.WithTestTeardown(func(t provider.T) { - t.WithNewStep("Close ctx", func(sCtx provider.StepCtx) { - ctx.Done() - sCtx.WithNewParameters("ctx", ctx) - }) - }) } func (s *SetupSuite) TestMyOtherTest(t provider.T) {