Skip to content

refactor(runner): extract encoded field decoder#657

Merged
Chemaclass merged 1 commit intomainfrom
refactor/runner-extract-encoded-fields
May 3, 2026
Merged

refactor(runner): extract encoded field decoder#657
Chemaclass merged 1 commit intomainfrom
refactor/runner-extract-encoded-fields

Conversation

@Chemaclass
Copy link
Copy Markdown
Member

🤔 Background

Final iter of the run_test slim-down. Three encoded fields (TEST_TITLE, TEST_HOOK_FAILURE, TEST_HOOK_MESSAGE) were each decoded with a near-identical pair of parameter expansions, and TEST_HOOK_FAILURE had to compare against the full result to detect "no key present".

💡 Changes

  • Add bashunit::runner::extract_encoded_field <result> <key> — uses a case match so the absent-key case returns an empty string explicitly
  • Collapse the three decode blocks into three calls
  • Bash 3.0+ compatible (case/esac, no [[ ]], no associative arrays)

Replace three near-duplicate `${result##*##KEY=}` parsing blocks in
`bashunit::runner::run_test` with a single
`bashunit::runner::extract_encoded_field` helper that takes the key
name and returns an empty string when the marker is absent. Bash 3.0+
compatible (`case`/`esac`).
@Chemaclass Chemaclass added the refactoring Refactoring or cleaning related label May 3, 2026
@Chemaclass Chemaclass self-assigned this May 3, 2026
@Chemaclass Chemaclass merged commit 4164409 into main May 3, 2026
30 checks passed
@Chemaclass Chemaclass deleted the refactor/runner-extract-encoded-fields branch May 3, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Refactoring or cleaning related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant