Skip to content

Find a way to make spec() unnecessary #6

Open
@Uncommon

Description

@Uncommon

The current approach of using the spec() function requires an extra level of nesting in tests, and it would be great to be able to omit it.

Previous approaches:

  • A function body macro that effectively applied the spec() function invisibly. This was effective but not very usable. Function body macros have the inherent difficulty that the function body you see is completely detached from what is executed. Line numbers for test failures or most compile-time errors because useless.
  • A peer macro that could be applied to a function, and would generate the actual test function. The function you apply the macro to had to return ExampleGroup and explicitly use the @ExampleBuilder result builder, so it ended up looking like this:
@Exampale @ExampleBuilder func someExamples() -> ExampleGroup { 
  // various describe/context/it calls
}

All that boilerplate in the function declaration isn't really an improvement over calling spec().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions