Skip to content

Commit

Permalink
Create test for CcInfo provider
Browse files Browse the repository at this point in the history
Testing provider by creating rule in .bzl file

RELNOTES: None
PiperOrigin-RevId: 251486134
  • Loading branch information
Googler authored and copybara-github committed Jun 4, 2019
1 parent cc41129 commit 1bce754
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/test/java/com/google/devtools/build/skydoc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ java_test(
],
)

skydoc_test(
name = "cc_api_test",
golden_file = "testdata/cc_api_test/golden.txt",
input_file = "testdata/cc_api_test/input.bzl",
skydoc = "//src/main/java/com/google/devtools/build/skydoc",
)

skydoc_test(
name = "simple_test",
golden_file = "testdata/simple_test/golden.txt",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->

<a name="#cpp_related_rule"></a>

## cpp_related_rule

<pre>
cpp_related_rule(<a href="#cpp_related_rule-name">name</a>, <a href="#cpp_related_rule-first">first</a>, <a href="#cpp_related_rule-fourth">fourth</a>, <a href="#cpp_related_rule-second">second</a>, <a href="#cpp_related_rule-third">third</a>)
</pre>

This rule does C++-related things.

### Attributes

<table class="params-table">
<colgroup>
<col class="col-param" />
<col class="col-description" />
</colgroup>
<tbody>
<tr id="cpp_related_rule-name">
<td><code>name</code></td>
<td>
<a href="https://bazel.build/docs/build-ref.html#name">Name</a>; required
<p>
A unique name for this target.
</p>
</td>
</tr>
<tr id="cpp_related_rule-first">
<td><code>first</code></td>
<td>
<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>; required
</td>
</tr>
<tr id="cpp_related_rule-fourth">
<td><code>fourth</code></td>
<td>
Boolean; optional
</td>
</tr>
<tr id="cpp_related_rule-second">
<td><code>second</code></td>
<td>
<a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a>; required
</td>
</tr>
<tr id="cpp_related_rule-third">
<td><code>third</code></td>
<td>
<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>; required
</td>
</tr>
</tbody>
</table>


<a name="#exercise_the_api"></a>

## exercise_the_api

<pre>
exercise_the_api()
</pre>





<a name="#my_rule_impl"></a>

## my_rule_impl

<pre>
my_rule_impl(<a href="#my_rule_impl-ctx">ctx</a>)
</pre>



### Parameters

<table class="params-table">
<colgroup>
<col class="col-param" />
<col class="col-description" />
</colgroup>
<tbody>
<tr id="my_rule_impl-ctx">
<td><code>ctx</code></td>
<td>
required.
</td>
</tr>
</tbody>
</table>


Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Input file for C++ api test """

def exercise_the_api():
var1 = CcInfo

exercise_the_api()

def my_rule_impl(ctx):
return []

cpp_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does C++-related things.",
attrs = {
"first": attr.label(mandatory = True, allow_single_file = True),
"second": attr.string_dict(mandatory = True),
"third": attr.output(mandatory = True),
"fourth": attr.bool(default = False, mandatory = False),
},
)

0 comments on commit 1bce754

Please sign in to comment.