Skip to content

Commit

Permalink
docs: add diff_test note to generated_file_test
Browse files Browse the repository at this point in the history
fixes #3184
  • Loading branch information
alexeagle committed Jan 13, 2022
1 parent 3b3bd5b commit 098f235
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/Built-ins.md
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,10 @@ Tests that a file generated by Bazel has identical content to a file in the work
This is useful for testing, where a "snapshot" or "golden" file is checked in,
so that you can code review changes to the generated output.

Note, for binary files you can just use the `diff_test` rule from bazel-skylib.
See https://github.com/bazelbuild/bazel-skylib/blob/main/docs/diff_test_doc.md
and https://blog.aspect.dev/bazel-can-write-to-the-source-folder


**PARAMETERS**

Expand Down
4 changes: 4 additions & 0 deletions internal/generated_file_test/generated_file_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def generated_file_test(name, generated, src, substring_search = False, src_dbg
This is useful for testing, where a "snapshot" or "golden" file is checked in,
so that you can code review changes to the generated output.
Note, for binary files you can just use the `diff_test` rule from bazel-skylib.
See https://github.com/bazelbuild/bazel-skylib/blob/main/docs/diff_test_doc.md
and https://blog.aspect.dev/bazel-can-write-to-the-source-folder
Args:
name: Name of the rule.
generated: a Label of the output file generated by another rule
Expand Down

0 comments on commit 098f235

Please sign in to comment.