A test rule that compares two binary files or two directories.

Similar to bazel-skylib's diff_test but also supports comparing directories.

The rule uses a Bash command (diff) on Linux/macOS/non-Windows, and a cmd.exe command (fc.exe) on Windows (no Bash is required).

Macros and Functions

diff_test

A test that compares two files.

The test succeeds if the files' contents match.

Example usage (generated)

load("@aspect_bazel_lib//lib:diff_test.bzl", "diff_test")

diff_test(
    # The name of the test rule.
    name = "",
    # Label of the file to compare to <code>file2</code>.
    file1 = None,
    # Label of the file to compare to <code>file1</code>.
    file2 = None,
)

name

The name of the test rule.

file1

Label of the file to compare to file2.

file2

Label of the file to compare to file1.

size

standard attribute for tests

timeout

standard attribute for tests. Defaults to "short" if both timeout and size are unspecified.

kwargs

The common attributes for tests.