Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

Extract shared test helpers, simplify integration tests - #1

Merged
joshpollara merged 1 commit into
mainfrom
simplify-tests
May 20, 2026
Merged

Extract shared test helpers, simplify integration tests#1
joshpollara merged 1 commit into
mainfrom
simplify-tests

Conversation

@joshpollara

Copy link
Copy Markdown
Member

Summary

  • Lift duplicated contains/must_contain/must_omit into tests/test_util.ml; remove the 7 verbatim copies.
  • Clean up tests/test_kitchen_sink.ml: trim narrative header, delete WHAT-comments, name shadowed scenario locals, replace ad-hoc tuple destructures with a small omit_in_stdout helper.
  • Tighten two patterns flagged for inefficiency: run now uses Unix.open_process_args_full + Unix.close_process_full (33 → 22 lines, same behavior); test_man_write_all uses Filename.temp_dir and (Unix.stat p).st_size instead of the file-then-mkdir dance and open_in/in_channel_length/close_in.
  • Simplify .github/workflows/ci.yml: drop the single-row matrix scaffold.

Net: +106 / −214 lines.

Test plan

  • dune build clean, zero warnings
  • dune runtest green — 302 tests across 10 suites
  • CI passes on this branch

🤖 Generated with Claude Code

Code reuse:
- New tests/test_util.ml hosts contains, must_contain, must_omit.
- Removed the verbatim-duplicated contains from 7 test files and
  must_contain/must_omit from 2 of them. Each file now opens
  Test_util; call sites are unchanged.

Quality (test_kitchen_sink.ml):
- Trimmed meta-narrative header, deleted WHAT/banner comments.
- Replaced ad-hoc tuple destructure repeats with a small
  omit_in_stdout helper backed by must_omit.
- Renamed scenario-local shadowed `let r` to named bindings.
- flag_count_count -> flag_count; dropped stale /etc/hosts comment.

Efficiency:
- test_kitchen_sink.ml `run`: switched from manual
  create_process_env + pipes + waitpid to open_process_args_full +
  close_process_full (33 -> 22 lines, same behavior).
- test_mamba.ml test_man_write_all: Filename.temp_file + remove +
  mkdir collapsed to Filename.temp_dir; dropped Sys.file_exists
  TOCTOU check; (Unix.stat p).st_size replaces open_in +
  in_channel_length + close_in.

CI:
- Dropped the single-row matrix scaffold; setup-ocaml@v3 handles
  caching automatically.

All 302 tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@joshpollara
joshpollara merged commit 18eaa72 into main May 20, 2026
1 check passed
@joshpollara
joshpollara deleted the simplify-tests branch May 20, 2026 14:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant