Skip to content

Add unit tests for actor_types.rs primitive BIF generators (BT-2153)#2178

Merged
jamesc merged 1 commit intomainfrom
BT-2153-actor-types-unit-tests
May 8, 2026
Merged

Add unit tests for actor_types.rs primitive BIF generators (BT-2153)#2178
jamesc merged 1 commit intomainfrom
BT-2153-actor-types-unit-tests

Conversation

@jamesc
Copy link
Copy Markdown
Owner

@jamesc jamesc commented May 8, 2026

Summary

  • Adds 14 unit tests for actor_types.rs primitive BIF generators, covering 4 previously-untested functions: reference_extra, no_extra, generate_future_bif, generate_file_handle_bif, plus pid_extra's fallback arm
  • Uses the established doc_to_string pattern from sibling modules (binary.rs, error_handling.rs)
  • Closes a measured coverage gap: file was at 38.2% line coverage (CI artifact from run 25481488322), with lines 45–108 all at 0 hits

Test plan

  • cargo test -p beamtalk-core -- codegen::core_erlang::primitives::actor_types — 14/14 pass
  • cargo clippy -p beamtalk-core -- -D warnings — clean
  • cargo fmt --package beamtalk-core -- --check — clean

https://linear.app/beamtalk/issue/BT-2153

https://claude.ai/code/session_01Du94UjEjUzQfNe2eiWYpNS


Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Implemented comprehensive unit tests to validate code generation helpers, covering multiple operation scenarios and edge cases to ensure reliability and correctness of generated code output.

…tors BT-2153

reference_extra, no_extra, generate_future_bif, and generate_file_handle_bif
had 0% coverage; pid_extra's fallback arm was also untested. Adds 14
per-selector unit tests using the established doc_to_string pattern,
bringing line coverage from 38% to near-complete for this file.

https://claude.ai/code/session_01Du94UjEjUzQfNe2eiWYpNS
Copilot AI review requested due to automatic review settings May 8, 2026 02:16
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7a6d8b1d-06a3-496a-97aa-82287e9fc8f5

📥 Commits

Reviewing files that changed from the base of the PR and between 5b69068 and fc4a923.

📒 Files selected for processing (1)
  • crates/beamtalk-core/src/codegen/core_erlang/primitives/actor_types.rs

📝 Walkthrough

Walkthrough

Unit tests were added to actor_types.rs verifying the output of five primitive code-generation helper functions. Tests confirm correct dispatch strings for supported selectors ("demonitor", "await", "lines", etc.) and None returns for unsupported selectors. No production code was modified.

Changes

Actor Type Generator Tests

Layer / File(s) Summary
Unit Tests
crates/beamtalk-core/src/codegen/core_erlang/primitives/actor_types.rs
Tests added for pid_extra, reference_extra, no_extra, generate_future_bif, and generate_file_handle_bif functions, asserting correct dispatch strings for supported selectors and None for unsupported ones.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • jamesc/beamtalk#2141: Adds #[cfg(test)] unit tests for other core_erlang primitive BIF/codegen helpers using the same test pattern.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the primary change: adding unit tests for actor_types.rs primitive BIF generators, with the issue identifier included.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch BT-2153-actor-types-unit-tests

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit tests for the Core Erlang primitive BIF generators in actor_types.rs, closing a coverage gap in the beamtalk-core codegen primitives layer.

Changes:

  • Adds a new #[cfg(test)] module with assertions for pid_extra, reference_extra, and no_extra (including unknown-selector fallbacks).
  • Adds unit tests for generate_future_bif covering supported selectors and the unknown-selector fallback.
  • Adds unit tests for generate_file_handle_bif covering supported selectors and the unknown-selector fallback.

@jamesc jamesc merged commit 0883917 into main May 8, 2026
13 checks passed
@jamesc jamesc deleted the BT-2153-actor-types-unit-tests branch May 8, 2026 07: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.

3 participants