Skip to content

additional CLI parameters for explicitly specifying an exact set of unit tests to run #13524

@star-tek-mb

Description

@star-tek-mb

Accepted Proposal


Zig version

0.11.0-dev.109+a2e67173d

As today, if we have a source:

test "read" {
...
}

test "read struct" {
...
}

We can't run single test case read with zig test file.zig --test-filter "read". It will run both tests. There is no way to run specific test.

Proposal

Option 1:

--test-filter will use pattern matching (glob or wildcard will be sufficent). For now it uses std.mem.indexOf. It would be breaking change maybe (--test-filter not used in compiler tests i think, only for user code). And will require to write a pattern matching code in stdlib.

Option 2:

Add another option to specify exact test case to run: --test-name or --test-case. It would be non breaking and easy to achieve.

Any ideas welcome.

Option 3

Write simple wildcard matching in src/test.zig, or use reference code. I prefer this option, i can even try open pull request for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThis proposal is planned.enhancementSolving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions