Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ Dict mapping error substrings → `(class_name, test_name)` tuples. Runner verif
- `sp_with_segments` now takes a `parts_count` (no NULL-terminated arrays); use `SP_ARRAY_LEN`.
- New functionality goes in `snakepath.h` first; then mirror wrappers in `tests/python_harness/snakepath_lib.c` and `tests/python_harness/snakepath/__init__.py`, plus tests in `tests/test.c` (and `tests/test_fluent_api.c` for fluent parity).
- When API examples change, update `api_demo.c` first, then sync `README.md` and `index.html`, and record any new learnings here.
- Public API call depth is now enforced by `tests/test_call_depth.py` (limit = 3 public frames); keep wrapper chains flat and favor `sp_priv_*` delegation.
- For `"."` behavior, keep `SpPath` canonical as empty (`len == 0`) and let string conversion render `"."`; storing literal `"."` breaks equality/parents semantics.
32 changes: 23 additions & 9 deletions nob.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,25 +251,32 @@ static bool build_python_lib(Compiler compiler, Nob_Procs *procs) {
}

/* Run Python tests */
static bool run_python_tests(void) {
Nob_Cmd cmd = {0};

/* Find Python interpreter */
static const char *find_python(void) {
const char *python = NULL;
#ifdef _WIN32
python = "python";
#else
/* Try common Python names */
if (nob_file_exists("/usr/bin/python3")) {
python = "python3";
} else if (nob_file_exists("/usr/bin/python")) {
python = "python";
} else {
/* Try PATH */
python = "python3";
}
#endif
return python;
}

static bool run_call_depth_tests(void) {
Nob_Cmd cmd = {0};
const char *python = find_python();
nob_cmd_append(&cmd, python, "tests/test_call_depth.py", "snakepath.h", "3");
return nob_cmd_run(&cmd);
}

static bool run_python_tests(void) {
Nob_Cmd cmd = {0};
const char *python = find_python();
nob_cmd_append(&cmd, python, "tests/python_harness/run_cpython_tests.py");
return nob_cmd_run(&cmd);
}
Expand Down Expand Up @@ -459,15 +466,22 @@ int main(int argc, char **argv) {
}
procs.count = 0;

/* Phase 3: Python tests */
/* Phase 3: Public call-depth tests */
LOG_INFO( "=== Running call-depth tests ===");
if (!run_call_depth_tests()) {
nob_log(NOB_ERROR, "Call-depth tests failed");
all_ok = false;
}

/* Phase 4: Python tests */
LOG_INFO( "=== Running Python tests ===");
if (!run_python_tests()) {
nob_log(NOB_ERROR, "Python tests failed");
all_ok = false;
}

#ifndef _WIN32
/* Phase 4: Valgrind (must be sequential, slow) */
/* Phase 5: Valgrind (must be sequential, slow) */
if (all_ok) {
LOG_INFO( "=== Running valgrind ===");
if (!run_valgrind("./tests/test_gcc")) {
Expand All @@ -477,7 +491,7 @@ int main(int argc, char **argv) {
}
#endif

/* Phase 5: Run demo to show it works */
/* Phase 6: Run demo to show it works */
LOG_INFO( "=== Running demo ===");
if (!run_test_async(demo_output, NULL)) {
nob_log(NOB_ERROR, "Demo failed");
Expand Down
Loading