Add test case for Parser::find_member

This commit is contained in:
Robin Krahl 2020-09-11 20:55:23 +02:00
parent 229b1bdd5c
commit 77a9163bb1
No known key found for this signature in database
GPG Key ID: 8E9B0870524F69D8
2 changed files with 15 additions and 0 deletions

View File

@ -18,6 +18,8 @@ SPDX-License-Identifier: MIT
- Use one snapshot per test case and rustdoc version.
- Refactor member lookup for compatibility with Rust 1.46.0.
- Add tests for Rust 1.46.0.
- Improve test suite:
- Add test for `Parser::find_member`.
## v0.2.0 (2020-08-11)

View File

@ -779,6 +779,19 @@ mod tests {
});
}
#[test]
fn test_find_member() {
with_rustdoc("*", |_, path| {
let path = path.join("kuchiki").join("struct.NodeDataRef.html");
let name: doc::Fqn = "kuchiki::NodeDataRef::as_node".to_owned().into();
let ty = super::Parser::from_file(path)
.unwrap()
.find_member(&name)
.unwrap();
assert_eq!(Some(doc::ItemType::Method), ty);
});
}
#[test]
fn test_parse_member_doc() {
with_rustdoc("*", |_, path| {