Skip to content

Improve the example test(s) in README.md #1778

Description

@dabrahams

Description

The example here that is supposed to demonstrate its “Clear Expressive API” is confusing as heck.

@Test("Continents mentioned in videos", arguments: [
    "A Beach",
    "By the Lake",
    "Camping in the Woods"
])
func mentionedContinents(videoName: String) async throws {
    let videoLibrary = try await VideoLibrary()
    let video = try #require(await videoLibrary.video(named: videoName))
    #expect(video.mentionedContinents.count <= 3)
}

What role does arguments play? After a long while, I guess they are getting passed as video names. If so, active names like “Fonzy Jumps the Shark” would help clarify that. Lastly, are we really testing that there are fewer than 4 continents mentioned in each video? That's an incredibly implausible test, but if you want to use it, the name of the test should be “3 or fewer continents mentioned in videos". Otherwise it sounds like its testing that continents are mentioned in videos, which it does not do! A count of zero would pass the test.

Reproduction

Expected behavior

Example that demonstrates the clarity of the API

Environment

Swift Package Manager - Swift 6.3.3

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🪲 Something isn't workingdocumentation📚 Improvements or additions to documentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions