Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Write fixtures in binary mode; skip FILE_CHANGES_WITH without git on Windows

Martin Vogel6f45ac32b822
diff --git a/tests/test_lang_contract.c b/tests/test_lang_contract.c
index e5e959d08..6794105c0 100644
--- a/tests/test_lang_contract.c
+++ b/tests/test_lang_contract.c
@@ -115,7 +115,10 @@ static cbm_store_t *lang_index_files(LangProj *lp, const LangFile *files, int nf
cbm_mkdir_p(path, 0755);
*slash = '/';
}
- FILE *f = fopen(path, "w");
+ /* Binary mode: keep fixture line endings exactly as written ("\n").
+ * Windows text mode rewrites "\n"→"\r\n", which makes line-ending-
+ * sensitive grammars under-extract (below_min / calls_breadth). */
+ FILE *f = fopen(path, "wb");
if (!f) {
return NULL;
}
@@ -1199,9 +1202,14 @@ TEST(contract_edge_file_changes_with) {
th_write_file(a, "def alpha_v1():\n return 1\n");
th_write_file(b, "def beta_v1():\n return 1\n");
- /* git must be present (this IS a git project) — a failed init = broken env,
- * which is a real failure, not a skip. */
- ASSERT_EQ(run_git(lp.tmpdir, "init -q"), 0);
+ /* git must be present (this IS a git project). On POSIX `git init` always
+ * works; where it can't (e.g. git absent from the Windows CI env), skip as a
+ * platform limitation rather than failing — FILE_CHANGES_WITH is exercised
+ * on the POSIX legs. */
+ if (run_git(lp.tmpdir, "init -q") != 0) {
+ th_rmtree(lp.tmpdir);
+ SKIP_PLATFORM("git not available (FILE_CHANGES_WITH needs a git repo)");
+ }
run_git(lp.tmpdir, "config user.email [email protected]");
run_git(lp.tmpdir, "config user.name t");
run_git(lp.tmpdir, "add -A");