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

Function write_temp_file

tests/test_pipeline.c:17843–17865  ·  view source on GitHub ↗

Helper: write a file inside a temp dir */

Source from the content-addressed store, hash-verified

17841
17842/* Helper: write a file inside a temp dir */
17843static void write_temp_file(const char *dir, const char *name, const char *content) {
17844 char path[512];
17845 /* Create subdirectories if needed */
17846 snprintf(path, sizeof(path), "%s/%s", dir, name);
17847 char *slash = strrchr(path, '/');
17848 if (slash) {
17849 char parent[512];
17850 size_t plen = slash - path;
17851 memcpy(parent, path, plen);
17852 parent[plen] = '\0';
17853 cbm_mkdir_p(parent, 0755);
17854 }
17855 /* Binary, matching test_helpers.h/repro_harness.h: text mode turns "\n"
17856 * into "\r\n" on Windows, so the bytes on disk stop matching the source
17857 * string the test hashes or measures -- the semantic-manifest tests
17858 * compare cbm_sha256_hex(string) against the pipeline's hash of this
17859 * file, and the quarantine test compares byte sizes. */
17860 FILE *f = cbm_fopen(path, "wb");
17861 if (f) {
17862 fputs(content, f);
17863 fclose(f);
17864 }
17865}
17866
17867static bool fixture_file_matches(const char *path, const char *expected) {
17868 FILE *file = cbm_fopen(path, "rb");

Callers 15

test_pipeline.cFile · 0.85
cx_order_copy_fixtureFunction · 0.85
incremental_build_keepFunction · 0.85
incremental_compose_editFunction · 0.85
incremental_env_editFunction · 0.85
incremental_image_splitFunction · 0.85
closure_probe_repoFunction · 0.85
stem_repoFunction · 0.85

Calls 2

cbm_mkdir_pFunction · 0.85
cbm_fopenFunction · 0.85

Tested by

no test coverage detected