Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
d7159bdb
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d7159bdb
编写于
8月 30, 2021
作者:
G
Guillaume Gomez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add tests for implementors associated types display
上级
eb913664
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
40 addition
and
12 deletion
+40
-12
src/test/rustdoc-gui/implementors.goml
src/test/rustdoc-gui/implementors.goml
+9
-9
src/test/rustdoc-gui/src/lib2/implementors/lib.rs
src/test/rustdoc-gui/src/lib2/implementors/lib.rs
+5
-1
src/test/rustdoc-gui/src/lib2/lib.rs
src/test/rustdoc-gui/src/lib2/lib.rs
+3
-1
src/test/rustdoc-gui/toggle-implementors.goml
src/test/rustdoc-gui/toggle-implementors.goml
+13
-0
src/test/rustdoc/trait-impl-items-links-and-anchors.rs
src/test/rustdoc/trait-impl-items-links-and-anchors.rs
+10
-1
未找到文件。
src/test/rustdoc-gui/implementors.goml
浏览文件 @
d7159bdb
...
...
@@ -3,14 +3,14 @@
goto: file://|DOC_PATH|/implementors/trait.Whatever.html
assert: "#implementors-list"
// There are supposed to be two implementors listed.
assert-count: ("#implementors-list
>
.impl", 2)
assert-count: ("#implementors-list .impl", 2)
// Now we check that both implementors have an anchor, an ID and a similar DOM.
assert: ("#implementors-list
>
.impl:nth-child(1) > a.anchor")
assert-attribute: ("#implementors-list
>
.impl:nth-child(1)", {"id": "impl-Whatever"})
assert-attribute: ("#implementors-list
>
.impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"})
assert: "#implementors-list
>
.impl:nth-child(1) > .code-header.in-band"
assert: ("#implementors-list .impl:nth-child(1) > a.anchor")
assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever"})
assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"})
assert: "#implementors-list .impl:nth-child(1) > .code-header.in-band"
assert: ("#implementors-list
>
.impl:nth-child(2) > a.anchor")
assert-attribute: ("#implementors-list
>
.impl:nth-child(2)", {"id": "impl-Whatever-1"})
assert-attribute: ("#implementors-list
>
.impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
assert: "#implementors-list
>
.impl:nth-child(2) > .code-header.in-band"
assert: ("#implementors-list .impl:nth-child(2) > a.anchor")
assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whatever-1"})
assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
assert: "#implementors-list .impl:nth-child(2) > .code-header.in-band"
src/test/rustdoc-gui/src/lib2/implementors/lib.rs
浏览文件 @
d7159bdb
pub
trait
Whatever
{
type
Foo
;
fn
method
()
{}
}
pub
struct
Struct
;
impl
Whatever
for
Struct
{}
impl
Whatever
for
Struct
{
type
Foo
=
u8
;
}
src/test/rustdoc-gui/src/lib2/lib.rs
浏览文件 @
d7159bdb
...
...
@@ -38,7 +38,9 @@ impl Trait for Foo {
}
impl
implementors
::
Whatever
for
Foo
{}
impl
implementors
::
Whatever
for
Foo
{
type
Foo
=
u32
;
}
pub
mod
sub_mod
{
/// ```txt
...
...
src/test/rustdoc-gui/toggle-implementors.goml
0 → 100644
浏览文件 @
d7159bdb
// This test ensures two things:
//
// 1. The implementors toggle are not open by default.
// 2. The "auto-collapse-implementors" setting is working as expected.
goto: file://|DOC_PATH|/implementors/trait.Whatever.html
// First, checking that they are not open by default.
assert-attribute-false: ("#implementors-list > details", {"open": ""}, ALL)
// Second, checking "auto-collapse-implementors" setting.
local-storage: {"rustdoc-auto-collapse-implementors": false}
reload:
assert-attribute: ("#implementors-list > details", {"open": ""}, ALL)
src/test/rustdoc/trait-impl-items-links-and-anchors.rs
浏览文件 @
d7159bdb
pub
trait
MyTrait
{
type
Assoc
;
const
VALUE
:
u32
;
const
VALUE
:
u32
=
12
;
fn
trait_function
(
&
self
);
fn
defaulted
(
&
self
)
{}
fn
defaulted_override
(
&
self
)
{}
...
...
@@ -38,9 +38,11 @@ fn defaulted_override(&self) {}
}
impl
MyTrait
for
MyStruct
{
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc
type
Assoc
=
bool
;
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE
const
VALUE
:
u32
=
20
;
...
...
@@ -55,3 +57,10 @@ fn defaulted_override(&self) {}
}
pub
struct
MyStruct
;
// We check that associated items with default values aren't generated in the implementors list.
impl
MyTrait
for
(
u8
,
u8
)
{
// @!has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]'
type
Assoc
=
bool
;
fn
trait_function
(
&
self
)
{}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录