Criterion icon indicating copy to clipboard operation
Criterion copied to clipboard

How to test for `exit(EXIT_CODE)`?

Open yuw444 opened this issue 1 year ago • 0 comments

Hi, I like to test for the exit code.

Below is a minimum example

#include <criterion/criterion.h>
#include <stdio.h>

void foo(int a)
{
  if(a == 1) exit(1);
  if(a ==2) exit(2);
  return;
}

how to capture the exit code, such as 1, 2? I have try cr_fail(), cr_exit() without luck.

Thanks

yuw444 avatar May 07 '24 05:05 yuw444