mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[project] Lose the battle between tabs & spaces
I'm a tabs guy. I like tabs, it's an elegant way to represent indentation instead of brute-forcing it. But I have to admit that the world seems to be going towards spaces, and tooling tends not to play nice with tabs. So here we go, changing the whole repo to spaces since I'm getting tired of all the inconsistent formatting.
This commit is contained in:
committed by
Justin C. Miller
parent
d36b2d8057
commit
8f529046a9
@@ -51,51 +51,51 @@ pid_t waitpid(pid_t, int *, int);
|
||||
void _exit(int);
|
||||
|
||||
#define START_SUITE(name) \
|
||||
int run_suite_ ##name (void) { \
|
||||
int TEST_RESULTS = 0;
|
||||
int run_suite_ ##name (void) { \
|
||||
int TEST_RESULTS = 0;
|
||||
|
||||
#define END_SUITE \
|
||||
return TEST_RESULTS; \
|
||||
}
|
||||
return TEST_RESULTS; \
|
||||
}
|
||||
|
||||
#define DECLARE_SUITE(name) extern int run_suite_ ##name (void)
|
||||
#define RUN_TEST(name) TEST_RESULTS += test__ ##name();
|
||||
|
||||
#define START_TEST(name) \
|
||||
int test__ ##name (void) { \
|
||||
int TEST_RESULTS = 0;
|
||||
int test__ ##name (void) { \
|
||||
int TEST_RESULTS = 0;
|
||||
|
||||
#define END_TEST \
|
||||
return TEST_RESULTS; \
|
||||
}
|
||||
return TEST_RESULTS; \
|
||||
}
|
||||
|
||||
/* TESTCASE() - generic test */
|
||||
#define TESTCASE( x ) \
|
||||
do { \
|
||||
pid_t pid = fork(); \
|
||||
if ( !pid ) _exit((x) ? 0 : 0xFF); \
|
||||
do { \
|
||||
pid_t pid = fork(); \
|
||||
if ( !pid ) _exit((x) ? 0 : 0xFF); \
|
||||
else { \
|
||||
int __rc = 0; \
|
||||
waitpid(pid, &__rc, 0); \
|
||||
if ( __rc & 0xff00 ) { \
|
||||
TEST_RESULTS += 1; \
|
||||
fprintf( stderr, "FAILED: " __FILE__ ":%s, line %d - %s\n", __func__, __LINE__, #x ); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
int __rc = 0; \
|
||||
waitpid(pid, &__rc, 0); \
|
||||
if ( __rc & 0xff00 ) { \
|
||||
TEST_RESULTS += 1; \
|
||||
fprintf( stderr, "FAILED: " __FILE__ ":%s, line %d - %s\n", __func__, __LINE__, #x ); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* TESTCASE_REQUIRE() - must-pass test; return early otherwise */
|
||||
#define TESTCASE_REQUIRE( x ) \
|
||||
do { \
|
||||
pid_t pid = fork(); \
|
||||
if ( !pid ) _exit((x) ? 0 : 0xFF); \
|
||||
do { \
|
||||
pid_t pid = fork(); \
|
||||
if ( !pid ) _exit((x) ? 0 : 0xFF); \
|
||||
else { \
|
||||
int __rc = 0; \
|
||||
waitpid(pid, &__rc, 0); \
|
||||
if ( __rc & 0xff00 ) { \
|
||||
TEST_RESULTS += 1; \
|
||||
fprintf( stderr, "FAILED: " __FILE__ ":%s, line %d - %s\n", __func__, __LINE__, #x ); \
|
||||
return TEST_RESULTS; \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
int __rc = 0; \
|
||||
waitpid(pid, &__rc, 0); \
|
||||
if ( __rc & 0xff00 ) { \
|
||||
TEST_RESULTS += 1; \
|
||||
fprintf( stderr, "FAILED: " __FILE__ ":%s, line %d - %s\n", __func__, __LINE__, #x ); \
|
||||
return TEST_RESULTS; \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define PRINTF_TEST( expected_rc, expected_string, ... ) do { \
|
||||
TEST_RESULTS += DO_TESTPRINTF(IMPLFILE, __FILE__, __LINE__, expected_rc, expected_string, __VA_ARGS__); \
|
||||
} while (0);
|
||||
TEST_RESULTS += DO_TESTPRINTF(IMPLFILE, __FILE__, __LINE__, expected_rc, expected_string, __VA_ARGS__); \
|
||||
} while (0);
|
||||
|
||||
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define SCANF_TEST( expected_rc, input_string, ... ) do { \
|
||||
TEST_RESULTS += DO_TESTSCANF(IMPLFILE, __FILE__, __LINE__, expected_rc, input_string, __VA_ARGS__); \
|
||||
} while (0);
|
||||
TEST_RESULTS += DO_TESTSCANF(IMPLFILE, __FILE__, __LINE__, expected_rc, input_string, __VA_ARGS__); \
|
||||
} while (0);
|
||||
|
||||
{
|
||||
char buffer[100];
|
||||
|
||||
Reference in New Issue
Block a user