Add unit + integration tests for clipboard code paths #54
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
akinus/akclip#54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Add real unit and integration tests for the clipboard code so that
cargo testactually exercises the platform-specificget_clipboard_contentandset_clipboard_contentfunctions, plus the env-var-driven code paths insrc/main.rs. Currently the test suite has only placeholder stubs (assert!(true)).What's missing
Looking at the current state:
src/clipboard/mod.rshas a single placeholder test that just assertstrue.src/clipboard/linux.rs,macos.rs, andwindows.rshave no tests at all — the platform modules are completely untested.src/main.rshas a few env-var tests but no tests forprint_help,print_versionactual output, the no-args clipboard-read path, or the command-and-copy-to-clipboard path.Proposed scope
src/clipboard/mod.rs: add a test that verifies the module's public surface compiles per-platform (already there, keep it).src/clipboard/linux.rs(andmacos.rs,windows.rs): add#[cfg(test)]test modules that verify:AKCLIP_GET_CMD/AKCLIP_SET_CMDare unset, the defaultwl-paste/wl-copy(orxclip) paths are tried.AKCLIP_GET_CMD/AKCLIP_SET_CMDare set to a known-good command (e.g.catfor get,truefor set), the env-var path is taken and the function returnsOk.AKCLIP_GET_CMDis set to a command that exits non-zero, the function returnsErr.src/main.rs: add tests that verifyprint_help()andprint_version()produce non-empty output to stdout.AKCLIP_GET_CMD=cat /dev/null,mainexits 0 and prints empty stdout.AKCLIP_GET_CMD=false,mainexits non-zero and prints an error to stderr.Constraints
cargo test --release.AKCLIP_GET_CMD/AKCLIP_SET_CMDenv-var overrides to control behavior in tests.AGENTS.md,.forgejo/workflows/*, orFormula/*.Cargo.tomlversion.Acceptance
cargo test --releaseruns the new tests and they all pass.cargo build --release) continues to pass.Auto-triage: skipping this issue.
Repository directory is empty (no source files exist), so there is no codebase to patch and an AI cannot auto-fix this.
If this is wrong, add the
bugorenhancementlabel and re-comment, or open a PR manually.Auto-triage: skipping this issue.
Repository directory is empty (no source files exist), so there is no codebase to patch and an AI cannot auto-fix this.
If this is wrong, add the
bugorenhancementlabel and re-comment, or open a PR manually.