Fixing the test rustdoc by ignoring *[@id="module-item"]//following-sibling::item-right relationship and rustdoc-gui

This commit is contained in:
Stefan Schindler 2021-06-16 16:16:11 +02:00
parent 6020c79dde
commit e2efcf10de
3 changed files with 9 additions and 8 deletions

View File

@ -365,6 +365,7 @@ def check_tree_attr(tree, path, attr, pat, regexp):
def check_tree_text(tree, path, pat, regexp):
path = normalize_xpath(path)
print("normalize_xpath -> {}".format(path))
ret = False
try:
for e in tree.findall(path):

View File

@ -13,8 +13,8 @@ assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Traits")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Functions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(6)", "Type Definitions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(7)", "Keywords")
assert-text: ("#structs + table td > a", "Foo")
click: "#structs + table td > a"
assert-text: ("#structs + .item-table .item-left > a", "Foo")
click: "#structs + .item-table .item-left > a"
// PAGE: struct.Foo.html
assert-count: (".sidebar .location", 2)
@ -35,8 +35,8 @@ assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Traits")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Functions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Type Definitions")
assert-text: ("#functions + table td > a", "foobar")
click: "#functions + table td > a"
assert-text: ("#functions + .item-table .item-left > a", "foobar")
click: "#functions + .item-table .item-left > a"
// PAGE: fn.foobar.html
// In items containing no items (like functions or constants) and in modules, we have one
@ -57,4 +57,4 @@ assert-text: (".sidebar > .location", "Module sub_sub_module")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Functions")
assert-text: ("#functions + table td > a", "foo")
assert-text: ("#functions + .item-table .item-left > a", "foo")

View File

@ -1,8 +1,8 @@
#![crate_name = "foo"]
// @has foo/index.html '//*[@class="module-item"]//following-sibling::item-right[@class="docblock-short"]' ""
// @!has foo/index.html '//*[@id="module-item"]//following-sibling::item-right[@class="docblock-short"]' "Some text."
// @!has foo/index.html '//*[@id="module-item"]//following-sibling::item-right[@class="docblock-short"]' "let x = 12;"
// @has foo/index.html '//item-right[@class="docblock-short"]' ""
// @!has foo/index.html '//item-right[@class="docblock-short"]' "Some text."
// @!has foo/index.html '//item-right[@class="docblock-short"]' "let x = 12;"
/// ```
/// let x = 12;