bazelbuild / bazelbuild/bazel-skylib

Proposal for golden output testing rule

Open
#90 9 comments 3 reactions 3 assignees Claimed by @laszlocsomor View on GitHub
P3 type: feature request
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

In #86 it appears the first rule is being added to skylib. Would there be any interest in adding a new rule that does golden comparison? To pick a name let's call it `golden_test`. I propose it is usable in 3 ways:

Literal:

```
golden_test(
name = "content",
src = ":myfile.txt", # Note that this could be the output of a genrule or other target
content = "demonstration content for a test",
)
```

Regexp

```
golden_test(
name = "content",
src = ":myfile.txt", # Note that this could be the output of a genrule or other target
regexp = "demonstration content for a .*",
)
```

Golden file

```
golden_test(
name = "content",
src = ":myfile.txt", # Note that this could be the output of a genrule or other target
golden_file = ":myfile.golden.txt",
)
```

Would there be any interest in adding a rule like this? I believe that almost every rules_x has implemented something like this and consolidating on a single implementation seems like a not terrible idea.

CC: @c-parsons

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.