Skip to content

Commit a0b80a1

Browse files
committed
chore: get_provider_data @?data_provider
1 parent 4c2f4b8 commit a0b80a1

6 files changed

Lines changed: 12 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Fix asserts on test doubles in subshell
66
- Allow interpolating arguments in data providers output
7+
- Deprecate `# data_provider` in favor of `# @data_provider`
78

89
## [0.19.1](https://github.com/TypedDevs/bashunit/compare/0.19.0...0.19.1) - 2025-05-23
910

src/helpers.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ function helper::get_provider_data() {
159159

160160
data_provider_function=$(\
161161
grep -B 1 "function $function_name()" "$script" |\
162-
grep "# data_provider " |\
163-
sed -E -e 's/\ *# data_provider (.*)$/\1/g'\
162+
grep -E "# *@?data_provider " |\
163+
sed -E -e 's/\ *# *@?data_provider (.*)$/\1/g'\
164164
|| true
165165
)
166166

tests/functional/provider_test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function set_up() {
55
_GLOBAL="aa-bb"
66
}
77

8-
# data_provider provide_multiples_values
8+
# @data_provider provide_multiples_values
99
function test_multiple_values_from_data_provider() {
1010
local first=$1
1111
local second=$2
@@ -17,7 +17,7 @@ function provide_multiples_values() {
1717
echo "aa" "bb"
1818
}
1919

20-
# data_provider provide_single_values
20+
# @data_provider provide_single_values
2121
function test_single_values_from_data_provider() {
2222
local data="$1"
2323

@@ -30,7 +30,7 @@ function provide_single_values() {
3030
echo "three"
3131
}
3232

33-
# data_provider provide_single_value
33+
# @data_provider provide_single_value
3434
function test_single_value_from_data_provider() {
3535
local current_data="$1"
3636

tests/unit/assert_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function test_unsuccessful_fail() {
1111
"$(fail "Failure message")"
1212
}
1313

14-
# data_provider provider_successful_assert_true
14+
# @data_provider provider_successful_assert_true
1515
function test_successful_assert_true() {
1616
# shellcheck disable=SC2086
1717
assert_empty "$(assert_true $1)"
@@ -45,7 +45,7 @@ function test_unsuccessful_assert_true_on_function() {
4545
"$(assert_true "eval return 2")"
4646
}
4747

48-
# data_provider provider_successful_assert_false
48+
# @data_provider provider_successful_assert_false
4949
function test_successful_assert_false() {
5050
# shellcheck disable=SC2086
5151
assert_empty "$(assert_false $1)"

tests/unit/check_os_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function test_detect_osx_os() {
4040
assert_equals "OSX" "$_OS"
4141
}
4242

43-
# data_provider window_linux_variations
43+
# @data_provider window_linux_variations
4444
function test_detect_windows_os() {
4545
local windows_linux="$1"
4646
mock uname echo "$windows_linux"

tests/unit/helpers_test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function fake_provider_data_string() {
123123

124124
function test_get_provider_data() {
125125
# shellcheck disable=SC2317
126-
# data_provider fake_provider_data_string
126+
# @data_provider fake_provider_data_string
127127
function fake_function_get_provider_data() {
128128
return 0
129129
}
@@ -138,7 +138,7 @@ function fake_provider_data_array() {
138138

139139
function test_get_provider_data_array() {
140140
# shellcheck disable=SC2317
141-
# data_provider fake_provider_data_array
141+
# @data_provider fake_provider_data_array
142142
function fake_function_get_provider_data_array() {
143143
return 0
144144
}
@@ -150,7 +150,7 @@ function test_get_provider_data_array() {
150150

151151
function test_get_provider_data_should_returns_empty_when_not_exists_provider_function() {
152152
# shellcheck disable=SC2317
153-
# data_provider not_existing_provider
153+
# @data_provider not_existing_provider
154154
function fake_function_get_not_existing_provider_data() {
155155
return 0
156156
}

0 commit comments

Comments
 (0)