Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowing c3c test -- <args1> #1803

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

alexveden
Copy link

A small improvement for #1774

Allowing custom and default test/bench runners receiving arguments:

fn bool default_test_runner(String[] args)
{
	io::printfn("default_test_runner: %s", args);
	return false;
}
> c3c test --testfn "std::core::test::default_test_runner" -- foo --bar

Program linked to executable 'build/testrun'.
Launching ./build/testrun foo --bar
default_test_runner: [./build/testrun, foo, --bar]

The same behavior is consistent when we do direct run of compiled test runner:

> ./build/testrun foo --bar

default_test_runner: [./build/testrun, foo, --bar]

We might be getting help via:

c3c test -- --help

This will decouple @tests/@benchmark runner logic completely from c3c compiler space into c3 (stdlib space) or custom runner space.

@alexveden
Copy link
Author

A show case how it can work:

~/code/c3test ➜ c3c test --testfn "std::core::test::default_test_runner" -- --help

Program linked to executable 'build/testrun'.
Launching ./build/testrun --help

Usage:
testrun [options]

c3c default test runner

Test options
    -h, --help            show this help message and exit
    -f, --filter=<str>    filter tests by name, e.g. some::test, or some [default: ]
    -b, --breakpoint      emits breakpoint if any assert() is failed [default: false]
    --sort                sort all tests alphabetically by name, --no-sort - preserve natural order [default: true]
    -c, --color           test output with colors [default: false]
Program completed with exit code 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant