Skip to content

Add btt test-tree checking - #158

Open
Maddiaa0 wants to merge 2 commits into
mainfrom
chore/introduce-btt
Open

Maddiaa0 wants to merge 2 commits into
mainfrom
chore/introduce-btt

Conversation

@Maddiaa0

Copy link
Copy Markdown
Member

Adds btt, which checks each test file against a .tree spec that sits next to it. This PR only sets the tool up and adds one example. Trees for the rest of the suite will come in later PRs.

What's included

  • btt.toml, with the vendored Solidity pack in .btt/packs/solidity. btt only ships Rust and TypeScript packs; this one comes from the Solidity example in btt's README, with two changes: test names use a test prefix to match this repo, and scaffolded bodies use revert("unimplemented") because the forge-std version here has no vm.skip.
  • A worked example: test/auth/Owned.tree. The four Owned tests are renamed to match its leaves, and their .gas-snapshot entries are renamed with the gas values unchanged.
  • A btt CI job that installs btt-cli 0.2.0 from crates.io with --locked and runs btt check test.
  • A short "Test trees (btt)" section in the README, and the Claude skill that btt init --skill generates, at .claude/skills/btt/SKILL.md.

How the trees map to tests

  • Foo.tree sits next to Foo.t.sol, and its first line is the test contract name.
  • Each it … leaf is one test: test + the leaf text in PascalCase, e.g. "it lets the owner set a new owner" → testLetsTheOwnerSetANewOwner.
  • Trees are flat, because Solidity can't nest contracts. Put conditions in the leaf text instead of when/given branches.

CI behaviour

Test files without a tree (44 of them for now) are warnings, not errors, so the job passes today. Once every file has a tree, uncovered in btt.toml can be changed to error.

Run it as btt check test, not plain btt check. There's no exclude option, and plain btt check also scans the .t.sol files inside the lib/ submodules.

Testing

  • btt check test: 1 tree file, 44 uncovered, 0 errors.
  • forge test: 580/580 pass.

🤖 Generated with Claude Code

Maddiaa0 and others added 2 commits September 30, 2026 22:49
Set up btt v0.2.0 (branch tree testing): btt.toml, a project-local
lexical Solidity/Foundry pack in .btt/packs/solidity (testX naming, flat
trees), and the Claude skill from `btt init --skill` with a Solidity
section.

Add test/auth/Owned.tree as the worked example and rename the Owned
tests to match it (gas snapshot entries renamed accordingly).

CI installs the pinned v0.2.0 release tarball (sha256-verified) and runs
`btt check test`. Uncovered test files are warnings while adopting.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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