From e2efcf10de7569f6b441be662b350b4f0a7de34d Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Wed, 16 Jun 2021 16:16:11 +0200 Subject: [PATCH] Fixing the test rustdoc by ignoring `*[@id="module-item"]//following-sibling::item-right` relationship and rustdoc-gui --- src/etc/htmldocck.py | 1 + src/test/rustdoc-gui/sidebar.goml | 10 +++++----- src/test/rustdoc/short-docblock-codeblock.rs | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index 8647db5a45dc..681520a1daf2 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -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): diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml index 4f6b3aded181..c8ebb8c56f53 100644 --- a/src/test/rustdoc-gui/sidebar.goml +++ b/src/test/rustdoc-gui/sidebar.goml @@ -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") diff --git a/src/test/rustdoc/short-docblock-codeblock.rs b/src/test/rustdoc/short-docblock-codeblock.rs index 9e792e181cda..13b7f0c19a77 100644 --- a/src/test/rustdoc/short-docblock-codeblock.rs +++ b/src/test/rustdoc/short-docblock-codeblock.rs @@ -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;