Skip to content

Adopt underused buttercup facilities in the test suite#4075

Merged
bbatsov merged 1 commit into
masterfrom
buttercup-adoption
Jul 4, 2026
Merged

Adopt underused buttercup facilities in the test suite#4075
bbatsov merged 1 commit into
masterfrom
buttercup-adoption

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 4, 2026

Copy link
Copy Markdown
Member

An audit of the buttercup docs against our usage found a few features worth adopting:

  • assume: environment-dependent specs (libxml rendering, cygwin path translation) now report as skipped with a reason instead of silently asserting a fallback branch. Sample output: CANCELLED !! libxml support is available.
  • Custom matchers (new in test/utils/cider-test-utils.el): :to-have-sent-op collapses the spy-and-pluck plumbing around nREPL request assertions (cider-log-tests' request block shrank by ~40 lines) and names the mismatching key on failure instead of dumping request plists; :to-equal-dict compares nrepl-dicts order-insensitively with key-level failure messages.
  • spy-calls-most-recent over indexed spy-calls-args-for, which breaks when a function gains an earlier internal call.

The hacking guide gains a short conventions section so future tests (and test-writing agents) follow the same patterns. Not adopted, deliberately: ERT-compat should (we're uniformly buttercup), bodyless-it pending specs, :to-be-close-to (no float-sensitive assertions).

An audit against the buttercup docs found features we weren't using:

- assume: environment-dependent specs (libxml, cygwin paths) now report
  as skipped instead of silently asserting a fallback branch.
- Custom matchers in cider-test-utils: :to-have-sent-op collapses the
  spy-and-pluck plumbing around nREPL request assertions and names the
  offending key on failure; :to-equal-dict compares nrepl-dicts
  order-insensitively and reports differing keys.
- spy-calls-most-recent instead of indexed spy-calls-args-for, which
  breaks when a function gains an earlier call.

The hacking guide documents the conventions.
@bbatsov bbatsov merged commit 1a1ca2d into master Jul 4, 2026
12 checks passed
@bbatsov bbatsov deleted the buttercup-adoption branch July 4, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant