Skip to content

Allow @TestState properties be declared inside describe and context #5803

Open
@kasrababaei

Description

@kasrababaei

New Issue Checklist

Feature or Enhancement Proposal

Quick has a property wrapper called TestState which warrants there's no shared state between multiple tests by assigning the wrapped value to nil before each run.

However, the following example would trigger a quick_discouraged_call warning.

class TotoTests: QuickSpec {
   override func spec() {
       describe("foo") {
           @TestState var foo: Foo! = Foo() // <- triggers a warning
           context("bar") {
              @TestState var bar: Bar! = .init() // <- triggers a warning
              it("does something") {
                  bar.toto()
              }
           }
       }
   }
}

That's because the property is getting assigning by calling a function inside a describe/context.

I was wondering if it makes sense to not trigger when a using @TestState property. I can even look into putting up a PR (and appreciate any suggestion that can help me).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIdeas for improvements of existing features and rules.good first issueIssue to be taken up by new contributors yet unfamiliar with the project.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions