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

Feature request: skipping a test from within a test #178

Open
whot opened this issue Jan 8, 2019 · 0 comments
Open

Feature request: skipping a test from within a test #178

whot opened this issue Jan 8, 2019 · 0 comments

Comments

@whot
Copy link
Contributor

whot commented Jan 8, 2019

I'd like something like ck_skip() that skips the currently running test. Usage would be:

START_TEST(foo)
{
    if (!something)
       ck_skip()

   ...
   ck_assert(...)
}
END_TEST

Obviously a simple return has the same effect, but a ck_skip() macro could log/process the skipped test better, e.g. warn if a test was called multiple times but skipped every time.

I admit this is a niche use-case. I'm using check for libinput and the test suite has a slightly peculiar design. We have test uinput devices and the test suite adds each test for each matching test device. So e.g. a touchpad tapping test is called for all touchpad test devices.

But some of those devices have special run-time properties that we don't necessarily know at test setup time. So what I need is the ability to skip from within and some way to access that information afterwards. I want to check if a test was skipped for every test device, because then there's some other bug somewhere. Example again: if I test for right buttons on touchpads, I want to skip this on touchpads that don't have right buttons. But if the test always skips, I either have wrong test devices or something else is buggy.

Not 100% how this would look like from check's perspective though, but let's see if this is something wanted/possible at all. If not, that's fine, I agree that this is a bit of a special case :)

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

Successfully merging a pull request may close this issue.

2 participants