Skip to content

Add BATS unit test suite (105 tests)#301

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782412313-add-unit-tests
Open

Add BATS unit test suite (105 tests)#301
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782412313-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The repository had zero test coverage. This PR adds a BATS test suite under tests/ with 105 tests across three test files:

tests/install_extras.bats (47 tests)

Tests install-extras.sh core logic in isolation using temp directories:

  • Argument parsing: all CLI flags (-a/--all/--auto, -r/--remove, -g/--gui, -u/--update), case-insensitive matching, unknown-flag handling
  • REGEX pattern: validates numeric menu choice filtering (^[0-9]+$)
  • runAuto(): copies scriptmodules/ tree to $RP_EXTRA, creates target dir, preserves content, overwrites on re-run
  • removeAll(): removes $RP_EXTRA, handles missing-dir error path
  • copyModule(section/name.sh): creates section dir, copies script + companion data directory when present, skips data dir when absent
  • deleteModule(section/name.sh): removes script + data dir, cascading cleanup of empty section → scriptmodules → RP_EXTRA dirs
  • startCmd(): validates $RPS_HOME exists
  • Round-trip integration: runAutoremoveAll, copyModuledeleteModule with and without data dirs

tests/scriptmodule_validation.bats (40 tests)

Validates all 234 scriptmodule .sh files:

  • Directory structure (4 expected sections, no unexpected dirs)
  • Shebang lines, required metadata (rp_module_id, rp_module_desc, rp_module_section), non-empty values, valid section values
  • No duplicate rp_module_id values across all scripts
  • bash -n syntax check on all scripts + install-extras.sh
  • File permissions (executability of top-level scripts)
  • Section-count sanity checks and data-directory/script-file pairing

Documents pre-existing repo issues as tracked "known issue" tests:

  • golang-1.17.sh: missing shebang
  • lr-bsnes-jg.sh, lr-gearcoleco.sh, lr-bsnes-hd.sh: bash syntax errors
  • supermodel/, openxcom/: shared data dirs used by differently-named scripts

tests/wrapper_scripts.bats (18 tests)

Validates remove-extras.sh, update-extras.sh structure and delegation, plus install-extras.sh function definitions and entry point.

Running

bats tests/

Link to Devin session: https://app.devin.ai/sessions/5d99affc9f404dd39ee9e5eb997160a4
Requested by: @Exarkuniv

Add a BATS-based test suite with 105 tests covering:

- install-extras.sh core functions (runAuto, removeAll, copyModule,
  deleteModule, startCmd, argument parsing, REGEX validation)
- Scriptmodule structure validation (shebangs, required metadata fields,
  syntax checks, directory structure, duplicate ID detection)
- Wrapper script validation (remove-extras.sh, update-extras.sh)

Known pre-existing issues in the repo are documented as tracked tests:
- golang-1.17.sh: missing shebang
- lr-bsnes-jg.sh, lr-gearcoleco.sh, lr-bsnes-hd.sh: syntax errors
- supermodel/, openxcom/: shared data dirs without exact-name scripts

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Exarkuniv Exarkuniv self-assigned this Jun 25, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant