Move xce_test's 15 production sources + headers from src/controller/testsuite/ into a new src/harness/ component with its own meson.build, and strip every now-dangling controller-side reference (11 controller_unit_test_src entries, 4 standalone test-binary blocks, 11 controller_test.c extern/RUN_TEST lines) so the controller build is never left broken. Fixes a broken relative-symlink bridge (xce_test_controller_link) added to keep two controller-embedded tests (test_test_cli.c, test_xcetest_process_entry.c) finding the relocated xce_test binary until task 2.1 moves them too. Discovered and documented in design.md: four controller-domain regression tests call functions directly from four of xce_test's own files, requiring controller_unit_test to permanently recompile them from src/harness/ — a real dependency neither the original discovery nor design audit caught. controller_unit_test: 1228 Tests 0 Failures 0 Ignored (verified via the Unity binary's own printed summary line, not just meson's aggregate count). Task 1.1 of xce-harness-component. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
59 lines
1 KiB
C
59 lines
1 KiB
C
#include "listfmt_json.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
cJSON* listfmt_json_begin(void)
|
|
{
|
|
return cJSON_CreateArray();
|
|
}
|
|
|
|
void listfmt_json_add_string(cJSON* row, const char* key, const char* val)
|
|
{
|
|
if (!row || !key)
|
|
return;
|
|
|
|
if (val)
|
|
cJSON_AddStringToObject(row, key, val);
|
|
else
|
|
cJSON_AddNullToObject(row, key);
|
|
}
|
|
|
|
void listfmt_json_add_number(cJSON* row, const char* key, double val)
|
|
{
|
|
if (!row || !key)
|
|
return;
|
|
|
|
cJSON_AddNumberToObject(row, key, val);
|
|
}
|
|
|
|
cJSON* listfmt_json_new_row(cJSON* array)
|
|
{
|
|
if (!array)
|
|
return NULL;
|
|
|
|
cJSON* row = cJSON_CreateObject();
|
|
if (!row)
|
|
return NULL;
|
|
|
|
if (!cJSON_AddItemToArray(array, row)) {
|
|
cJSON_Delete(row);
|
|
return NULL;
|
|
}
|
|
|
|
return row;
|
|
}
|
|
|
|
void listfmt_json_finish(cJSON* array)
|
|
{
|
|
if (!array)
|
|
return;
|
|
|
|
char* text = cJSON_Print(array);
|
|
if (text) {
|
|
fputs(text, stdout);
|
|
fputc('\n', stdout);
|
|
cJSON_free(text);
|
|
}
|
|
|
|
cJSON_Delete(array);
|
|
}
|