Skip to content

Add LibParseMeta.lookupWord unit test#534

Open
thedavidmeister wants to merge 4 commits into
mainfrom
2026-06-14-issue-249
Open

Add LibParseMeta.lookupWord unit test#534
thedavidmeister wants to merge 4 commits into
mainfrom
2026-06-14-issue-249

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Adds a direct unit test for LibParseMeta.lookupWord (defined in the rain-interpreter-interface dependency and consumed by the rainlang parser via LibParse/BaseRainlangSubParser). The test covers both paths with discriminating assertions:

  • Hit path: builds meta from known words via LibGenParseMeta.buildParseMetaV2, looks each up, asserts exists == true and the exact returned opcode index matches the authoring position.
  • Miss path: looks up words not built into the meta, asserts exists == false and index == 0.

Tests:

  • testLibParseMetaLookupWordKnown — three known words resolve to indices 0/1/2.
  • testLibParseMetaLookupWordNotFound — an absent word is not found, index 0.
  • testLibParseMetaLookupWordSingleDepth — single word at depth 1 found at index 0; unrelated word not found.
  • testLibParseMetaLookupWordRoundtripFuzz — fuzzed words round-trip to their indices; an unrelated word is not found.

Placed at test/src/lib/parse/LibParseMeta.lookupWord.t.sol, mirroring the LibParseMeta import path per the source-organized test convention.

Mutation-validated: forcing the hit return to (true, 0) fails the index assertions (Known, RoundtripFuzz); forcing the bit-not-set miss return to (true, 0) fails the found-flag assertions (NotFound, SingleDepth, RoundtripFuzz). Restored to baseline, all 4 tests green. Test-only change; no source/bytecode change.

Closes #249

🤖 Generated with Claude Code

Adds a direct unit test for LibParseMeta.lookupWord covering both the
hit path (word found, exact opcode index returned) and the miss path
(word not found, found-flag false and index zero). Meta is built via
LibGenParseMeta.buildParseMetaV2 from AuthoringMetaV2 words, matching how
the rainlang parser consumes lookupWord.

Closes #249

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Jun 14, 2026
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@thedavidmeister, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 45 minutes and 38 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c36c73e4-c117-41e0-ba11-6e8b273013a5

📥 Commits

Reviewing files that changed from the base of the PR and between b3d5081 and 10d48b4.

📒 Files selected for processing (37)
  • test/src/abstract/BaseRainlangExtern.construction.t.sol
  • test/src/abstract/BaseRainlangExtern.ierc165.t.sol
  • test/src/abstract/BaseRainlangExtern.integrityOpcodeRange.t.sol
  • test/src/abstract/BaseRainlangSubParser.ierc165.t.sol
  • test/src/abstract/BaseRainlangSubParser.subParseLiteral2.t.sol
  • test/src/abstract/BaseRainlangSubParser.subParseWord2.t.sol
  • test/src/abstract/ChildRainlangExtern.sol
  • test/src/abstract/ChildRainlangSubParser.sol
  • test/src/abstract/EmptyPointersExtern.sol
  • test/src/abstract/EmptyWordParsersSubParser.sol
  • test/src/abstract/HappyPathLiteralSubParser.sol
  • test/src/abstract/MismatchedExternMoreIntegrity.sol
  • test/src/abstract/MismatchedExternMoreOpcodes.sol
  • test/src/abstract/MismatchedLiteralSubParser.sol
  • test/src/abstract/MismatchedWordSubParser.sol
  • test/src/abstract/NoMatchLiteralSubParser.sol
  • test/src/abstract/TestableExtern.sol
  • test/src/abstract/TwoOpExtern.sol
  • test/src/concrete/MockExternBadLiteralIndex.sol
  • test/src/concrete/ModifierTestParser.sol
  • test/src/concrete/RainlangInterpreter.zeroFunctionPointers.t.sol
  • test/src/concrete/RainlangParser.parseMemoryOverflow.t.sol
  • test/src/concrete/RainlangReferenceExtern.subParserIndexOutOfBounds.t.sol
  • test/src/concrete/ZeroFPRainlangInterpreter.sol
  • test/src/lib/integrity/IntegrityHighwater.sol
  • test/src/lib/integrity/IntegritySingleOp.sol
  • test/src/lib/integrity/LibIntegrityCheck.t.sol
  • test/src/lib/parse/BadLengthSubParser.sol
  • test/src/lib/parse/ConstantReturningSubParser.sol
  • test/src/lib/parse/ContextReturningSubParser.sol
  • test/src/lib/parse/LibParseMeta.lookupWord.t.sol
  • test/src/lib/parse/LibSubParse.badSubParserResult.t.sol
  • test/src/lib/parse/LibSubParse.constantAccumulation.t.sol
  • test/src/lib/parse/LibSubParse.subParseWords.t.sol
  • test/src/lib/parse/MultiConstantSubParser.sol
  • test/src/lib/state/LibInterpreterStateDataContract.t.sol
  • test/src/lib/state/LibInterpreterStateDataContractExtern.sol
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-06-14-issue-249

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

test for lookupWord in parse meta

1 participant