From patchwork Tue Dec 10 16:18:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7527: rust-matchers: add doctests for `AlwaysMatcher` From: phabricator X-Patchwork-Id: 43686 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 10 Dec 2019 16:18:12 +0000 Closed by commit rHG542c8b277261: rust-matchers: add doctests for `AlwaysMatcher` (authored by Alphare). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7527?vs=18403&id=18585 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7527/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7527 AFFECTED FILES rust/hg-core/src/matchers.rs CHANGE DETAILS To: Alphare, #hg-reviewers, kevincox, pulkit Cc: durin42, kevincox, mercurial-devel diff --git a/rust/hg-core/src/matchers.rs b/rust/hg-core/src/matchers.rs --- a/rust/hg-core/src/matchers.rs +++ b/rust/hg-core/src/matchers.rs @@ -78,6 +78,16 @@ } /// Matches everything. +///``` +/// use hg::{ matchers::{Matcher, AlwaysMatcher}, utils::hg_path::HgPath }; +/// +/// let matcher = AlwaysMatcher; +/// +/// assert_eq!(true, matcher.matches(HgPath::new(b"whatever"))); +/// assert_eq!(true, matcher.matches(HgPath::new(b"b.txt"))); +/// assert_eq!(true, matcher.matches(HgPath::new(b"main.c"))); +/// assert_eq!(true, matcher.matches(HgPath::new(br"re:.*\.c$"))); +/// ``` #[derive(Debug)] pub struct AlwaysMatcher;