Skip to content

Allow evaluating ConditionTrait programmatically #903

Open
@Uncommon

Description

Description

I'm working on a testing library for writing structured tests like RSpec or Quick, with the intention of making it compatible with Swift Testing and XCTest rather than being a stand-alone framework. Right now I'm looking into whether I can use Swift Testing traits in my library's test elements; being able to just re-use existing traits could be really cool.

At first glance it was promising - Bug for example just contains the properties describing the bug, and then conforms to TestTrait via extension, making it easy to also use for other purposes.

But then there's ConditionTrait, where the Kind enum and kind property are not public, and the logic for evaluating the condition happens in prepare(for:) even though that method doesn't use the given test object. Is there a reason these elements are hidden? Or could they be made public, and the evaluation logic extracted to a separate function? Just the latter would probably be sufficient.

Expected behavior

ContitionTrait can be used/evaluated directly

Actual behavior

Evaluation logic is inaccessible because of non-public members

Steps to reproduce

No response

swift-testing version/commit hash

No response

Swift & OS version (output of swift --version && uname -a)

No response

Metadata

Assignees

Labels

enhancementNew feature or requestpublic-apiAffects public APItools integrationIntegration of swift-testing into tools/IDEs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions