Enable running a concrete test from a test file #523
Merged
Conversation
Add support for specifying test functions directly in the file path: - `path::function_name` - filter by test function name - `path:line_number` - run test containing the specified line Closes #496
JesusValeraDev
approved these changes
Nov 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📚 Description
Enable running a concrete test by specifying the function name or line number directly in the file path, similar to how other testing frameworks (like PHPUnit or pytest) allow targeting specific tests.
This feature adds two new syntaxes:
path::function_name- Filter tests by function name (supports partial matching)path:line_number- Run the test function that contains the specified line🎯 Usage Examples
Run a specific test by function name
Run tests matching a partial name
# Runs all tests containing "spy" in their name ./bashunit tests/unit/test_doubles_test.sh::test_spyRun the test at a specific line number
# Useful when jumping to a test from your editor ./bashunit tests/unit/example_test.sh:42Error handling for invalid line numbers
Traditional filter still works
🔖 Changes
helper::parse_file_path_filter()to extract filter from file pathhelper::find_function_at_line()to resolve line numbers to test functionsmain::cmd_test()to process inline filters from file paths🖼️ Doc
✅ Checklist
CHANGELOG.mdto reflect the new featureCloses #496