fix: add diff_test to docs (#296)

This commit is contained in:
Greg Magolan 2022-12-03 11:32:37 -08:00 committed by GitHub
parent 0109a2eee3
commit 421cf266bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 1 deletions

View File

@ -27,6 +27,11 @@ stardoc_with_diff_test(
bzl_library_target = "//lib:docs",
)
stardoc_with_diff_test(
name = "diff_test",
bzl_library_target = "//lib:diff_test",
)
stardoc_with_diff_test(
name = "expand_make_vars",
bzl_library_target = "//lib:expand_make_vars",

37
docs/diff_test.md generated Normal file
View File

@ -0,0 +1,37 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
A test rule that compares two binary files or two directories.
Similar to `bazel-skylib`'s [`diff_test`](https://github.com/bazelbuild/bazel-skylib/blob/main/rules/diff_test.bzl)
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).
<a id="diff_test"></a>
## diff_test
<pre>
diff_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-size">size</a>, <a href="#diff_test-timeout">timeout</a>, <a href="#diff_test-kwargs">kwargs</a>)
</pre>
A test that compares two files.
The test succeeds if the files' contents match.
**PARAMETERS**
| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="diff_test-name"></a>name | The name of the test rule. | none |
| <a id="diff_test-file1"></a>file1 | Label of the file to compare to &lt;code&gt;file2&lt;/code&gt;. | none |
| <a id="diff_test-file2"></a>file2 | Label of the file to compare to &lt;code&gt;file1&lt;/code&gt;. | none |
| <a id="diff_test-size"></a>size | standard attribute for tests | <code>None</code> |
| <a id="diff_test-timeout"></a>timeout | standard attribute for tests. Defaults to "short" if both timeout and size are unspecified. | <code>None</code> |
| <a id="diff_test-kwargs"></a>kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests"&gt;common attributes for tests&lt;/a&gt;. | none |

View File

@ -166,7 +166,11 @@ bzl_library(
bzl_library(
name = "diff_test",
srcs = ["//lib/private:diff_test.bzl"],
srcs = [
"//lib:utils",
"//lib/private:diff_test.bzl",
"//lib/private:directory_path.bzl",
],
)
bzl_library(