test: cover imported and nested-imported dotrain resolution#142
Conversation
Adds two RainDocument parse tests exercising @import resolution: - test_parse_imported_dotrain: a dotrain that @imports another whose DotrainV1 meta is stored in the Store keyed by its hash. Asserts the import resolves without problems, the imported dotrain is parsed at depth 1, the importer's own binding stays an owned leaf (import_index -1), and the imported binding merges into the root namespace as an imported leaf (import_index 0) carrying the import hash and the value declared in the imported dotrain. - test_parse_nested_imported_dotrain: a top dotrain @imports a middle dotrain that itself @imports an inner dotrain. Asserts the whole chain resolves cleanly, the import depths are 1 (middle) and 2 (inner) in the nested sequence, and that the transitively imported inner binding is reachable from the top namespace with the inner import hash, which is the defining property of nested import resolution. Closes #98 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 9 minutes and 48 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 We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
cargo clippy with -D clippy::all rejects the needless reference passed to alloy_primitives::hex::encode_prefixed, whose argument is taken by an AsRef<[u8]> generic bound. Pass the owned hash by value in the imported and nested-imported RainDocument parse tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Reviewed 2124d55: approved by maintainer; all checks green, mergeable, CodeRabbit clean, comments current-behavior-only. Merging. |
|
@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment: S/M/L PR Classification Guidelines:This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed. Small (S)Characteristics:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
Adds tests for
@importresolution, including nested imports, per the issue.What
Two
RainDocumentparse tests incrates/dotrain/src/parser/raindocument/mod.rs(the source-organized test module that already houses the parse/import-resolution tests). Imported dotrains are stored asDotrainV1metas in theStore(keyed by keccak256 hash viaset_dotrain) and referenced from the importing dotrain by@<hash>.test_parse_imported_dotrain— a dotrain that@imports another. Asserts:import_depth1;import_index == -1);import_index == 0) carrying the import hash and the value declared in the imported dotrain — discriminating on the merged result, not just that it parsed.test_parse_nested_imported_dotrain— a top dotrain@imports a middle dotrain that itself@imports an inner dotrain. Asserts:Verification
cargo test -p dotrain --lib: 24 passed, 0 failed (the two new tests included).build_imports_namespaces(thecopy_namespaceimport-index argument) makes both new tests fail withleft: -1, right: 0while all pre-existing tests stay green; restoring it makes them pass. Confirms the new tests cover the resolution path and that it was previously uncovered.Test-only; no source/bytecode change.
Closes #98
🤖 Generated with Claude Code