spec(module_doc): add "Object methods" tests
This commit is contained in:
parent
5e6ceb7e04
commit
efb54bf92b
|
@ -231,6 +231,71 @@ describe("Scrap documentation", function()
|
|||
})
|
||||
end)
|
||||
|
||||
it("should provide a Function node with the `self` as the first positional parameter", function()
|
||||
local ast <const> = get_doc_from_page([[
|
||||
<h2 class="section-header"><a name="Object_methods"></a>Object methods</h2>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a class="copy-link js-copy-link" name="swap" href="#swap">🔗</a>
|
||||
<strong
|
||||
>:swap <span class="function_args"> <b>(</b>tag2<b>)</b></span></strong
|
||||
>
|
||||
<span class="proptype"></span>
|
||||
<span class="baseclass"> </span>
|
||||
</dt>
|
||||
<dd>
|
||||
<h3>Parameters:</h3>
|
||||
<table class="see_also">
|
||||
<tbody>
|
||||
<tr class="param_header">
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
<th>Type(s)</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="parameter">tag2</span></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<span class="types"><span class="type">tag</span></span>
|
||||
</td>
|
||||
<td class="see_also_description">The second tag</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
]], "awful.tag")
|
||||
assert.same(ast, {
|
||||
children = {
|
||||
{
|
||||
children = {},
|
||||
name = "Signal",
|
||||
token = "enum",
|
||||
},
|
||||
{
|
||||
parameters = {
|
||||
{
|
||||
types = { "Tag" },
|
||||
name = "self",
|
||||
token = "variable",
|
||||
},
|
||||
{
|
||||
types = { "tag" }, -- This needs to be fixed : tag -> Tag
|
||||
name = "tag2",
|
||||
token = "variable",
|
||||
}
|
||||
},
|
||||
return_types = {},
|
||||
name = "swap",
|
||||
token = "function",
|
||||
},
|
||||
},
|
||||
name = "Tag",
|
||||
token = "module",
|
||||
})
|
||||
end)
|
||||
|
||||
it("should produce Signal nodes", function()
|
||||
local ast <const> = get_doc_from_page([[
|
||||
<h2 class="section-header"><a name="Signals"></a>Signals</h2>
|
||||
|
|
Loading…
Reference in New Issue