From 77a9163bb1d35665c5159d3591847c8f9d1c9716 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 11 Sep 2020 20:55:23 +0200 Subject: [PATCH] Add test case for Parser::find_member --- CHANGELOG.md | 2 ++ src/parser/mod.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fa92f6..2fbaddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 51e649b..d14b45d 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -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| {