Skip to content

test: make reversed screencopy range explicit - #161

Merged
bea4dev merged 1 commit into
bea4dev:mainfrom
marcoallegretti:fix/screencopy-invalid-range-test
Oct 28, 2026
Merged

bea4dev merged 1 commit into
bea4dev:mainfrom
marcoallegretti:fix/screencopy-invalid-range-test

Conversation

@marcoallegretti

Copy link
Copy Markdown
Contributor

Problem

The screencopy regression test added in #160 intentionally constructs an inverted range to verify that invalid buffer bounds are rejected without writing to shared memory.

Writing that case as 7..3 triggers Clippy’s reversed_empty_ranges diagnostic when test targets are checked. This prevents the targeted Clippy validation used by #158 from completing after rebasing onto the current main.

Change

Construct the inverted Range explicitly and name it reversed_range.

The runtime value remains unchanged:

  • start is 7;
  • end is 3;
  • the test still exercises the start > end rejection path;
  • the sentinel pool still verifies that no bytes are written.

This keeps the test’s intent visible without adding a lint allowance.

Verification

  • cargo fmt --all -- --check
  • cargo test -p shojiwm_lib shm_copy_rejects_invalid_ranges --locked
  • cargo clippy -p shojiwm_lib --lib --tests --locked

The combined result with #158 was also checked: its workspace-wide clippy::needless_borrow validation completes successfully once this fix is present.

API impact

No API break.

Only the construction of an intentionally invalid value inside a unit test changes. Production behavior is unaffected.

Follow-up to #160. Unblocks #158.

@marcoallegretti
marcoallegretti marked this pull request as ready for review October 24, 2026 11:46
@bea4dev

bea4dev commented Oct 28, 2026

Copy link
Copy Markdown
Owner

thanks! LGTM!

@bea4dev
bea4dev merged commit 1246f6c into bea4dev:main Oct 28, 2026
5 checks passed
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.

2 participants