| 1 | #cxx . . $ `<file>/tests/failure_messages_tests.c`/include <cgreen/cgreen.h>cxx . . $ `<file>/include/cgreen/cgreen.h`/ |
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include <stdlib.h> |
| 5 | #include <unistd.h> |
| 6 | |
| 7 | #ifdef __cplusplus |
| 8 | using namespace cgreen; |
| 9 | #endif |
| 10 | |
| 11 | Describecxx . . $ `include/cgreen/unit.h:12:9`!(FailureMessage); |
| 12 | BeforeEachcxx . . $ `include/cgreen/unit.h:15:9`!(FailureMessage) {} |
| 13 | AfterEachcxx . . $ `include/cgreen/unit.h:18:9`!(FailureMessage) {} |
| 14 | |
| 15 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(FailureMessage, for_time_out_in_only_one_second) { |
| 16 | die_incxx . . $ die_in(cb2f890c2fdad230).(1); |
| 17 | sleepcxx . . $ sleep(2141b656ce2cc063).(10); |
| 18 | } |
| 19 | |
| 20 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(FailureMessage, for_CGREEN_PER_TEST_TIMEOUT) { |
| 21 | // Setting the environment variable here does not work |
| 22 | // It needs to be set before the runner forks |
| 23 | // setenv("CGREEN_PER_TEST_TIMEOUT", "2", true); |
| 24 | // so we leave that to the test environment... |
| 25 | |
| 26 | // And fail if there is no environment variable set |
| 27 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(getenv("CGREEN_PER_TEST_TIMEOUT"), is_not_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:28:9`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)); |
| 28 | sleepcxx . . $ sleep(2141b656ce2cc063).(3); |
| 29 | fail_testcxx . . $ `include/cgreen/assertions.h:34:9`!("This test should have been aborted within CGREEN_PER_TEST_TIMEOUT seconds and not get here. When running this test you need to define CGREEN_PER_TEST_TIMEOUT=2."); |
| 30 | } |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | Ensure(FailureMessage, increments_exception_count_when_throwing) { |
| 34 | throw; |
| 35 | } |
| 36 | #endif |
| 37 |