xref: /aosp_15_r20/external/bazel-skylib/docs/diff_test_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1*bcb5dc79SHONG Yifan<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2*bcb5dc79SHONG Yifan
3*bcb5dc79SHONG YifanA test rule that compares two binary files.
4*bcb5dc79SHONG Yifan
5*bcb5dc79SHONG YifanThe rule uses a Bash command (diff) on Linux/macOS/non-Windows, and a cmd.exe
6*bcb5dc79SHONG Yifancommand (fc.exe) on Windows (no Bash is required).
7*bcb5dc79SHONG Yifan
8*bcb5dc79SHONG Yifan<a id="diff_test"></a>
9*bcb5dc79SHONG Yifan
10*bcb5dc79SHONG Yifan## diff_test
11*bcb5dc79SHONG Yifan
12*bcb5dc79SHONG Yifan<pre>
13*bcb5dc79SHONG Yifandiff_test(<a href="#diff_test-name">name</a>, <a href="#diff_test-file1">file1</a>, <a href="#diff_test-file2">file2</a>, <a href="#diff_test-failure_message">failure_message</a>, <a href="#diff_test-kwargs">kwargs</a>)
14*bcb5dc79SHONG Yifan</pre>
15*bcb5dc79SHONG Yifan
16*bcb5dc79SHONG YifanA test that compares two files.
17*bcb5dc79SHONG Yifan
18*bcb5dc79SHONG YifanThe test succeeds if the files' contents match.
19*bcb5dc79SHONG Yifan
20*bcb5dc79SHONG Yifan
21*bcb5dc79SHONG Yifan**PARAMETERS**
22*bcb5dc79SHONG Yifan
23*bcb5dc79SHONG Yifan
24*bcb5dc79SHONG Yifan| Name  | Description | Default Value |
25*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- |
26*bcb5dc79SHONG Yifan| <a id="diff_test-name"></a>name |  The name of the test rule.   |  none |
27*bcb5dc79SHONG Yifan| <a id="diff_test-file1"></a>file1 |  Label of the file to compare to `file2`.   |  none |
28*bcb5dc79SHONG Yifan| <a id="diff_test-file2"></a>file2 |  Label of the file to compare to `file1`.   |  none |
29*bcb5dc79SHONG Yifan| <a id="diff_test-failure_message"></a>failure_message |  Additional message to log if the files' contents do not match.   |  `None` |
30*bcb5dc79SHONG Yifan| <a id="diff_test-kwargs"></a>kwargs |  The [common attributes for tests](https://bazel.build/reference/be/common-definitions#common-attributes-tests).   |  none |
31*bcb5dc79SHONG Yifan
32*bcb5dc79SHONG Yifan
33