MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / tf_only_init

Function tf_only_init

tests/test_main.c:996–1014  ·  view source on GitHub ↗

Reads the selection once. False means the selection itself is unusable: the * caller stops before any suite, because falling back to "everything" or to * "nothing" would decide a gate by accident. An empty variable is unset, as it * is in a shell; a selection that is set and names no test is an error, since * a caller who wants every test leaves both variables unset. */

Source from the content-addressed store, hash-verified

994 * is in a shell; a selection that is set and names no test is an error, since
995 * a caller who wants every test leaves both variables unset. */
996static bool tf_only_init(void) {
997 const char *list = getenv("CBM_TEST_ONLY");
998 const char *path = getenv("CBM_TEST_ONLY_FILE");
999 bool has_list = list && list[0];
1000 bool has_path = path && path[0];
1001 if (!has_list && !has_path) {
1002 return true;
1003 }
1004 if ((has_list && !tf_only_add_list(list)) || (has_path && !tf_only_add_file(path))) {
1005 return false;
1006 }
1007 if (tf_only_count == 0) {
1008 fprintf(stderr, "test selection names no test (CBM_TEST_ONLY, CBM_TEST_ONLY_FILE)\n");
1009 return false;
1010 }
1011 qsort(tf_only_tokens, tf_only_count, sizeof(*tf_only_tokens), tf_only_compare);
1012 tf_only_active = true;
1013 return true;
1014}
1015
1016/* Returns the first token of `suite` and stores one past its last. */
1017static size_t tf_only_suite_run(const char *suite, size_t *end_out) {

Callers 1

mainFunction · 0.85

Calls 2

tf_only_add_listFunction · 0.85
tf_only_add_fileFunction · 0.85

Tested by

no test coverage detected