TypedDevs / bashunit

A simple testing library for bash scripts. Test your bash scripts in the fastest and simplest way, discover the most modern bash testing library.
https://bashunit.typeddevs.com
MIT License
316 stars 27 forks source link

Allow interpolating arguments in data providers output #252

Open Chemaclass opened 4 months ago

Chemaclass commented 4 months ago

When you use providers, the name of the test is printed next to the data used as argument of the provider. For example:

Screenshot 2024-05-20 at 13 22 10

This ⬆️ was done here: https://github.com/TypedDevs/bashunit/issues/203 (tests examples from fizzbuzz-bashunit)

💡 Idea

Allow interpolating these arguments in the names of the tests through some special syntax, for example ::1::, ::2::...

function test_returns_fizz_when_multiple_of_3_like_::1::_given() { ... }
function test_returns_fizz_when_multiple_of_5_like_::1::_given() { ... }
✓ Passed: Returns fizz when multiple of 3 like '3' given
✓ Passed: Returns fizz when multiple of 3 like '6' given
✓ Passed: Returns fizz when multiple of 5 like '5' given
✓ Passed: Returns fizz when multiple of 5 like '10' given