Skip to content

Commit

Permalink
Merge pull request #1279 from Quick/mark_async_sharedExamples_as_unav…
Browse files Browse the repository at this point in the history
…ailable

Mark the async versions of sharedExamples as unavailable.
  • Loading branch information
younata committed Mar 27, 2024
2 parents 26529ff + 2913f79 commit bfdcb55
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Sources/Quick/DSL/AsyncDSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,24 @@ extension AsyncDSLUser {
AsyncWorld.sharedWorld.itBehavesLike(behavior, context: context, file: file, line: line)
}

/**
In the Synchronous DSL, `sharedExamples` offers an untyped way to define
a group of shared examples that can be re-used in several locations using `itBehavesLike`.
In Quick 7, we decided to remove support for `sharedExamples` in the Asynchronous DSL. Please use the typed `Behavior` DSL in place of `sharedExamples`
*/
@available(*, unavailable, message: "sharedExamples is unavailable in Quick's Async DSL. Please migrate to the Behvavior DSL, which offers type-safety for the injected configuration.")
public static func sharedExamples(_ name: String, closure: @escaping () -> Void) {}

/**
In the Synchronous DSL, `sharedExamples` offers an untyped way to define
a group of shared examples that can be re-used in several locations using `itBehavesLike`.
In Quick 7, we decided to remove support for `sharedExamples` in the Asynchronous DSL. Please use the typed `Behavior` DSL in place of `sharedExamples`
*/
@available(*, unavailable, message: "sharedExamples is unavailable in Quick's Async DSL. Please migrate to the Behvavior DSL, which offers type-safety for the injected configuration.")
public static func sharedExamples(_ name: String, closure: @escaping SharedExampleClosure) {}

// MARK: - Pending
/**
Defines an example or example group that should not be executed. Use `pending` to temporarily disable
Expand Down
6 changes: 5 additions & 1 deletion Sources/Quick/DSL/DSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ extension SyncDSLUser {
- parameter closure: A closure containing the examples. This behaves just like an example group defined
using `describe` or `context`--the closure may contain any number of `beforeEach`
and `afterEach` closures, as well as any number of examples (defined using `it`).
- Remark: `sharedExamples` is untyped. Please use ``Behavior`` instead, as it offers type-safety.
*/
public static func sharedExamples(_ name: String, closure: @escaping () -> Void) {
World.sharedWorld.sharedExamples(name) { _ in closure() }
Expand All @@ -64,7 +66,9 @@ extension SyncDSLUser {
using `describe` or `context`--the closure may contain any number of `beforeEach`
and `afterEach` closures, as well as any number of examples (defined using `it`).
The closure takes a SharedExampleContext as an argument. This context is a function
- Remark: `sharedExamples` and the context passed in to it are untyped. Please use ``Behavior`` instead, as it offers type-safety.
The closure takes a ``SharedExampleContext`` as an argument. This context is a function
that can be executed to retrieve parameters passed in via an `itBehavesLike` function.
*/
public static func sharedExamples(_ name: String, closure: @escaping SharedExampleClosure) {
Expand Down

0 comments on commit bfdcb55

Please sign in to comment.