Sha256: db0b0b49bda8a5ebe3a99d5e8d0dbcac73a71908bb18142e873b11226073313c
Contents?: true
Size: 631 Bytes
Versions: 6
Compression:
Stored size: 631 Bytes
Contents
#include <stdio.h> #include <string.h> #include <unistd.h> #include "test_helper.h" #include "<%= name %>.h" static int stderr_copy; static FILE* dev_null = NULL; void setUp() { // Silence error output stderr_copy = dup(fileno(stderr)); dev_null = freopen("/dev/null", "w", stderr); } void tearDown() { if (dev_null) { // Restore error output fflush(stderr); dup2(stderr_copy, fileno(stderr)); close(stderr_copy); } } void test_things_work() { CEXCEPTION_T e = 0; Try { Throw(1); TEST_FAIL_MESSAGE("Should Have Thrown An Error"); } Catch(e) { TEST_ASSERT_EQUAL(1, e); } }
Version data entries
6 entries across 6 versions & 1 rubygems