Skip to content

Commit 4c2f4b8

Browse files
committed
docs: adr-004-metadata-prefix
1 parent 4f11e82 commit 4c2f4b8

3 files changed

Lines changed: 46 additions & 6 deletions

File tree

adrs/adr-004-metadata-prefix.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Title: Prefix metadata comments with @
2+
3+
* Status: accepted
4+
* Authors: @Chemaclass
5+
* Date: 2025-05-29
6+
7+
8+
## Context and Problem Statement
9+
10+
Data providers are defined via a special comment `# data_provider`. We want to
11+
clearly differentiate these meta comments from ordinary comments.
12+
13+
## Considered Options
14+
15+
* Keep using `# data_provider` as is.
16+
* Introduce an `@` prefix for special comments while supporting the old syntax.
17+
18+
## Decision Outcome
19+
20+
We decided to prefix the metadata provider directives with `@`,
21+
eg: using `# @data_provider provider_name`.
22+
23+
> The previous form without the prefix is still supported for backward compatibility but is now deprecated.
24+
25+
### Positive Consequences
26+
27+
* Highlights special bashunit directives clearly.
28+
* Allows future directives to consistently use the `@` prefix.
29+
30+
### Negative Consequences
31+
32+
* Projects must eventually update old comments to the new syntax.
33+
34+
## Technical Details
35+
36+
`helper::get_provider_data` now matches both `# @data_provider` and the old
37+
`# data_provider` when locating provider functions.

docs/blog/2024-09-01-release-0-15.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ BASHUNIT_REPORT_HTML=
5151

5252
::: code-group
5353
```bash [example_test.sh]
54-
# data_provider provider_directories
54+
# @data_provider provider_directories
5555
function test_directory_exists() {
5656
local outro=$1
5757
local directory=$2

docs/data-providers.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ Each run is treated as a separate test, so it can pass or fail independently. Pl
1313

1414
A data provider function is specified as follows:
1515

16+
> **Note**: The previous `# data_provider` syntax is still supported but
17+
> deprecated. Prefer using the `@` prefix going forward.
18+
1619
::: code-group
1720
```bash [Example]
18-
# data_provider provider_function_name
21+
# @data_provider provider_function_name
1922
function test_my_test_case() {
2023
...
2124
}
@@ -32,7 +35,7 @@ argument position.
3235

3336
::: code-group
3437
```bash [example_test.sh]
35-
# data_provider fizz_numbers
38+
# @data_provider fizz_numbers
3639
function test_returns_fizz_when_multiple_of_::1::_like_::2::_given() {
3740
# ...
3841
}
@@ -53,7 +56,7 @@ Running example_test.sh
5356

5457
::: code-group
5558
```bash [example_test.sh]
56-
# data_provider provider_directories
59+
# @data_provider provider_directories
5760
function test_directories_exists() {
5861
local dir1=$1
5962
local dir2=$2
@@ -78,7 +81,7 @@ Running example_test.sh
7881

7982
::: code-group
8083
```bash [example_test.sh]
81-
# data_provider provider_directories
84+
# @data_provider provider_directories
8285
function test_directory_exists() {
8386
local directory=$1
8487

@@ -103,7 +106,7 @@ Running example_test.sh
103106

104107
::: code-group
105108
```bash [example_test.sh]
106-
# data_provider provider_directories
109+
# @data_provider provider_directories
107110
function test_directory_exists() {
108111
local outro=$1
109112
local directory=$2

0 commit comments

Comments
 (0)