From 098f235d7c91acf1806d3c9115aedd56056774f4 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 11 Jan 2022 06:06:43 -0800 Subject: [PATCH] docs: add diff_test note to generated_file_test fixes #3184 --- docs/Built-ins.md | 4 ++++ internal/generated_file_test/generated_file_test.bzl | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/Built-ins.md b/docs/Built-ins.md index 1f3289ef00..8cb5846fca 100755 --- a/docs/Built-ins.md +++ b/docs/Built-ins.md @@ -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** diff --git a/internal/generated_file_test/generated_file_test.bzl b/internal/generated_file_test/generated_file_test.bzl index 4f33a7fc1c..39565be947 100644 --- a/internal/generated_file_test/generated_file_test.bzl +++ b/internal/generated_file_test/generated_file_test.bzl @@ -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