Add unit tests for two pure helper functions in the self-modification module.
src/loom/agent/self_modify.cljs contains two private helper functions:
parse-test-counts— parses test runner output like "Ran 42 tests containing 100 assertions.\n0 failures, 0 errors." into {:tests-run 42 :assertions 100 :failures 0 :errors 0 :passed? true}parse-shortstat— parses git diff --shortstat output like " 3 files changed, 37 insertions(+), 11 deletions(-)" into {:files-changed 3 :insertions 37 :deletions 11}
These are private (defn-). To test them, either make them public or access via var: (#'loom.agent.self-modify/parse-test-counts ...). Note: in ClojureScript, #' var access may not work for private fns — check if you need to change defn- to defn instead.
- Create
test/loom/self_modify_helpers_test.cljs - Test
parse-test-countswith:- Passing output (0 failures, 0 errors)
- Failing output (2 failures, 1 error)
- Output with no match (garbage string)
- Test
parse-shortstatwith:- Normal output (files, insertions, deletions)
- Only insertions (no deletions)
- Empty/no-match output
- All existing tests must still pass
- New test file compiles and runs
- At least 6 test assertions pass
- Zero regressions in existing tests